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

# Create Contact Import

> Create a contact import and get its upload target. Post every `uploadFormFields` entry first, then the file as the last form field, at most 20 MB, before `expiresAt`. Send an `Idempotency-Key` header on every creation and on every retry after a 500.



## OpenAPI

````yaml /openapi.documented.yml post /contacts/imports
openapi: 3.1.0
info:
  title: Nuntly REST API
  version: 2.0.0
  description: Nuntly REST API definition
  termsOfService: https://nuntly.com/legal/terms-of-service
  contact:
    name: Nuntly Support
    url: https://nuntly.com/docs
    email: support@nuntly.com
servers:
  - description: Nuntly API endpoint
    url: https://api.nuntly.com
security:
  - bearerAuth: []
tags:
  - name: API Keys
    description: >-
      Create and revoke API keys used to authenticate requests to the Nuntly
      API.
  - name: Agents
    description: >-
      Read and write persistent state for an AI agent, optionally scoped to a
      specific inbox or thread.
  - name: Broadcasts
    description: >-
      Create a broadcast for a segment or a topic, schedule it, and send it to
      your contacts.
  - name: Contact Properties
    description: >-
      Define the custom properties a contact can carry, with their type and
      default value.
  - name: Contacts
    description: >-
      Manage the people you send broadcasts to, with their email address and
      custom properties.
  - name: Domains
    description: >-
      Add and verify sending and receiving domains. Manage DKIM records, SPF
      configuration, and enable inbound email routing.
  - name: Emails
    description: >-
      Send transactional emails, retrieve sending history, and track delivery
      status per message.
  - name: Inboxes
    description: >-
      Create email inboxes at a specific address on a verified receiving domain.
      Assign inboxes to namespaces or AI agents.
  - name: Messages
    description: >-
      Access received messages, download attachments, and send replies or
      forwards from an inbox.
  - name: Namespaces
    description: >-
      Isolate inboxes by tenant, client, or agent using namespaces. Use an
      external ID to map namespaces to your own data model.
  - name: Organizations
    description: >-
      Manage your organization profile, team members, and account-level
      settings.
  - name: Segment memberships
    description: Add contacts to a segment, list its members, and remove them.
  - name: Segments
    description: Group contacts into segments to choose who receives a broadcast.
  - name: Templates
    description: >-
      Write email templates, publish versions, and read the rendered content of
      a version.
  - name: Threads
    description: >-
      Browse email conversations grouped by subject. Mark threads as read or
      spam, and assign them to an agent.
  - name: Topic memberships
    description: Read and change the topics a contact is subscribed to.
  - name: Topics
    description: >-
      Define the topics contacts subscribe to, so a broadcast reaches only the
      contacts who opted in.
  - name: Webhooks
    description: >-
      Register HTTP endpoints to receive real-time delivery events such as
      bounces, opens, and clicks.
  - name: Webhooks Events
    description: >-
      Inspect webhook event history and replay failed deliveries for debugging
      or recovery.
  - name: Webhooks Hook
    description: >-
      Endpoint your server implements to receive webhook events. Not a Nuntly
      API endpoint - this documents the shape your handler must accept.
externalDocs:
  description: Nuntly API Documentation
  url: https://nuntly.com/docs
paths:
  /contacts/imports:
    post:
      tags:
        - Contacts
      summary: Create Contact Import
      description: >-
        Create a contact import and get its upload target. Post every
        `uploadFormFields` entry first, then the file as the last form field, at
        most 20 MB, before `expiresAt`. Send an `Idempotency-Key` header on
        every creation and on every retry after a 500.
      operationId: create-contact-import
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Unique key to ensure the request is processed at most once. UUIDv4
            recommended.
          schema:
            type: string
            minLength: 1
            maxLength: 255
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContactImportRequest'
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CreateContactImportResponse'
                required:
                  - data
                additionalProperties: false
        '500':
          description: An error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: cURL
          source: |-
            curl -X POST 'https://api.nuntly.com/contacts/imports' \
              -H 'Authorization: Bearer ntly_xxx' \
              -H 'Content-Type: application/json' \
              -d '{"columnMapping":{"E-mail":{"type":"email"},"Plan":{"type":"property","name":"plan"}}}'
        - lang: JavaScript
          source: |-
            import { Nuntly } from '@nuntly/sdk';

            const client = new Nuntly({
              apiKey: process.env['NUNTLY_API_KEY'],
            });

            const response = await client.contacts.imports.create({
              columnMapping: { 'E-mail': { type: 'email' }, Plan: { type: 'property', name: 'plan' } },
            });
        - lang: Java
          source: >-
            import com.nuntly.sdk.Nuntly;

            import com.nuntly.sdk.ClientOptions;

            import com.nuntly.sdk.models.*;


            var nuntly = Nuntly.create(ClientOptions.builder()
                .apiKey(System.getenv("NUNTLY_API_KEY"))
                .build());

            var response =
            nuntly.contacts().imports().create(CreateContactImportRequest.builder()
                .columnMapping(java.util.Map.of("E-mail", new ContactImportColumnTarget.Email(), "Plan", ContactImportColumnTarget.Property.builder().name("plan").build()))
                .build());
components:
  schemas:
    CreateContactImportRequest:
      type: object
      properties:
        onConflict:
          description: >-
            What to do with a row whose address matches an existing contact:
            update it (upsert) or leave it unchanged (skip). Defaults to upsert.
          type: string
          enum:
            - upsert
            - skip
        format:
          description: The file format. Defaults to csv.
          type: string
          enum:
            - csv
        declaredFileSize:
          description: >-
            The size of the file you will upload, in bytes, at most 20971520.
            The upload accepts no larger file.
          type: number
        columnMapping:
          description: >-
            Maps a header of the file to its target. Headers are compared after
            removing surrounding whitespace, letter case significant. Exactly
            one header maps to the email. Unmapped columns are ignored.
          type: object
          additionalProperties:
            anyOf:
              - type: object
                required:
                  - type
                properties:
                  type:
                    type: string
                    enum:
                      - email
              - type: object
                required:
                  - type
                properties:
                  type:
                    type: string
                    enum:
                      - unsubscribed
              - type: object
                required:
                  - type
                  - name
                properties:
                  type:
                    type: string
                    enum:
                      - property
                  name:
                    type: string
          examples:
            - E-mail:
                type: email
              Plan:
                type: property
                name: plan
        segments:
          description: >-
            Segments every imported contact is added to, at most 25. Duplicates
            are collapsed.
          type: array
          items:
            $ref: '#/components/schemas/ContactImportSegment'
        topics:
          description: >-
            Topic states applied to every imported contact, at most 25.
            Identical entries are collapsed; a topic listed with two states is
            refused.
          type: array
          items:
            $ref: '#/components/schemas/ContactImportTopic'
    CreateContactImportResponse:
      type: object
      required:
        - id
        - status
        - failureReason
        - onConflict
        - format
        - declaredFileSize
        - columnMapping
        - segments
        - topics
        - file
        - rows
        - unresolvedReferences
        - initiator
        - consentConfirmedAt
        - processingStartedAt
        - finishedAt
        - createdAt
        - updatedAt
        - uploadUrl
        - uploadFormFields
        - expiresAt
      properties:
        id:
          description: The id of the contact import.
          type: string
          examples:
            - ctimp_01kabn43yqyxn2bx4ve84mczd3
        status:
          $ref: '#/components/schemas/ContactImportStatus'
          description: The lifecycle state of the import.
        failureReason:
          description: Why the import failed.
          oneOf:
            - type: string
              enum:
                - invalid_format
                - file_too_large
                - processing_timeout
            - type: 'null'
        onConflict:
          description: >-
            What to do with a row whose address matches an existing contact:
            update it (upsert) or leave it unchanged (skip).
          type: string
          enum:
            - upsert
            - skip
        format:
          description: The file format.
          type: string
          enum:
            - csv
        declaredFileSize:
          description: >-
            The size of the file you will upload, in bytes, at most 20971520.
            The upload accepts no larger file.
          type:
            - number
            - 'null'
        columnMapping:
          description: >-
            Maps a header of the file to its target. Headers are compared after
            removing surrounding whitespace, letter case significant. Exactly
            one header maps to the email. Unmapped columns are ignored.
          oneOf:
            - type: object
              additionalProperties:
                anyOf:
                  - type: object
                    required:
                      - type
                    properties:
                      type:
                        type: string
                        enum:
                          - email
                  - type: object
                    required:
                      - type
                    properties:
                      type:
                        type: string
                        enum:
                          - unsubscribed
                  - type: object
                    required:
                      - type
                      - name
                    properties:
                      type:
                        type: string
                        enum:
                          - property
                      name:
                        type: string
            - type: 'null'
        segments:
          type: array
          items:
            $ref: '#/components/schemas/ContactImportSegment'
        topics:
          type: array
          items:
            $ref: '#/components/schemas/ContactImportTopic'
        file:
          description: The received file. Null until processing starts.
          oneOf:
            - $ref: '#/components/schemas/ContactImportFile'
            - type: 'null'
        rows:
          $ref: '#/components/schemas/ContactImportRows'
        unresolvedReferences:
          description: >-
            Requested segments, topics or properties that no longer existed
            while the import was processed. They were skipped.
          type: array
          items:
            anyOf:
              - type: object
                required:
                  - type
                  - id
                properties:
                  type:
                    type: string
                    enum:
                      - segment
                  id:
                    type: string
              - type: object
                required:
                  - type
                  - id
                properties:
                  type:
                    type: string
                    enum:
                      - topic
                  id:
                    type: string
              - type: object
                required:
                  - type
                  - name
                properties:
                  type:
                    type: string
                    enum:
                      - property
                  name:
                    description: The property name as requested.
                    type: string
        initiator:
          $ref: '#/components/schemas/ContactImportInitiator'
          description: Who created the import.
        consentConfirmedAt:
          description: When consent for the imported contacts was confirmed.
          type:
            - string
            - 'null'
          format: date-time
        processingStartedAt:
          description: When processing started.
          type:
            - string
            - 'null'
          format: date-time
        finishedAt:
          description: When the import reached its final state.
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          description: Date at which the object was created (ISO 8601 format)
          type: string
          format: date-time
          examples:
            - '2026-03-29T12:00:00.000Z'
        updatedAt:
          description: Date at which the object was updated (ISO 8601 format)
          type: string
          format: date-time
        uploadUrl:
          description: Where to post the file, as a multipart form.
          type: string
        uploadFormFields:
          description: >-
            Form fields to post before the file, unchanged. The file must be the
            last field.
          type: object
          additionalProperties:
            type: string
        expiresAt:
          description: After this time the upload is refused.
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
          description: >-
            This object provide you additional information about errors
            encountered while performing the operation
    ContactImportSegment:
      type: object
      required:
        - id
      properties:
        id:
          description: The id of a segment.
          type: string
          examples:
            - seg_01kabn43yqyxn2bx4ve84mczd3
    ContactImportTopic:
      type: object
      required:
        - id
        - state
      properties:
        id:
          description: The id of a topic.
          type: string
          examples:
            - tpc_01kabn43yqyxn2bx4ve84mczd3
        state:
          description: The subscribe/unsubscribe state.
          type: string
          enum:
            - subscribed
            - unsubscribed
    ContactImportStatus:
      type: string
      enum:
        - awaiting_upload
        - processing
        - completed
        - failed
        - expired
        - canceled
    ContactImportFile:
      type: object
      required:
        - receivedAt
        - size
        - sha256
      properties:
        receivedAt:
          description: When the file was received.
          type: string
          format: date-time
        size:
          description: The size of the received file, in bytes.
          type: number
        sha256:
          description: >-
            The SHA-256 of the file, in lowercase hexadecimal. Null until the
            whole file is read.
          type:
            - string
            - 'null'
    ContactImportRows:
      type: object
      required:
        - total
        - created
        - updated
        - skipped
        - failed
      properties:
        total:
          description: The number of data rows. Null until the file structure is checked.
          type:
            - number
            - 'null'
        created:
          description: Rows that created a contact.
          type: number
        updated:
          description: Rows that updated an existing contact.
          type: number
        skipped:
          description: >-
            Rows left unchanged because the contact exists and onConflict is
            skip.
          type: number
        failed:
          description: Rows that wrote nothing.
          type: number
    ContactImportInitiator:
      type: object
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - api_key
            - user
        id:
          description: The id of the API key or user. Kept after it is deleted.
          type: string
    Error:
      type: object
      required:
        - status
        - code
        - title
      properties:
        status:
          description: >-
            The HTTP status code generated by the origin server for this
            occurrence of the error.
          type: number
        code:
          description: An API specific code representing the type of error.
          type: string
        title:
          description: A short, human-readable summary of the error type.
          type: string
        details:
          description: >-
            A (best effort) human readable explanation specific to this
            occurrence of the error.
          type: object
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key (format ntly_...)
      description: >-
        Use an API key from https://nuntly.com/api-keys. Required on every
        endpoint.

````

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