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

# Create a bulk import job (starts in `staging`)



## OpenAPI

````yaml https://api.develop.fourdos.dev/openapi/partner.json post /v1/imports
openapi: 3.1.0
info:
  title: 4D OS Partner API
  version: 0.1.0
  description: >-
    REST API for 4D OS partners. Authenticate with your organization API key:
    `Authorization: Bearer <key>`.


    Requests and responses are JSON with `snake_case` field names. Errors share
    one envelope: `{ "error": { "code", "status", "message", "details"? } }`.


    Mutating endpoints that declare it accept an `Idempotency-Key` header so
    retries are safe.


    Bulk-migrating members? See the [Migrating to 4D
    guide](https://docs.fourdos.dev/walkthroughs/migrate-existing-members) for
    the canonical import schema, a worked example, and the `/v1/imports`
    sequence.
servers: []
security:
  - partnerApiKey: []
tags:
  - name: Users
    description: Create, read, and manage users and their org membership
  - name: Imports
    description: Bulk member import jobs (staging → validate → commit)
  - name: Engagement
    description: Browser event tracking (publishable keys) and tracking-key management
paths:
  /v1/imports:
    post:
      tags:
        - Imports
      summary: Create a bulk import job (starts in `staging`)
      operationId: createImportJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateImportJobBody'
      responses:
        '201':
          description: Import job created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportJobResponse'
        '404':
          description: Caller may not manage imports for this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The organization already has an active import job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateImportJobBody:
      type: object
      properties:
        mapping:
          type: object
          properties:
            columns:
              minItems: 1
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      sourceColumn:
                        type: string
                        minLength: 1
                      target:
                        type: string
                        const: core_field
                      fieldKey:
                        type: string
                        enum:
                          - email
                          - external_id
                          - first_name
                          - last_name
                          - display_name
                          - locale
                          - country
                          - dob
                    required:
                      - sourceColumn
                      - target
                      - fieldKey
                  - type: object
                    properties:
                      sourceColumn:
                        type: string
                        minLength: 1
                      target:
                        type: string
                        const: attribute
                      attributeKey:
                        type: string
                        minLength: 1
                    required:
                      - sourceColumn
                      - target
                      - attributeKey
                  - type: object
                    properties:
                      sourceColumn:
                        type: string
                        minLength: 1
                      target:
                        type: string
                        const: labels
                    required:
                      - sourceColumn
                      - target
                  - type: object
                    properties:
                      sourceColumn:
                        type: string
                        minLength: 1
                      target:
                        type: string
                        const: ignored
                    required:
                      - sourceColumn
                      - target
          required:
            - columns
        file_name:
          type: string
          minLength: 1
        declared_total:
          type: integer
          minimum: 0
          maximum: 9007199254740991
      required:
        - declared_total
    ImportJobResponse:
      type: object
      properties:
        id:
          type: string
        organization_id:
          type: string
        created_by_id:
          anyOf:
            - type: string
            - type: 'null'
        source:
          type: string
          enum:
            - console
            - api
        state:
          type: string
          enum:
            - staging
            - validating
            - validated
            - committing
            - completed
            - failed
        mapping: {}
        file_name:
          anyOf:
            - type: string
            - type: 'null'
        declared_total:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        staged_rows:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        processed_rows:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        valid_rows:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        invalid_rows:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        created_count:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        attached_count:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        failed_count:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        expires_at:
          type: string
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - organization_id
        - created_by_id
        - source
        - state
        - mapping
        - file_name
        - declared_total
        - staged_rows
        - processed_rows
        - valid_rows
        - invalid_rows
        - created_count
        - attached_count
        - failed_count
        - expires_at
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            status:
              type: integer
            message:
              type: string
            details:
              type: object
              additionalProperties: true
          required:
            - code
            - status
            - message
      required:
        - error
  securitySchemes:
    partnerApiKey:
      type: http
      scheme: bearer
      description: >-
        Organization API key (`org_…`), sent as `Authorization: Bearer <key>`.
        Keys are scoped to one organization; every request operates within that
        tenant.

````