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

# Run an import

> Run a declared import over an uploaded file. dry_run validates every row and writes nothing.

**Re-sent under the same Idempotency-Key:** The key names each row's write: re-sent, rows that saved answer again and are not written twice. Unlike an action run, an import that stopped part way is continued by a re-send: the rows it did not reach are saved. Uploading the rows that did not save is a new import, under a new key.



## OpenAPI

````yaml ontology/openapi.json POST /v1/object-model/imports/{import_id}/run
openapi: 3.1.0
info:
  description: >-
    An organization's records, facts and figures.


    **Beta.** Every operation is `x-stability: beta`: paths, fields and codes
    may still change before v1 is declared stable. From then on, changes within
    v1 are additive only — new operations, optional fields, response fields,
    enum values and error codes — so a client must ignore fields and values it
    does not know. Anything else needs a new version or a six-month deprecation
    announced with Deprecation and Sunset headers.


    ## Idempotency


    Every write needs an `Idempotency-Key` header: 1–255 printable ASCII
    characters, one key per logical write, sent again unchanged on every retry
    of that write. Reads, the read-only POSTs (`/record-search`,
    `/records/{type_id}/query`, `/facts/query`, `/figures/query`,
    `/figures/explain`) and dry runs (`dry_run: true`) need none and are never
    recorded. A write without one is refused with 400
    `idempotency_key_required`.


    A key belongs to the organization and the person the API key acts for, so
    two of one person's API keys retrying one write agree; another person's
    request under the same key is their own. The API records the request — the
    method, the route, the path parameters, the body as parsed (JSON key order
    and spacing do not matter) and any `If-Match` — and its answer:


    - **The same key and the same request, finished**: the recorded answer again
    — status, body, `Object-Model-Version` and `X-Request-Id` — with
    `Idempotent-Replayed: true`. Nothing runs again, and an `If-Match` the
    original carried is not checked again (the original's own success moved the
    version it named).

    - **The same key and the same request, still running**: 409
    `request_in_progress` with `Retry-After`.

    - **The same key and a different request**: 409 `idempotency_key_reused`.
    Use a new key for a new request.


    A replay is authorized like any request first: the API key must still be
    valid and carry the route's scope, and the rate limit counts it.


    **Retention.** A finished write answers its replays for 24 hours; after that
    the key is free again and a request under it runs. A request still running
    holds its key for as long as the API waits for it plus 30 seconds. Each
    write says, under **Re-sent under the same Idempotency-Key**, what a request
    sent again after that gets — past the 24 hours, or after a 504 ("past the
    replay window"). Most writes still recognize their key then, and are not
    made twice.


    **What is recorded.** Every answer the request got, refusals included: a 422
    for an action that stopped part way replays with what it committed, so a
    retry never silently writes more. A 403 for a missing permission, a 5xx, a
    503 and a 504 are not recorded, because none says what was committed: a
    retry with the same key runs again, and the write's own key keeps it from
    being made twice. After a 504 the request may still be running, so a retry
    within its hold hears `request_in_progress`. If the record cannot be written
    or read, the write is not run: 503 `idempotency_unavailable` with
    `Retry-After`.


    **A lost response.**


    ```http

    POST /v1/object-model/records/company

    Idempotency-Key: create-acme-2026-11-12


    {"values": {"name": "Acme"}}

    ```


    The connection drops before the answer arrives. The client sends the same
    request with the same key:


    ```http

    HTTP/1.1 200 OK

    Idempotent-Replayed: true

    X-Request-Id: 7f3a…   (the original request's)


    {"written_id": "6650…", "disposition": "created", "records": […]}

    ```


    **A concurrent duplicate.** A second copy arrives while the first is still
    running:


    ```http

    HTTP/1.1 409 Conflict

    Retry-After: 2


    {"status": "failed", "code": "request_in_progress", "error": "a request with
    this Idempotency-Key is still running; retry after it finishes to get its
    answer"}

    ```


    Retried after it finishes, it gets the first copy's answer with
    `Idempotent-Replayed: true`.


    **The generic endpoint** (`POST /v1/object-model/{object_model_id}/request`,
    the older endpoint these routes replace) takes `Idempotency-Key` optionally:
    without one a request runs every time it is sent; with one it is recorded
    and replayed as above. The model create (`POST /v1/object-model`) needs
    none: an organization has one model, and a second create is refused.
  title: VectorShift Object Model API
  version: '1'
servers:
  - url: https://api.vectorshift.ai
security: []
paths:
  /v1/object-model/imports/{import_id}/run:
    post:
      tags:
        - imports
      summary: >-
        Run a declared import over an uploaded file. dry_run validates every row
        and writes nothing.
      description: >-
        Run a declared import over an uploaded file. dry_run validates every row
        and writes nothing.


        **Re-sent under the same Idempotency-Key:** The key names each row's
        write: re-sent, rows that saved answer again and are not written twice.
        Unlike an action run, an import that stopped part way is continued by a
        re-send: the rows it did not reach are saved. Uploading the rows that
        did not save is a new import, under a new key.
      operationId: post_imports_by_import_id_run
      parameters:
        - in: path
          name: import_id
          required: true
          schema:
            type: string
        - description: >-
            Required on every write: one key per logical write, sent again
            unchanged on every retry. A finished request replays its answer for
            24 hours; the same key on a different request is refused (409
            `idempotency_key_reused`). A dry run (`dry_run: true`) needs none,
            and is not recorded under one it carries.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 255
            minLength: 1
            pattern: ^[\x20-\x7E]+$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/object_model_ImportRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/object_model_ImportResult'
          description: Answered.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is a recorded answer to an earlier request with
                the same Idempotency-Key, answered again without running the
                write.
              schema:
                enum:
                  - 'true'
                type: string
            Object-Model-Version:
              description: The model version the request was served under.
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            Malformed JSON, an unknown field, an unknown query parameter, one
            naming a field the route fixes, or a malformed Idempotency-Key (code
            `invalid_request`); a write with no Idempotency-Key (code
            `idempotency_key_required`).
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: Missing, invalid or expired API key.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            The key lacks the scope (`scope_required`), the person lacks the
            permission (`forbidden`), or a feature the request needs is not
            enabled for the organization (`not_enabled`).
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            No such record, or one this caller cannot see — the same answer on
            purpose.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is a recorded answer to an earlier request with
                the same Idempotency-Key, answered again without running the
                write.
              schema:
                enum:
                  - 'true'
                type: string
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '409':
          content:
            application/json:
              examples:
                idempotency_key_reused:
                  summary: The key was used for a different request
                  value:
                    code: idempotency_key_reused
                    error: >-
                      this Idempotency-Key was used for a different request;
                      send a new key for a new request
                    status: failed
                request_in_progress:
                  summary: >-
                    A concurrent duplicate: the first request with this key is
                    still running
                  value:
                    code: request_in_progress
                    error: >-
                      a request with this Idempotency-Key is still running;
                      retry after it finishes to get its answer
                    status: failed
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            `idempotency_key_reused`: this Idempotency-Key was used for a
            different request. `request_in_progress`: a request with this key is
            still running; retry after Retry-After to get its answer.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is a recorded answer to an earlier request with
                the same Idempotency-Key, answered again without running the
                write.
              schema:
                enum:
                  - 'true'
                type: string
            Retry-After:
              description: 'With `request_in_progress`: seconds to wait before retrying.'
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: The body is over 8 MiB.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            Understood and declined: validation, a guard, a decided field, a
            deletion policy, a wall. `result` carries what the operation did
            before it stopped, when it did anything.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is a recorded answer to an earlier request with
                the same Idempotency-Key, answered again without running the
                write.
              schema:
                enum:
                  - 'true'
                type: string
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: Rate limited. Retry-After says when to try again.
          headers:
            Retry-After:
              description: Seconds to wait before trying again.
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            The request could not be recorded under its Idempotency-Key, so it
            was not run (code `idempotency_unavailable`). Retry it with the same
            key.
          headers:
            Retry-After:
              description: Seconds to wait before trying again.
              schema:
                type: integer
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Failure'
          description: >-
            No answer in time. A write may have landed: retry with the same
            Idempotency-Key.
          headers:
            X-Request-Id:
              description: >-
                The request's id: quote it when you contact support. Absent on a
                request refused before it ran, such as one with a bad key or a
                malformed body.
              schema:
                type: string
      security:
        - apiKey:
            - object_model:records:write
            - object_model:facts:write
components:
  schemas:
    object_model_ImportRequest:
      additionalProperties: false
      properties:
        candidate:
          description: >-
            A tracker import: a whole `import <import_id> for … { tracker { … }
            }` declaration to use in place of the declared one, such as a layout
            not saved yet. Checked against the live model and never stored.
          type: string
        choices:
          description: >-
            A tracker import's save: your answers to the flags its dry run
            raised on rows (`tracker.rows[].flags`). A flag you do not answer
            takes its `default_choice`.
          items:
            $ref: '#/components/schemas/object_model_TrackerChoice'
          type: array
        decide_existing:
          description: >-
            A tracker import: raise each value a matched record already holds
            that the file would change as an `existing` flag, and keep the
            record's value unless your answer in `choices` takes the file's.
          type: boolean
        dry_run:
          description: >-
            Check every row and write nothing. The answer counts the rows and
            lists each one's issues (`issue_rows`).
          type: boolean
        fallback_date_utc:
          description: >-
            A tracker import: the date (`YYYY-MM-DD`, UTC) a record it creates
            takes where the file gives none. Choose it once, and send the same
            date on the dry run, the save and any retry.
          type: string
        file:
          allOf:
            - $ref: '#/components/schemas/data_type_File'
          description: >-
            The file to import, sent in the body: `raw_bytes` (base64) and
            `metadata.name`. Send CSV, XLS or XLSX: an XLS or XLSX workbook is
            recognized by its content, and a name ending in `.csv` or any other
            content is read as CSV. OpenDocument (`.ods`) and binary Excel
            (`.xlsb`) workbooks are refused. The whole body is at most 8 MiB,
            base64 included, which leaves about 6 MiB for the file. A stored
            file's `id` is not read.
        idempotency_key:
          description: 'Taken from the `Idempotency-Key` header: leave it out.'
          type: string
        import_id:
          description: >-
            The import, as an `import` declaration in the model's text (`GET
            /model`) names it. Named by the path: leave it out, or send the same
            id.
          type: string
        inspect:
          description: >-
            A tracker import: describe what the file holds (`inspection`)
            instead of previewing it, to map its columns onto fields. Nothing is
            matched or written.
          type: boolean
        sheet:
          description: >-
            A tracker import: the worksheet to read, by name, instead of the one
            chosen for you.
          type: string
        subject_id:
          description: >-
            The record every row acts on, of the import's subject type. Leave it
            out for a tracker import.
          type: string
        template:
          description: >-
            Set by `GET /imports/{import_id}/template`: the blank template,
            answered as `report`. That file is kept for the VectorShift app to
            download, and this API gives no way to download it yet. Leave it out
            on a run.
          type: boolean
        tracker_overwrite:
          description: >-
            A tracker import whose layout fills only blank fields: write the
            file's values over what matched records hold.
          type: boolean
        world_id:
          description: >-
            The scenario the rows' facts land in. Leave it out to record them
            outside any scenario.
          type: string
      type: object
    object_model_ImportResult:
      additionalProperties: false
      properties:
        error:
          description: >-
            The file could not be read: the wrong format, a missing required
            heading, or too many rows.
          type: string
        inspection:
          allOf:
            - $ref: '#/components/schemas/object_model_TrackerInspection'
          description: 'With `inspect`: what the file holds, to map its columns.'
        invalidated_definitions:
          description: Figures whose values the import changes, by id.
          items:
            type: string
          type: array
        issue_rows:
          description: The first rows with issues, in file order.
          items:
            $ref: '#/components/schemas/object_model_ImportIssueRow'
          type: array
        report:
          allOf:
            - $ref: '#/components/schemas/data_type_File'
          description: >-
            The blank template (with `template`), or a copy of the file marking
            each row's issues, for the app to download. This API can't download
            it yet: read `issue_rows` instead.
        rows_with_issues:
          description: >-
            How many rows have an issue or did not save. `issue_rows` lists the
            first of them.
          type: integer
        saved:
          description: >-
            Rows written (or replayed on a retry). An import with columns saves
            nothing unless every row passes; a tracker import saves each row on
            its own.
          type: integer
        total_rows:
          description: Data rows read from the file.
          type: integer
        tracker:
          allOf:
            - $ref: '#/components/schemas/object_model_TrackerResult'
          description: >-
            A tracker import's answer, in place of the issue rows: each row's
            match and changes, and the flags to answer in `choices`.
      type: object
    Failure:
      properties:
        code:
          type: string
        details:
          additionalProperties:
            type: string
          type: object
        error:
          type: string
        path:
          type: string
        request_id:
          type: string
        result:
          description: >-
            The operation's own result, when a declined operation has one: what
            it did before it stopped. An action that stopped part way
            (`partial`) carries its `instance_id`, the records it created, its
            `fact_ids` and `field_outcomes` here — the steps that committed.
            Same shape as the route's 200 body.
          type: object
        status:
          const: failed
          type: string
      required:
        - status
        - code
        - error
      type: object
    object_model_TrackerChoice:
      additionalProperties: false
      properties:
        choice:
          description: >-
            Your answer: the `value` of one of the flag's `options`, or `""` to
            leave the value out.
          type: string
        field:
          description: The flag's field, as the dry run reported it.
          type: string
        kind:
          description: The flag's kind, as the dry run reported it.
          type: string
        row:
          description: >-
            The flagged row. `0` answers every flag of the same `kind`, `field`
            and `value`.
          type: integer
        value:
          description: The flag's value, as the dry run reported it.
          type: string
      type: object
    data_type_File:
      additionalProperties: false
      properties:
        id:
          description: 'A stored file''s id. An import does not read it: send `raw_bytes`.'
          type: string
        metadata:
          allOf:
            - $ref: '#/components/schemas/data_type_FileMetadata'
          description: >-
            The file's `name` and `mime_type`. An import reads the name: one
            ending in `.csv` is read as CSV.
        raw_bytes:
          contentEncoding: base64
          description: The file's bytes, base64-encoded.
          type: string
      type: object
    object_model_TrackerInspection:
      additionalProperties: false
      properties:
        fields:
          items:
            $ref: '#/components/schemas/object_model_TrackerFieldInfo'
          type: array
        sheets:
          items:
            $ref: '#/components/schemas/object_model_InspectedSheet'
          type: array
      type: object
    object_model_ImportIssueRow:
      additionalProperties: false
      properties:
        issues:
          description: What is wrong with it.
          items:
            $ref: '#/components/schemas/object_model_ImportIssue'
          type: array
        row:
          description: The worksheet row, counting from 1 as a spreadsheet does.
          type: integer
      type: object
    object_model_TrackerResult:
      additionalProperties: false
      properties:
        created:
          type: integer
        heading_row:
          type: integer
        missing_headings:
          items:
            type: string
          type: array
        overwrite_offered:
          type: boolean
        overwrote:
          type: boolean
        rows:
          items:
            $ref: '#/components/schemas/object_model_TrackerRow'
          type: array
        sheet:
          type: string
        sheets:
          items:
            $ref: '#/components/schemas/object_model_TrackerSheet'
          type: array
        unread_headings:
          items:
            type: string
          type: array
        updated:
          type: integer
      type: object
    data_type_FileMetadata:
      additionalProperties: false
      properties:
        content_hash:
          type: string
        created_timestamp:
          $ref: '#/components/schemas/google_protobuf_Timestamp'
        mime_type:
          type: string
        name:
          type: string
        path:
          type: string
        save_file_description:
          type: string
        save_file_send:
          type: boolean
        save_file_target_id:
          type: string
      type: object
    object_model_TrackerFieldInfo:
      additionalProperties: false
      properties:
        field:
          type: string
        kind:
          type: string
        label:
          type: string
        links_to:
          type: string
        on_create:
          type: boolean
        options:
          items:
            $ref: '#/components/schemas/object_model_TrackerOption'
          type: array
      type: object
    object_model_InspectedSheet:
      additionalProperties: false
      properties:
        columns:
          items:
            $ref: '#/components/schemas/object_model_InspectedColumn'
          type: array
        heading_row:
          type: integer
        name:
          type: string
        rows:
          type: integer
      type: object
    object_model_ImportIssue:
      additionalProperties: false
      properties:
        column:
          description: >-
            The column heading it is about. Empty for an issue with the whole
            row.
          type: string
        message:
          description: The issue, in words for a person.
          type: string
      type: object
    object_model_TrackerRow:
      additionalProperties: false
      properties:
        changes:
          items:
            $ref: '#/components/schemas/object_model_TrackerChange'
          type: array
        flags:
          items:
            $ref: '#/components/schemas/object_model_TrackerFlag'
          type: array
        key_label:
          type: string
        key_new:
          type: boolean
        message:
          type: string
        name:
          type: string
        notes:
          items:
            type: string
          type: array
        outcome:
          type: string
        record_id:
          type: string
        record_label:
          type: string
        row:
          type: integer
      type: object
    object_model_TrackerSheet:
      additionalProperties: false
      properties:
        heading_row:
          type: integer
        name:
          type: string
        readable:
          type: boolean
        rows:
          type: integer
      type: object
    google_protobuf_Timestamp:
      format: date-time
      type: string
    object_model_TrackerOption:
      additionalProperties: false
      properties:
        label:
          type: string
        value:
          type: string
      type: object
    object_model_InspectedColumn:
      additionalProperties: false
      properties:
        column:
          type: integer
        distinct:
          type: integer
        filled:
          type: integer
        heading:
          type: string
        values:
          items:
            $ref: '#/components/schemas/object_model_InspectedValue'
          type: array
      type: object
    object_model_TrackerChange:
      additionalProperties: false
      properties:
        after:
          type: string
        before:
          type: string
        field:
          type: string
        label:
          type: string
      type: object
    object_model_TrackerFlag:
      additionalProperties: false
      properties:
        chosen:
          type: string
        default_choice:
          type: string
        field:
          type: string
        kind:
          type: string
        label:
          type: string
        message:
          type: string
        options:
          items:
            $ref: '#/components/schemas/object_model_TrackerOption'
          type: array
        value:
          type: string
      type: object
    object_model_InspectedValue:
      additionalProperties: false
      properties:
        count:
          type: integer
        text:
          type: string
      type: object
  securitySchemes:
    apiKey:
      description: >-
        An API key issued with object_model scopes: Authorization: Bearer sk_….
        The scopes: object_model:records:read, object_model:records:write,
        object_model:facts:read, object_model:facts:write,
        object_model:model:read, object_model:model:configure,
        object_model:actions:run, object_model:changes:read. An operation's
        `security` lists the scopes it needs; several entries mean any one of
        them will do. A person field (`ref(user)`, `ref_list(user)`) holds a
        user id: look people up by email or id with `GET /v1/users`, outside
        this API, with a key that also has `users:read`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.