> ## 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.

# Create a contact

> Adds a contact to the workspace and records the given marketing consent. A contact that already has this email is updated in place and answered with 200, but a contact who unsubscribed is never re-subscribed through this endpoint. Tags in `tag_ids` are added to the contact, new or existing; no tag is removed.


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
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:
    post:
      tags:
        - Contact
      summary: Create a contact
      description: >-
        Adds a contact to the workspace and records the given marketing consent.
        A contact that already has this email is updated in place and answered
        with 200, but a contact who unsubscribed is never re-subscribed through
        this endpoint. Tags in `tag_ids` are added to the contact, new or
        existing; no tag is removed.



        Requires one of the following scopes: `lifecycle_contacts:create`,
        `lifecycle_contacts:all`, `all:create`, `all:all`
      operationId: createContact
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  maxLength: 254
                  description: Email address of the contact
                  example: subscriber@example.com
                first_name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: First name, up to 100 characters and 256 bytes (UTF-8)
                  example: Jane
                last_name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: Last name, up to 100 characters and 256 bytes (UTF-8)
                  example: Doe
                consent_status:
                  type: string
                  enum:
                    - subscribed
                    - unsubscribed
                  description: >-
                    Marketing consent to record. A contact who previously
                    unsubscribed stays unsubscribed even when `subscribed` is
                    sent.
                  example: subscribed
                tag_ids:
                  type: array
                  minItems: 1
                  maxItems: 10
                  uniqueItems: true
                  items:
                    type: string
                    minLength: 1
                    maxLength: 128
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  description: >-
                    IDs of tags to add, created with the contact tags endpoint.
                    Adds to the tags the contact already has and never removes
                    one. An unknown tag, or a tag an import or integration
                    manages, gives 400. A contact holds at most 500 tags.
                  example:
                    - 01234567-89ab-cdef-0123-456789abcdef
              required:
                - email
                - consent_status
              additionalProperties: false
        required: true
      responses:
        '200':
          description: The contact already existed and was updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: The ID of the contact
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  created:
                    type: boolean
                    examples:
                      - true
                    description: True when the contact did not exist before this request
                    example: true
                  consent_status:
                    type: string
                    enum:
                      - never_consented
                      - subscribed
                      - unsubscribed
                    examples:
                      - subscribed
                    description: Consent status stored after this request
                    example: subscribed
                required:
                  - id
                  - created
                  - consent_status
                additionalProperties: false
        '201':
          description: The created contact
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    examples:
                      - 01234567-89ab-cdef-0123-456789abcdef
                    description: The ID of the contact
                    example: 01234567-89ab-cdef-0123-456789abcdef
                  created:
                    type: boolean
                    examples:
                      - true
                    description: True when the contact did not exist before this request
                    example: true
                  consent_status:
                    type: string
                    enum:
                      - never_consented
                      - subscribed
                      - unsubscribed
                    examples:
                      - subscribed
                    description: Consent status stored after this request
                    example: subscribed
                required:
                  - id
                  - created
                  - consent_status
                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 contact with this email is being deleted, or another request
            changed it at the same time. An email deleted a moment ago can be
            added again once its erasure finishes. Retry later.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  The contact with this email is being deleted, or another
                  request changed it at the same time. An email deleted a moment
                  ago can be added again once its erasure finishes. Retry later.
                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.