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

# Create Contact

> Custom fields must be created in the Alpharun dashboard before you can add them to the contact.



## OpenAPI

````yaml POST /contacts
openapi: 3.0.1
info:
  title: Alpharun API
  description: Alpharun REST API reference
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.alpharun.com/api/v1
security:
  - bearerAuth: []
paths:
  /contacts:
    post:
      description: >-
        Custom fields must be created in the Alpharun dashboard before you can
        add them to the contact.
      requestBody:
        required: true
        description: >-
          At least one of email, phone number and ext id must be not null on the
          contact. Contacts are unique per email, phone number, or ext_id. **No
          two contacts can have the same email, phone number, or ext_id**.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactCreationPayload'
      responses:
        '200':
          description: Contact created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ContactCreationPayload:
      type: object
      anyOf:
        - required:
            - email
          properties:
            email:
              type: string
              format: email
              description: Email address of the contact
            phone_number:
              oneOf:
                - type: string
                - type: number
              description: Phone number of the contact
            ext_id:
              type: string
              description: Ext id of the contact
            first_name:
              type: string
              description: First name of the contact
            last_name:
              type: string
              description: Last name of the contact
            custom_fields:
              type: array
              description: Custom fields to populate on the contact
              items:
                type: object
                required:
                  - key
                  - value
                properties:
                  key:
                    type: string
                    description: Machine-readable key of the custom field
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                    nullable: true
                    description: Value of the custom field
        - required:
            - phone_number
          properties:
            email:
              type: string
              format: email
              description: Email address of the contact
            phone_number:
              oneOf:
                - type: string
                - type: number
              description: Phone number of the contact
            ext_id:
              type: string
              description: Ext id of the contact
            first_name:
              type: string
              description: First name of the contact
            last_name:
              type: string
              description: Last name of the contact
            custom_fields:
              type: array
              description: Custom fields to populate on the contact
              items:
                type: object
                required:
                  - key
                  - value
                properties:
                  key:
                    type: string
                    description: Machine-readable key of the custom field
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                    nullable: true
                    description: Value of the custom field
        - required:
            - ext_id
          properties:
            email:
              type: string
              format: email
              description: Email address of the contact
            phone_number:
              oneOf:
                - type: string
                - type: number
              description: Phone number of the contact
            ext_id:
              type: string
              description: Ext id of the contact
            first_name:
              type: string
              description: First name of the contact
            last_name:
              type: string
              description: Last name of the contact
            custom_fields:
              type: array
              description: Custom fields to populate on the contact
              items:
                type: object
                required:
                  - key
                  - value
                properties:
                  key:
                    type: string
                    description: Machine-readable key of the custom field
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                    nullable: true
                    description: Value of the custom field
    ContactResponse:
      type: object
      properties:
        id:
          type: string
          description: ID of the contact
        email:
          type: string
          format: email
          description: Email address of the contact
        phone_number:
          type: string
          description: Phone number of the contact
        ext_id:
          type: string
          description: Ext id of the contact
        first_name:
          type: string
          description: First name of the contact
        last_name:
          type: string
          description: Last name of the contact
        custom_fields:
          type: array
          description: Custom fields of the contact
          items:
            type: object
            properties:
              key:
                type: string
                description: Machine-readable key of the custom field
              value:
                oneOf:
                  - type: string
                  - type: number
                  - type: boolean
                description: Value of the custom field
              type:
                type: string
                description: Type of the custom field
              display_name:
                type: string
                description: Display name of the custom field
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````