> ## 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.

# Submit Import

> Submit a validated import session for downstream processing

# Submit Import

Submit a validated import session for downstream processing. This creates the data file and starts the processing pipeline that will ingest the records into your organization's data.

<Warning>
  Submission is irreversible. Once submitted, the session cannot be modified or re-submitted. Make sure all row corrections are complete before submitting.
</Warning>

## 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>

<ParamField header="x-partner" type="string" required>
  Partner identifier for the submitting application

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

### Path Parameters

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

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

### Body Parameters

<ParamField body="ignore_errors" type="boolean" default="false">
  When `true`, submit even if some rows have validation errors. Only valid rows will be processed; error rows are skipped.
</ParamField>

<ParamField body="context" type="object">
  Additional context values collected late in the wizard (e.g. `facility_id` for wastes). Values are merged into the session before submission.

  **Example:** `{"facility_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa"}`
</ParamField>

## Response

<ResponseField name="status" type="string">
  Submission result status (e.g. `submitted`)
</ResponseField>

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

<ResponseField name="processing_job_id" type="string | null">
  UUID of the downstream processing job. Use this to track processing progress.
</ResponseField>

<ResponseField name="rows_submitted" type="integer">
  Number of rows submitted for processing
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST "https://api.dcycle.io/v2/imports/11111111-1111-1111-1111-111111111111/submit" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}" \
    -H "x-partner: dcycle" \
    -H "Content-Type: application/json" \
    -d '{"ignore_errors": false}'
  ```

  ```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"),
      "x-partner": "dcycle",
      "Content-Type": "application/json",
  }

  import_id = "11111111-1111-1111-1111-111111111111"

  response = requests.post(
      f"https://api.dcycle.io/v2/imports/{import_id}/submit",
      headers=headers,
      json={"ignore_errors": False},
  )

  result = response.json()
  print(f"Status: {result['status']}")
  print(f"Rows submitted: {result['rows_submitted']}")
  if result.get("processing_job_id"):
      print(f"Processing job: {result['processing_job_id']}")
  ```

  ```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,
    'x-partner': 'dcycle',
    'Content-Type': 'application/json',
  };

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

  axios.post(`https://api.dcycle.io/v2/imports/${importId}/submit`, {
    ignore_errors: false,
  }, { headers })
  .then(response => {
    const { status, rows_submitted, processing_job_id } = response.data;
    console.log(`${status}: ${rows_submitted} rows, job ${processing_job_id}`);
  });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "status": "submitted",
  "file_id": "22222222-2222-2222-2222-222222222222",
  "processing_job_id": "33333333-3333-3333-3333-333333333333",
  "rows_submitted": 237
}
```

## 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"}
```

### 400 Bad Request

**Cause:** Session has validation errors and `ignore_errors` is `false`

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Import session has 3 error rows. Set ignore_errors=true to submit only valid rows."
}
```

### 409 Conflict

**Cause:** Session has already been submitted

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Import session has already been submitted."
}
```

### 422 Unprocessable Entity

**Cause:** Missing required context field for the template

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "facility_id is required for template 'wastes'"
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Import Status" icon="circle-info" href="/api-reference/imports/get-status">
    Check submission and processing progress
  </Card>

  <Card title="Create Session" icon="upload" href="/api-reference/imports/create-session">
    Start a new import
  </Card>
</CardGroup>
