> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Import Status

> Retrieve the current status and validation summary of an import session

# Get Import Status

Retrieve the current lifecycle status and validation summary of an import session. Use this to check whether a session is ready to submit, or to monitor progress after submission.

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="import_id" type="string" required>
  UUID of the import session

  **Example:** `"11111111-1111-1111-1111-111111111111"`
</ParamField>

## Response

<ResponseField name="import_id" type="string">
  UUID of the import session
</ResponseField>

<ResponseField name="status" type="string">
  Current lifecycle status

  **Values:** `created`, `parsed`, `mapped`, `validating`, `validated`, `submitting`, `submitted`, `failed`, `expired`
</ResponseField>

<ResponseField name="template_id" type="string">
  Backend template identifier used for this import
</ResponseField>

<ResponseField name="file_name" type="string">
  Original filename of the uploaded file
</ResponseField>

<ResponseField name="numeric_locale" type="string | null">
  Numeric locale applied during parsing
</ResponseField>

<ResponseField name="date_locale" type="string | null">
  Date locale applied (`dmy` or `mdy`)
</ResponseField>

<ResponseField name="total_rows" type="integer">
  Total number of data rows
</ResponseField>

<ResponseField name="valid_rows" type="integer">
  Number of rows that passed validation
</ResponseField>

<ResponseField name="error_rows" type="integer">
  Number of rows with validation errors
</ResponseField>

<ResponseField name="errors_by_column" type="object">
  Error counts per column key. Example: `{"weight_kg": 3, "date": 1}`
</ResponseField>

<ResponseField name="mapping" type="object | null">
  Confirmed column mapping (`{target_column: source_column}`) or null if not yet mapped
</ResponseField>

<ResponseField name="file_id" type="string | null">
  UUID of the file created after submission
</ResponseField>

<ResponseField name="processing_job_id" type="string | null">
  UUID of the downstream processing job started after submission
</ResponseField>

<ResponseField name="source_columns" type="array[string]">
  Column headers detected in the source file
</ResponseField>

<ResponseField name="created_at" type="datetime">
  ISO 8601 timestamp when the session was created
</ResponseField>

<ResponseField name="updated_at" type="string | null">
  ISO 8601 timestamp of the last update
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v2/imports/11111111-1111-1111-1111-111111111111/status" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  headers = {
      "x-api-key": os.getenv("DCYCLE_API_KEY"),
      "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
  }

  import_id = "11111111-1111-1111-1111-111111111111"
  response = requests.get(
      f"https://api.dcycle.io/v2/imports/{import_id}/status",
      headers=headers,
  )

  status = response.json()
  print(f"Status: {status['status']}")
  print(f"Rows: {status['valid_rows']}/{status['total_rows']} valid")
  if status["error_rows"]:
      print(f"Errors: {status['errors_by_column']}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const headers = {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID,
  };

  const importId = '11111111-1111-1111-1111-111111111111';

  axios.get(`https://api.dcycle.io/v2/imports/${importId}/status`, { headers })
    .then(response => {
      const { status, valid_rows, total_rows, error_rows } = response.data;
      console.log(`Status: ${status}, ${valid_rows}/${total_rows} valid`);
      if (error_rows) console.log(`Errors by column:`, response.data.errors_by_column);
    });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "import_id": "11111111-1111-1111-1111-111111111111",
  "status": "validated",
  "template_id": "logistics_requests",
  "file_name": "logistics-data.csv",
  "numeric_locale": "es_ES",
  "date_locale": null,
  "language_locale": null,
  "total_rows": 240,
  "valid_rows": 237,
  "error_rows": 3,
  "errors_by_column": {
    "weight_kg": 2,
    "date": 1
  },
  "mapping": {
    "origin": "origin",
    "destination": "destination",
    "weight": "weight_kg",
    "date": "date",
    "vehicle_type": "vehicle_type"
  },
  "file_id": null,
  "processing_job_id": null,
  "source_columns": ["origin", "destination", "weight_kg", "date", "vehicle_type"],
  "sample_rows": [
    ["Madrid", "Barcelona", "1500", "15/03/2024", "truck"]
  ],
  "created_at": "2024-11-24T10:30:00Z",
  "updated_at": "2024-11-24T10:35:00Z"
}
```

## Session Status Lifecycle

| Status       | Meaning                                              |
| ------------ | ---------------------------------------------------- |
| `created`    | Session created, file not yet fully parsed           |
| `parsed`     | File parsed, columns detected, ready for mapping     |
| `mapped`     | Column mapping confirmed                             |
| `validating` | Row validation in progress                           |
| `validated`  | Validation complete, ready to submit (or fix errors) |
| `submitting` | Submission in progress                               |
| `submitted`  | Submitted for downstream processing                  |
| `failed`     | Processing failed                                    |
| `expired`    | Session expired (not submitted within TTL)           |

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** The import session does not exist or belongs to another organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Not Found"}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Create Session" icon="upload" href="/api-reference/imports/create-session">
    Upload a file and start a new import
  </Card>

  <Card title="Submit Import" icon="paper-plane" href="/api-reference/imports/submit">
    Submit the validated session
  </Card>
</CardGroup>
