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

# Add Contact to Campaign

> Add a contact to a campaign as a campaign member. The contact is identified by `cnvContactId`, `userId`, or `email`.

> **Request access.** This endpoint is not enabled by default, contact the Conversion team to request access. Calls from accounts without it return `403 export_not_enabled`.



## OpenAPI

````yaml /openapi.json post /v2/campaigns/{campaignId}/contacts
openapi: 3.1.0
info:
  title: Conversion API
  version: 2.0.0
  description: >-
    The Conversion API lets you programmatically manage contacts, track custom
    events, and manage their associated data.
servers:
  - url: https://pub-api.conversion.ai/api
security:
  - apiKey: []
paths:
  /v2/campaigns/{campaignId}/contacts:
    post:
      summary: Add Contact to Campaign
      description: >-
        Add a contact to a campaign as a campaign member. The contact is
        identified by `cnvContactId`, `userId`, or `email`.


        > **Request access.** This endpoint is not enabled by default, contact
        the Conversion team to request access. Calls from accounts without it
        return `403 export_not_enabled`.
      operationId: addContactToCampaign
      parameters:
        - name: campaignId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The ID of the campaign to add the contact to.
          examples:
            example:
              value: b7c8d9e0-f1a2-3456-bcde-f01234567890
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: >-
                    The contact's email address. At least one of `cnvContactId`,
                    `userId`, or `email` is required.
                  examples:
                    - jane@example.com
                cnvContactId:
                  type: string
                  format: uuid
                  description: >-
                    The Conversion contact ID. At least one of `cnvContactId`,
                    `userId`, or `email` is required.
                  examples:
                    - a1b2c3d4-e5f6-7890-abcd-ef1234567890
                userId:
                  type: string
                  description: >-
                    An external user identifier for the contact. At least one of
                    `cnvContactId`, `userId`, or `email` is required.
                  examples:
                    - user_12345
            examples:
              add-by-email:
                summary: Add by email
                value:
                  email: jane@example.com
              add-by-contact-id:
                summary: Add by contact ID
                value:
                  cnvContactId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
              add-by-userId:
                summary: Add by userId
                value:
                  userId: user_12345
      responses:
        '200':
          description: Contact added to the campaign successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    required:
                      - added
                      - cnvContactId
                    properties:
                      added:
                        type: boolean
                        description: >-
                          `true` once the contact is a member of the campaign.
                          The operation is idempotent.
                      cnvContactId:
                        type: string
                        format: uuid
                        description: The resolved Conversion contact ID.
              examples:
                added:
                  summary: Contact added
                  value:
                    data:
                      added: true
                      cnvContactId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        '400':
          description: The request was malformed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing-identifier:
                  summary: Missing identifier
                  value:
                    error:
                      code: missing_identifier
                      message: >-
                        at least one of cnvContactId, userId, or email is
                        required
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unauthorized:
                  summary: Missing or invalid API key
                  value:
                    error:
                      code: unauthorized
                      message: API key is required
        '403':
          description: This endpoint is not enabled for this account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not-enabled:
                  summary: Endpoint not enabled
                  value:
                    error:
                      code: export_not_enabled
                      message: business is not authorized to use this endpoint
        '404':
          description: The campaign or contact was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                campaign-not-found:
                  summary: Campaign not found
                  value:
                    error:
                      code: campaign_not_found
                      message: campaign not found
                contact-not-found:
                  summary: Contact not found
                  value:
                    error:
                      code: contact_not_found
                      message: no contact found matching the provided identifier
        '409':
          description: The provided identifiers conflict with an existing contact.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                conflicting-identifier:
                  summary: Conflicting identifier
                  value:
                    error:
                      code: conflicting_identifier
                      message: contact found by email but has a different userId
        '500':
          description: An unexpected server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                internal:
                  summary: Internal error
                  value:
                    error:
                      code: internal_error
                      message: failed to add contact to campaign
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: A machine-readable error code.
              examples:
                - invalid_email
            message:
              type: string
              description: A human-readable error description.
              examples:
                - 'invalid email format: not-an-email'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your Conversion API key. Found in **Settings > Integrations** in the
        dashboard. Format: `sk_live_<key_id>_<secret>`.

````