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

# Import contacts from a CSV file

> Starts a CSV import into the workspace contacts in two steps: (1) call this endpoint to create the import and get `upload_url`, (2) PUT your file to `upload_url` within 5 minutes, with `content_type` as the Content-Type header. To get a fresh URL after it expires, call this endpoint again with the same `client_token`; without one, a new call creates a second import. Then follow the import with `GET /api/v2/lifecycle/contacts/imports/{id}`.

The file needs a header row with an email column named `email`, `email_address`, `emailaddress`, `e-mail` or `mail` (any capitalization); without one the import fails with `COLUMN_ERROR`. Optional name columns: `first_name`, `firstname`, `first name`, `given_name`, `fname` or `forename`, and `last_name`, `lastname`, `last name`, `surname`, `family_name`, `lname` or `familyname`. A status column named `is_subscribed`, `subscribed`, `subscription`, `accepts_marketing`, `accepts_email_marketing`, `accepts email marketing`, `email_marketing`, `marketing_consent`, `opt_in`, `optin` or `consent` is read for each row: `true`, `1`, `yes`, `y`, `subscribed`, `active`, `opt-in`, `optin` or `consent` subscribes the contact; `false`, `0`, `no`, `n`, `unsubscribed`, `inactive`, `opt-out`, `optout` or `opt_out` unsubscribes it, including an existing contact; any other value makes the row invalid. Every other column becomes a text custom attribute.

Every imported contact receives the import tag. Pass `segment` to also create a segment that selects it; a workspace holds at most 1000 segments, and past that the import is refused with 400.


Requires one of the following scopes: `lifecycle_contacts:create`, `lifecycle_contacts:all`, `all:create`, `all:all`



## OpenAPI

````yaml https://api.instantly.ai/openapi/api_v2_lifecycle.json post /api/v2/lifecycle/contacts/imports
openapi: 3.1.0
info:
  title: API Explorer
  description: >-
    The entire API V2 documentation is interactive and can be tested here. To
    the right side of every endpoint you will see a box with an example request.
    You can click on the "Try it" button to send a request to the server right
    from the docs. You will need to provide an API key by clicking the
    `ApiKeyAuth_token` blue text.
  version: 2.0.0
servers:
  - url: https://api.instantly.ai
    description: Instantly API Server
security:
  - ApiKeyAuth: []
tags:
  - name: Contact
    description: >-
      A contact in the workspace: one email address with its consent, tags and
      custom attributes. Segments, and the broadcasts and journeys that target
      them, read contacts. Optional fields with no value are left out of
      responses. The contact list, contact imports and tags page with `cursor`:
      pass the previous page's `next_cursor` until there is none. A contact's
      emails page with `starting_after` and `next_starting_after`.
    x-group: Contact
  - name: Segment
    description: >-
      A saved set of rules that selects contacts. Membership is worked out each
      time the segment is used. Optional fields with no value are left out of
      responses. Lists page with `cursor`: pass the previous page's
      `next_cursor` until there is none.
    x-group: Segment
  - name: Broadcast
    description: >-
      An email marketing broadcast campaign. Optional fields with no value are
      left out of responses. Lists page with `starting_after`: pass the previous
      page's `next_starting_after` until there is none.
    x-group: Broadcast
  - name: Domain
    description: >-
      An email sending domain. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: Domain
  - name: Journey
    description: >-
      A customer journey, triggered by an event or by membership of a segment.
      Optional fields with no value are left out of responses. Lists page with
      `starting_after`: pass the previous page's `next_starting_after` until
      there is none. Step contacts page with `cursor` and `next_cursor` instead.
    x-group: Journey
  - name: EventCatalogEntry
    description: >-
      An event type seen in this workspace, which journey triggers and
      conversions can use. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: Event Catalog Entry
  - name: Template
    description: >-
      An email marketing template. Optional fields with no value are left out of
      responses. Lists page with `starting_after`: pass the previous page's
      `next_starting_after` until there is none.
    x-group: Template
  - name: TemplateAsset
    description: >-
      An image or file uploaded for use in email templates. Optional fields with
      no value are left out of responses. Lists page with `starting_after`: pass
      the previous page's `next_starting_after` until there is none.
    x-group: Template Asset
  - name: EmailMetrics
    description: >-
      Aggregated email marketing metrics including totals, time-series data, and
      metadata.
    x-group: Email Metrics
  - name: Conversion
    description: >-
      A conversion event received for a person, credited to the emails they got
      before it.
    x-group: Conversion
paths:
  /api/v2/lifecycle/contacts/imports:
    post:
      tags:
        - Contact
      summary: Import contacts from a CSV file
      description: >-
        Starts a CSV import into the workspace contacts in two steps: (1) call
        this endpoint to create the import and get `upload_url`, (2) PUT your
        file to `upload_url` within 5 minutes, with `content_type` as the
        Content-Type header. To get a fresh URL after it expires, call this
        endpoint again with the same `client_token`; without one, a new call
        creates a second import. Then follow the import with `GET
        /api/v2/lifecycle/contacts/imports/{id}`.


        The file needs a header row with an email column named `email`,
        `email_address`, `emailaddress`, `e-mail` or `mail` (any
        capitalization); without one the import fails with `COLUMN_ERROR`.
        Optional name columns: `first_name`, `firstname`, `first name`,
        `given_name`, `fname` or `forename`, and `last_name`, `lastname`, `last
        name`, `surname`, `family_name`, `lname` or `familyname`. A status
        column named `is_subscribed`, `subscribed`, `subscription`,
        `accepts_marketing`, `accepts_email_marketing`, `accepts email
        marketing`, `email_marketing`, `marketing_consent`, `opt_in`, `optin` or
        `consent` is read for each row: `true`, `1`, `yes`, `y`, `subscribed`,
        `active`, `opt-in`, `optin` or `consent` subscribes the contact;
        `false`, `0`, `no`, `n`, `unsubscribed`, `inactive`, `opt-out`, `optout`
        or `opt_out` unsubscribes it, including an existing contact; any other
        value makes the row invalid. Every other column becomes a text custom
        attribute.


        Every imported contact receives the import tag. Pass `segment` to also
        create a segment that selects it; a workspace holds at most 1000
        segments, and past that the import is refused with 400.



        Requires one of the following scopes: `lifecycle_contacts:create`,
        `lifecycle_contacts:all`, `all:create`, `all:all`
      operationId: createContactImport
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file_name:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Name of the file being uploaded
                  example: contacts.csv
                require_first_name:
                  type: boolean
                  default: false
                  description: If true, skip rows that are missing a first name
                  example: false
                require_last_name:
                  type: boolean
                  default: false
                  description: If true, skip rows that are missing a last name
                  example: false
                consent_confirmed:
                  type: boolean
                  enum:
                    - true
                  description: >-
                    Must be true. Confirms that every contact in this file has
                    opted in to receive marketing emails from your organization.
                    Recorded on the import for compliance purposes.
                  example: true
                tag_name:
                  type: string
                  minLength: 1
                  maxLength: 150
                  description: >-
                    Tag applied to every imported contact. Defaults to the
                    segment name, else the file name and import time.
                  example: Webinar attendees 2026-09-14
                segment:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 150
                      description: Name of the segment to create
                      example: Webinar attendees
                  required:
                    - name
                  additionalProperties: false
                  description: >-
                    Creates a segment that selects the import tag, so the
                    imported contacts can be targeted right away
                client_token:
                  type: string
                  minLength: 1
                  maxLength: 128
                  pattern: ^[A-Za-z0-9._:-]+$
                  description: >-
                    Idempotency token, required when `segment` is provided.
                    Calling again with the same token returns the same import
                    with a fresh `upload_url` instead of creating a second
                    import or segment.
                  example: 01234567-89ab-cdef-0123-456789abcdef
              required:
                - file_name
                - consent_confirmed
              additionalProperties: false
        required: true
      responses:
        '200':
          description: >-
            The import and its upload URL. A repeated `client_token` returns the
            same import.
          content:
            application/json:
              schema:
                type: object
                properties:
                  import_id:
                    type: string
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: Unique import identifier
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  status:
                    type: string
                    examples:
                      - uploading
                    description: Current import status
                    example: uploading
                  upload_url:
                    type:
                      - 'null'
                      - string
                    examples:
                      - >-
                        https://uploads.example.com/contacts.csv?signature=abc123
                    description: >-
                      URL to PUT your CSV file to, with the `content_type`
                      header. Valid for `expires_in` seconds (5 minutes). Null
                      when the file for this `client_token` was already
                      uploaded.
                    example: https://uploads.example.com/contacts.csv?signature=abc123
                  expires_in:
                    type:
                      - 'null'
                      - integer
                    examples:
                      - 300
                    description: >-
                      Seconds until `upload_url` expires. Null when `upload_url`
                      is null.
                    example: 300
                  content_type:
                    type: string
                    examples:
                      - text/csv
                    description: >-
                      The Content-Type header value required for your PUT
                      request
                    example: text/csv
                  file_id:
                    type: string
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: Unique file identifier
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  tag_id:
                    type:
                      - 'null'
                      - string
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: Tag applied to the imported contacts
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  segment_id:
                    type:
                      - 'null'
                      - string
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: Segment created for this import, if requested
                    example: 01234567-89ab-cdef-0123-456789abcdef
                required:
                  - import_id
                  - status
                  - upload_url
                  - expires_in
                  - content_type
                  - file_id
                  - tag_id
                  - segment_id
                additionalProperties: false
        '400':
          description: >-
            The request is invalid. `message` names the field and the problem.
            `code` is `FST_ERR_VALIDATION` when the request does not match this
            schema and `VALIDATION_ERROR` when a value is refused after that. A
            request the resource's current state does not allow, such as pausing
            a broadcast that is not sending, has its own `code` named on that
            operation. `code` is absent on a few request-level checks.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The request is invalid. `message` names the field and the
                  problem. `code` is `FST_ERR_VALIDATION` when the request does
                  not match this schema and `VALIDATION_ERROR` when a value is
                  refused after that. A request the resource's current state
                  does not allow, such as pausing a broadcast that is not
                  sending, has its own `code` named on that operation. `code` is
                  absent on a few request-level checks.
                properties:
                  statusCode:
                    type: number
                    example: 400
                  error:
                    type: string
                    example: Bad Request
                  message:
                    type: string
                    example: 'limit: must be at most 50'
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: VALIDATION_ERROR
        '401':
          description: >-
            This request is unauthorized (either the Authorization header is
            missing or invalid, or the API key has been revoked)
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 401
                    examples:
                      - 401
                    example: 401
                  error:
                    type: string
                    enum:
                      - Unauthorized
                    examples:
                      - Unauthorized
                    example: Unauthorized
                  message:
                    type: string
                    examples:
                      - Missing Authorization header
                    example: Missing Authorization header
                required:
                  - statusCode
                  - error
                  - message
        '402':
          description: >-
            This request cannot be fulfilled because the workspace does not have
            an active paid plan
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 402
                    examples:
                      - 402
                    example: 402
                  error:
                    type: string
                    enum:
                      - Payment Required
                    examples:
                      - Payment Required
                    example: Payment Required
                  message:
                    type: string
                    examples:
                      - Workspace does not have an active paid plan
                    example: Workspace does not have an active paid plan
                required:
                  - statusCode
                  - error
                  - message
        '403':
          description: >-
            The workspace may not perform this action, for example while it is
            suspended. A key without the required scope gets a 401.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The workspace may not perform this action, for example while
                  it is suspended. A key without the required scope gets a 401.
                properties:
                  statusCode:
                    type: number
                    example: 403
                  error:
                    type: string
                    example: Forbidden
                  message:
                    type: string
                    example: >-
                      Workspace suspended due to a high bounce or spam complaint
                      rate. Please contact support.
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: WORKSPACE_SUSPENDED
        '404':
          description: The resource does not exist in this workspace.
          content:
            application/json:
              schema:
                type: object
                description: The resource does not exist in this workspace.
                properties:
                  statusCode:
                    type: number
                    example: 404
                  error:
                    type: string
                    example: Not Found
                  message:
                    type: string
                    example: Not found
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: NOT_FOUND
        '408':
          description: >-
            The request timed out. The outcome is unknown: a write may or may
            not have been applied. Read the resource back before retrying.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The request timed out. The outcome is unknown: a write may or
                  may not have been applied. Read the resource back before
                  retrying.
                properties:
                  statusCode:
                    type: number
                    example: 408
                  error:
                    type: string
                    example: Request Timeout
                  message:
                    type: string
                    example: An internal error occurred
        '409':
          description: The request conflicts with the current state of the resource.
          content:
            application/json:
              schema:
                type: object
                description: The request conflicts with the current state of the resource.
                properties:
                  statusCode:
                    type: number
                    example: 409
                  error:
                    type: string
                    example: Conflict
                  message:
                    type: string
                    example: The resource has changed. Reload it and try again.
                  code:
                    type: string
                    description: >-
                      Machine-readable error code. Branch on this, not on the
                      message.
                    example: CONFLICT
        '429':
          description: >-
            You have exceeded the rate limit. Please check the rate limit docs
            for more information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                    enum:
                      - 429
                    examples:
                      - 429
                    example: 429
                  error:
                    type: string
                    enum:
                      - Too Many Requests
                    examples:
                      - Too Many Requests
                    example: Too Many Requests
                  message:
                    type: string
                    examples:
                      - Rate limit exceeded
                    example: Rate limit exceeded
                required:
                  - statusCode
                  - error
                  - message
        '500':
          description: >-
            An internal error occurred. The outcome is unknown: a write may or
            may not have been applied. Read the resource back before retrying.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  An internal error occurred. The outcome is unknown: a write
                  may or may not have been applied. Read the resource back
                  before retrying.
                properties:
                  statusCode:
                    type: number
                    example: 500
                  error:
                    type: string
                    example: Internal Server Error
                  message:
                    type: string
                    example: An internal error occurred
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````

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