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

# Fetch Import

> Returns the state of an import created by a v2 write endpoint, with every call it merged: its status, and for each resource it writes the counts of the rows, the rows it set aside and the failure of the resource. Call it until status is finished. The imports created by the v1 endpoints are followed with /v1/imports/{import_id}.

## Overview

This endpoint returns the state of an import created by a v2 write endpoint:
where it stands, and what became of the rows it wrote.

**Use this endpoint for:**

* Waiting for the values you sent to be written
* Finding the rows an import set aside, to fix them on your side

> [!NOTE]
>
> It follows the imports of
> [Import quota values](https://docs.qobra.co/api_reference/v2/endpoints/data/import_quota_values.md).
> The imports created by the v1 endpoints are followed with the v1
> [Fetch import](https://docs.qobra.co/api_reference/v1/endpoints/imports/fetch_import.md): here, their
> id returns `404 Not Found`.

***

## Your first call

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.qobra.co/v2/imports/IMPORT_ID' \
  --header 'X-API-Key: YOUR_API_KEY'
```

```python Python theme={null}
import time

import requests

url = f"https://api.qobra.co/v2/imports/{import_id}"
headers = {"X-API-Key": "YOUR_API_KEY"}

while True:
    data_import = requests.get(url, headers=headers).json()
    if data_import["status"] == "finished":
        break
    time.sleep(10)
```

### Example response

```json theme={null}
{
  "id": "6740c3d2a1b2c3d4e5f60718",
  "status": "finished",
  "progress": 100,
  "created_at": "2026-11-16T09:12:03+00:00",
  "launched_at": "2026-11-16T09:12:33+00:00",
  "finished_at": "2026-11-16T09:12:35+00:00",
  "resources": [
    {
      "resource_type": "quota",
      "resource_id": "507f1f77bcf86cd799439013",
      "category": null,
      "status": "finished",
      "progress": 100,
      "records_processed": 5,
      "counts": { "created": 1, "updated": 1, "deleted": 1, "skipped": 2 },
      "errors": [],
      "warnings": [
        {
          "path": ["data", 4, "standard.user"],
          "description": "No user has this email",
          "received": "unknown@company.com",
          "row": {
            "standard.user": "unknown@company.com",
            "standard.date": "2026-03-31",
            "standard.value": 100000.0,
            "deleted": false
          }
        }
      ]
    }
  ]
}
```

***

## What an import holds

| Field | What it holds |
| - | - |
| `id` | Id of the import, the `import_id` the write calls returned |
| `status` | `scheduled`, `running` or `finished`, see below |
| `progress` | From 0 to 100 |
| `created_at` | When the first call created the import |
| `launched_at` | When the import started, `null` until then |
| `finished_at` | When the import finished, `null` until then |
| `resources` | One item per quota the import writes |

| `status` | What it means |
| - | - |
| `scheduled` | The import waits: for its `debounce`, or for another import to finish |
| `running` | The import writes |
| `finished` | Every resource is done. Read `resources` to know how each one went |

An import can stay `scheduled` for a few minutes when another import of your
company is running.

***

## One item per quota

An import can write several quotas. Each item of `resources` tells what became
of the rows of one of them:

| Field | What it holds |
| - | - |
| `resource_type` | `quota` |
| `resource_id` | The `quota_id` of the calls |
| `category` | Always `null` for a quota |
| `status` | `scheduled`, `running` or `finished`, for this quota |
| `progress` | From 0 to 100, for this quota |
| `records_processed` | Rows the calls sent for this quota. `0` until the import runs |
| `counts` | `created`, `updated`, `deleted` and `skipped`, which add up to `records_processed` |
| `errors` | The failure of the whole quota, when none of its rows could be written |
| `warnings` | The rows set aside, the first 100. The other rows are written |

`skipped` counts the rows set aside and the values identical to the ones already
stored.

***

## A row set aside

Each item of `warnings` tells why a row was set aside, and repeats it:

| Field | What it holds |
| - | - |
| `path` | Where the row lies in the `data` of its call, counted from 0 |
| `description` | Why it was set aside |
| `received` | The value of the key in `path`, cut to 100 characters, or `null` |
| `row` | The row |

The rows set aside are an unknown or archived user, and a row replaced by a
later one for the same user and period. An item of `errors` has the same
fields, with a `path` of `[]` and a `row` of `null`.

***

## Errors

| Status | Cause |
| - | - |
| `401` | Missing or unknown API key |
| `403` | The public API is not enabled for your company |
| `404` | Unknown id, the import of another company, or a v1 import |

Read the import right after the call that created it: the response is always up
to date.


## OpenAPI

````yaml get /v2/imports/{import_id}
openapi: 3.0.2
info:
  version: 2.0.0
  title: Qobra API v2
  description: >-
    Qobra API v2 - Extract your data with ID-based pagination and flexible
    schema discovery, and import the values of your quotas.
  license:
    name: Proprietary
    url: https://www.qobra.co/terms
servers:
  - url: https://api.qobra.co
    description: Production API
security: []
paths:
  /v2/imports/{import_id}:
    get:
      tags:
        - public_api
        - v2
        - imports
      summary: Fetch Import
      description: >-
        Returns the state of an import created by a v2 write endpoint, with
        every call it merged: its status, and for each resource it writes the
        counts of the rows, the rows it set aside and the failure of the
        resource. Call it until status is finished. The imports created by the
        v1 endpoints are followed with /v1/imports/{import_id}.
      operationId: GET_/v2/imports/(import_id)
      parameters:
        - name: import_id
          in: path
          required: true
          schema:
            type: string
            format: ObjectId
          description: ID of an import, the import_id returned by a v2 write endpoint
      responses:
        '200':
          description: The state of the import.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportModel'
              examples:
                finished:
                  $ref: '#/components/examples/ImportResponseFinishedExample'
                scheduled:
                  $ref: '#/components/examples/ImportResponseScheduledExample'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
              examples:
                unauthorized-error:
                  $ref: '#/components/examples/UnauthorizedErrorResponseExample'
        '403':
          description: Forbidden - the public API is not enabled for your company
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorResponse'
              examples:
                forbidden-error:
                  $ref: '#/components/examples/ForbiddenErrorResponseExample'
        '404':
          description: Not Found - unknown id, or an import created by a v1 endpoint
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
              examples:
                not-found-error:
                  $ref: '#/components/examples/NotFoundErrorResponseExample'
      security:
        - api_key: []
components:
  schemas:
    ImportModel:
      type: object
      description: >-
        The state of an import, with every call it merged: no result is kept per
        call
      properties:
        id:
          type: string
          format: ObjectId
          description: ID of the import, the import_id the calls returned
        status:
          type: string
          enum:
            - scheduled
            - running
            - finished
          description: >-
            scheduled while the import waits for its turn or for its debounce,
            running while it writes, finished once every resource is done
        progress:
          type: integer
          minimum: 0
          maximum: 100
          description: Average progress of its resources
        created_at:
          type: string
          format: date-time
          description: When the first call created the import
        launched_at:
          type: string
          format: date-time
          nullable: true
          description: When the import started, null until then
        finished_at:
          type: string
          format: date-time
          nullable: true
          description: When the import finished, null until then
        resources:
          type: array
          items:
            $ref: '#/components/schemas/ImportResourceModel'
          description: One item per resource the import writes
      required:
        - id
        - status
        - progress
        - created_at
        - launched_at
        - finished_at
        - resources
    UnauthorizedErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        type:
          type: string
          enum:
            - UnauthorizedError
          description: Type of the error
      required:
        - message
        - type
    ForbiddenErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        type:
          type: string
          enum:
            - ForbiddenError
          description: Type of the error
        error:
          type: string
          description: Machine-readable error code
      required:
        - message
        - type
        - error
    NotFoundErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        resource:
          type: string
          description: Resource that caused the error
        type:
          type: string
          enum:
            - NotFoundError
          description: Type of the error
      required:
        - message
        - resource
        - type
    ImportResourceModel:
      type: object
      description: >-
        What the import did to one resource. The calls on several quotas merged
        into one import each keep their own: one item per quota
      properties:
        resource_type:
          type: string
          description: 'Type of the resource written: quota'
        resource_id:
          type: string
          format: ObjectId
          nullable: true
          description: 'ID of the resource written: the quota_id of the calls'
        category:
          type: string
          nullable: true
          description: Always null for a quota
        status:
          type: string
          enum:
            - scheduled
            - running
            - finished
          description: Where the writing of this resource stands
        progress:
          type: integer
          minimum: 0
          maximum: 100
          description: Percentage of the rows of this resource processed
        records_processed:
          type: integer
          description: Number of rows the calls sent for this resource
        counts:
          $ref: '#/components/schemas/ImportCountsModel'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ImportIssueModel'
          description: >-
            The failure of the whole resource, when it failed, for example
            because the quota was archived before the import ran: none of its
            rows was written
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/ImportIssueModel'
          description: >-
            The rows the import set aside, the others being written: the first
            100
      required:
        - resource_type
        - resource_id
        - category
        - status
        - progress
        - records_processed
        - counts
        - errors
        - warnings
    ImportCountsModel:
      type: object
      description: What became of the rows processed, which these four numbers add up to
      properties:
        created:
          type: integer
          description: Cells that had no value
        updated:
          type: integer
          description: Cells whose value changed
        deleted:
          type: integer
          description: 'Cells cleared with deleted: true'
        skipped:
          type: integer
          description: >-
            Rows set aside, listed in warnings, and values identical to the ones
            already stored
      required:
        - created
        - updated
        - deleted
        - skipped
    ImportIssueModel:
      type: object
      description: >-
        A row the import set aside, or the failure of a whole resource, which
        has neither path nor row
      properties:
        path:
          type: array
          items:
            oneOf:
              - type: string
              - type: integer
          description: >-
            Where the row lies in the data of its call, as in the errors of the
            write endpoints. [] for the failure of a whole resource
        description:
          type: string
          description: Why the row was set aside, or why the resource failed
        received:
          description: The value of the key in error, cut to 100 characters, or null
        row:
          type: object
          nullable: true
          description: >-
            The row as the import read it, which tells two rows with the same
            path apart. null for the failure of a whole resource
      required:
        - path
        - description
        - received
        - row
  examples:
    ImportResponseFinishedExample:
      value:
        id: 6740c3d2a1b2c3d4e5f60718
        status: finished
        progress: 100
        created_at: '2026-11-16T09:12:03+00:00'
        launched_at: '2026-11-16T09:12:33+00:00'
        finished_at: '2026-11-16T09:12:35+00:00'
        resources:
          - resource_type: quota
            resource_id: 507f1f77bcf86cd799439013
            category: null
            status: finished
            progress: 100
            records_processed: 5
            counts:
              created: 1
              updated: 1
              deleted: 1
              skipped: 2
            errors: []
            warnings:
              - path:
                  - data
                  - 0
                  - standard.user
                description: >-
                  Multiple values for the same user and period — the last value
                  was kept (2026-03)
                received: sarah.johnson@company.com
                row:
                  standard.user: sarah.johnson@company.com
                  standard.date: '2026-03-31'
                  standard.value: 120000
                  deleted: false
              - path:
                  - data
                  - 4
                  - standard.user
                description: No user has this email
                received: unknown@company.com
                row:
                  standard.user: unknown@company.com
                  standard.date: '2026-03-31'
                  standard.value: 100000
                  deleted: false
    ImportResponseScheduledExample:
      value:
        id: 6740c3d2a1b2c3d4e5f60718
        status: scheduled
        progress: 0
        created_at: '2026-11-16T09:12:03+00:00'
        launched_at: null
        finished_at: null
        resources:
          - resource_type: quota
            resource_id: 507f1f77bcf86cd799439013
            category: null
            status: scheduled
            progress: 0
            records_processed: 0
            counts:
              created: 0
              updated: 0
              deleted: 0
              skipped: 0
            errors: []
            warnings: []
    UnauthorizedErrorResponseExample:
      value:
        message: You're trying to access resource you're not authorized to.
        type: UnauthorizedError
    ForbiddenErrorResponseExample:
      value:
        message: You don't have permission to access this resource.
        type: ForbiddenError
        error: ForbiddenError
    NotFoundErrorResponseExample:
      value:
        message: We couldn't find the requested resource
        resource: ObjectModel
        type: NotFoundError
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header
      description: Your Qobra API key. Generate it from Settings > API Keys in Qobra.

````