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

# Update Contact

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



## OpenAPI

````yaml PATCH /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:
    patch:
      description: >-
        Custom fields must be created in the Alpharun dashboard before you can
        set them on the contact.
      requestBody:
        required: true
        description: >-
          The `id` field identifies the contact to update and can be one of: the
          contact's UUID, `alt:ext_id:<ext_id>`, `alt:email:<email>`, or
          `alt:phone_number:<phone_number>`. 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/ContactUpdateByIdentifierPayload'
      responses:
        '200':
          description: Contact updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
        '400':
          description: >-
            Bad request (missing `id`, malformed phone number, or invalid
            payload)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ContactUpdateByIdentifierPayload:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: >-
            Identifier of the contact to update. Can be the contact's UUID,
            `alt:ext_id:<ext_id>`, `alt:email:<email>`, or
            `alt:phone_number:<phone_number>`.
        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: object
          properties:
            set:
              type: array
              description: List of the custom field to set on the contact
              items:
                type: object
                properties:
                  key:
                    type: string
                    description: Machine-readable key of the custom field
                  value:
                    type: string
                    description: Value of the custom field
            remove:
              type: array
              description: List of the custom field keys to remove from the contact
              items:
                type: string
                description: Machine-readable key 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

````