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

# Create contacts

> Creates new contacts and updates existing ones, in one request.



## OpenAPI

````yaml api-reference/create-contacts.json POST /v1/conversations
openapi: 3.1.0
info:
  title: WotNot API
  version: 1.0.0
  description: 'WotNot API: Create contacts.'
servers:
  - url: https://api.wotnot.io
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/conversations:
    post:
      summary: Create contacts
      description: Creates new contacts and updates existing ones, in one request.
      operationId: createContacts
      requestBody:
        required: true
        description: >-
          The contacts to create or update. Each contact needs an `email` or a
          `phone`. Put all custom contact variables in `custom_variables`.
        content:
          application/json:
            schema:
              type: object
              required:
                - contacts
              properties:
                contacts:
                  type: array
                  description: >-
                    The contacts to create or update. Each one needs at least an
                    `email` or a `phone`.
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: The contact's name.
                        example: Michael Anderson
                      email:
                        type: string
                        description: >-
                          The contact's email address. Required if you don't
                          send `phone`.
                        example: michael.anderson@example.com
                      phone:
                        type: string
                        description: >-
                          The contact's phone number, for example `+1212555`.
                          Required if you don't send `email`.
                        example: '+1212555'
                      custom_variables:
                        type: object
                        description: >-
                          Your custom contact variables, as name and value
                          pairs, for example `"company": "Example Company"`.
                        additionalProperties:
                          type: string
                          description: >-
                            The value of one custom contact variable. The key is
                            the variable's name.
            example:
              contacts:
                - name: Michael Anderson
                  email: michael.anderson@example.com
                  phone: '+1212555'
                  custom_variables:
                    company: Example Company
                - name: Jessica Martinez
                  email: jessica.martinez@example.com
                  phone: '+111221555'
                  custom_variables:
                    company: Example Company
      responses:
        '200':
          description: >-
            Returns the contacts that were `created` (new) and the ones that
            were `updated` (already existed).
          content:
            application/json:
              schema:
                type: object
                required:
                  - created
                  - updated
                properties:
                  created:
                    type: array
                    description: The new contacts that were created.
                    items:
                      $ref: '#/components/schemas/ContactResult'
                  updated:
                    type: array
                    description: The contacts that already existed and were updated.
                    items:
                      $ref: '#/components/schemas/ContactResult'
              example:
                created:
                  - id: 24135508
                    external_key: 111221555_13361
                    key: 6AFH8gyvwKCB073815082213IgPXtWMj
                    ok: true
                updated:
                  - id: 24135493
                    external_key: 1212555_13361
                    key: 7oFMaCsVoDD2073727174868hp2AavON
                    ok: true
        '400':
          description: >-
            Something in the body is invalid, for example a contact has neither
            `email` nor `phone`. Each item in `message` points to one problem.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              example:
                error: BAD_REQUEST
                ok: false
                status: 400
                message:
                  - message: '"contacts[0]" must contain at least one of [email, phone]'
                    path:
                      - contacts
                      - 0
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    ContactResult:
      type: object
      description: One contact that was saved.
      required:
        - id
        - external_key
        - key
        - ok
      properties:
        id:
          type: integer
          description: The contact's ID.
          example: 24135508
        external_key:
          type: string
          description: The contact's external key, for example `111221555_13361`.
          example: 111221555_13361
        key:
          type: string
          description: A unique key for the contact.
          example: 6AFH8gyvwKCB073815082213IgPXtWMj
        ok:
          type: boolean
          description: '`true` when this contact was saved.'
          example: true
    ValidationError:
      type: object
      description: Returned when one or more fields in the request body are invalid.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: '`BAD_REQUEST` for this kind of error.'
          example: BAD_REQUEST
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body.
          example: 400
        message:
          type: array
          description: A list of problems with the request, one item per problem.
          items:
            type: object
            required:
              - message
              - path
            properties:
              message:
                type: string
                description: >-
                  What is wrong with this field, for example `"url" must be a
                  valid uri`.
                example: '"url" must be a valid uri'
              path:
                type: array
                description: >-
                  Where the problem is in your request body. For example,
                  `["urls", 0]` means the first item in `urls`.
                items:
                  type:
                    - string
                    - integer
    Error:
      type: object
      description: Returned whenever a request fails.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: >-
            A short error code in capital letters, for example `UNAUTHORIZED`.
            Check this in your code to tell errors apart.
          example: UNAUTHORIZED
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body, for example `401`.
          example: 401
        message:
          type: string
          description: What went wrong and how to fix it, in plain words.
          example: Invalid token. Provide the valid account token.
  responses:
    Unauthorized:
      description: >-
        The token is missing or wrong. Check that the `Authorization` header is
        `Bearer` followed by your account token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            ok: false
            status: 401
            message: Invalid token. Provide the valid account token.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All of WotNot's APIs use Bearer token authentication. Send your account
        token as `Bearer <token>`. You can find it in Settings > Account
        Settings > Developer. Keep it on your server: anyone who has it can call
        the API as your account.

````

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