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

# Start an import from JSON rows

> Starts an import from rows sent in the request body instead of a file: the rows are written as a CSV and the import then behaves exactly like a file upload. While the structure has an unfinished import (UPLOADING, UPLOADED, MAPPING or MAPPED) or a migration still being prepared, the request is refused and nothing changes, unless cancelIncomplete=true: then they are cancelled first. The request is always rejected during a bulk change, a RUNNING import or an importing migration; cancelIncomplete does not change that. Poll the status until it is UPLOADED, then submit the column mapping. Limits: 200 columns, 6500 rows, 1000 characters per cell, 1048576 bytes of body.



## OpenAPI

````yaml /openapi.json post /api/contact/import
openapi: 3.0.0
info:
  description: >-
    Public REST API for Benchmark Email.


    Authenticate every request by including your API key in the `X-API-Key`
    header.

    Each key is issued with one or more scopes that control which endpoints it
    may call.


    Rate limits: 60 requests per minute per account.

    Monthly quota: determined by your subscription plan.


    Contact text field values are HTML-entity encoded. When a contact is
    created, updated or imported, Benchmark stores its text field values
    HTML-entity escaped: `&` `<` `>` `"` `'` `/` `\` and the backtick become
    `&amp;` `&lt;` `&gt;` `&quot;` `&#x27;` `&#x2F;` `&#x5C;` and `&#96;`.
    Responses return that stored form (for example `Maple &amp; Co` for `Maple &
    Co`), so decode values before displaying them. Send plain, unescaped text in
    requests and search filters: Benchmark escapes it before storing or matching
    it. Create and update also remove anything that looks like an HTML tag,
    including the text after a bare `<`.
  title: Benchmark Email API
  version: 1.0.0
servers:
  - description: >-
      Your account's API base URL. Copy the full URL shown on Settings > API
      Keys in your Benchmark Email account and paste it here.
    url: '{apiBaseUrl}'
    variables:
      apiBaseUrl:
        default: ''
        description: >-
          Your account's API base URL. Copy it from Settings > API Keys in your
          Benchmark Email account.
security:
  - apiKeyAuth: []
tags:
  - description: Account related endpoints
    name: account
  - description: File upload (Unlayer custom storage) endpoints
    name: file-upload
  - description: Contact related endpoints
    name: contact
  - description: Contact structure related endpoints
    name: contact-structure
  - description: List related endpoints
    name: lists
  - description: Contact import related endpoints
    name: contact-import
  - description: Email domain related endpoints
    name: email-domain
  - description: Email campaign related endpoints
    name: email-campaign
  - description: Email template related endpoints
    name: email-template
  - description: Report related endpoints
    name: reports
paths:
  /api/contact/import:
    post:
      tags:
        - contact-import
      summary: Start an import from JSON rows
      description: >-
        Starts an import from rows sent in the request body instead of a file:
        the rows are written as a CSV and the import then behaves exactly like a
        file upload. While the structure has an unfinished import (UPLOADING,
        UPLOADED, MAPPING or MAPPED) or a migration still being prepared, the
        request is refused and nothing changes, unless cancelIncomplete=true:
        then they are cancelled first. The request is always rejected during a
        bulk change, a RUNNING import or an importing migration;
        cancelIncomplete does not change that. Poll the status until it is
        UPLOADED, then submit the column mapping. Limits: 200 columns, 6500
        rows, 1000 characters per cell, 1048576 bytes of body.
      operationId: post_api_contact_import
      parameters:
        - description: The contact structure the contacts belong to
          in: query
          name: contactStructureId
          required: true
          schema:
            format: mongo-id
            type: string
        - description: >-
            Set to true to cancel the structure's unfinished imports (UPLOADING,
            UPLOADED, MAPPING or MAPPED) and a migration still being prepared,
            then continue. Left out or false, the request is refused with
            ImportInProgressError while any of them exists and nothing is
            cancelled. A RUNNING import is never cancelled, with or without
            this.
          in: query
          name: cancelIncomplete
          required: false
          schema:
            default: false
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              properties:
                headers:
                  description: >-
                    Column names, in order and distinct, not blank, and not
                    __proto__, constructor or prototype; the first row of the
                    file the import is built from
                  example:
                    - Email
                    - First Name
                    - Last Name
                  items:
                    maxLength: 100
                    minLength: 1
                    pattern: \S
                    type: string
                  maxItems: 200
                  minItems: 1
                  type: array
                  uniqueItems: true
                rows:
                  description: >-
                    One array of cell values per contact, each with exactly as
                    many cells as there are headers
                  example:
                    - - a@example.com
                      - Ana
                      - Acme
                    - - b@example.com
                      - Ben
                      - ''
                  items:
                    items:
                      description: >-
                        Plain, unescaped text; Benchmark stores it HTML-entity
                        escaped.
                      maxLength: 1000
                      type: string
                    maxItems: 200
                    type: array
                  maxItems: 6500
                  minItems: 1
                  type: array
              required:
                - headers
                - rows
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  _id:
                    description: Id of the import
                    type: string
                  fileName:
                    description: Original name of the uploaded file
                    type: string
                  firstTenRecords:
                    description: >-
                      The first ten data rows, each as an array of cell values
                      in column order
                    items:
                      items:
                        type: string
                      type: array
                    type: array
                  headers:
                    description: Column headers of the uploaded file, in file order
                    items:
                      type: string
                    type: array
                  status:
                    description: >-
                      Current status. An import moves through UPLOADING (file
                      being parsed), UPLOADED (ready for a mapping), MAPPING
                      (mapping being applied), MAPPED (ready to start), RUNNING,
                      then SUCCEEDED or FAILED. ABORTED is set by an explicit
                      abort or when a new import for the same contact structure
                      is started with cancelIncomplete=true.
                    enum:
                      - UPLOADING
                      - UPLOADED
                      - MAPPING
                      - MAPPED
                      - RUNNING
                      - SUCCEEDED
                      - FAILED
                      - ABORTED
                    type: string
                  totalRecords:
                    description: Number of data rows in the uploaded file
                    type: number
                type: object
          description: Import created; the rows are being parsed
        '400':
          description: >-
            Body over the size cap (MaxSizeFieldError), rows or headers outside
            the limits, a row whose cell count differs from the headers, missing
            or invalid contactStructureId, a bulk change, import or migration is
            running for the structure, or ImportInProgressError when the
            structure has an import that is UPLOADING, UPLOADED, MAPPING or
            MAPPED (the message names its id and status), or a migration still
            being prepared, and cancelIncomplete was not true
        '401':
          description: Unauthorized
        '403':
          description: API key missing the required scope
        '404':
          description: Contact structure not found on this account
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      description: API key authentication
      in: header
      name: X-API-Key
      type: apiKey

````

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