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

# Update a contact by ID

> Updates the given fields of a contact. Omitted fields are left untouched; sending `null` clears the field.

Tags are linked by `id` or `name` and must already exist in the workspace — unknown tags are ignored. Use `PATCH /contacts/{contactId}/tags` to create tags on demand.



## OpenAPI

````yaml PATCH /contacts/{contactId}
openapi: 3.1.0
info:
  title: Cogfy Messenger Public API
  version: 1.0.0
  description: API for interacting with the Cogfy Messenger platform
servers:
  - url: https://messenger-public-api.cogfy.com
    description: Production server
  - url: http://localhost:3100
    description: Local server
security:
  - ApiKeyAuth: []
paths:
  /contacts/{contactId}:
    patch:
      tags:
        - Contacts
      summary: Update a contact
      description: >-
        Updates the given fields of a contact. Omitted fields are left
        untouched; sending `null` clears the field.


        Tags are linked by `id` or `name` and must already exist in the
        workspace — unknown tags are ignored. Use `PATCH
        /contacts/{contactId}/tags` to create tags on demand.
      parameters:
        - in: path
          name: contactId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  anyOf:
                    - type: string
                    - type: 'null'
                lastName:
                  anyOf:
                    - type: string
                    - type: 'null'
                email:
                  anyOf:
                    - type: string
                    - type: 'null'
                phone:
                  anyOf:
                    - type: string
                    - type: 'null'
                occupation:
                  anyOf:
                    - type: string
                    - type: 'null'
                gender:
                  anyOf:
                    - type: string
                    - type: 'null'
                birthdate:
                  anyOf:
                    - type: string
                    - type: 'null'
                age:
                  anyOf:
                    - type: number
                    - type: 'null'
                notes:
                  anyOf:
                    - type: string
                    - type: 'null'
                tags:
                  description: Only tags that already exist in the workspace are linked
                  type: object
                  properties:
                    add:
                      description: Tags to link to the contact, keeping the current ones
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            description: Id of an existing tag
                            type: string
                          name:
                            description: Name of an existing tag
                            type: string
                    remove:
                      description: Tags to unlink from the contact
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            description: Id of an existing tag
                            type: string
                          name:
                            description: Name of an existing tag
                            type: string
                    set:
                      description: >-
                        Replaces all tags of the contact. When provided, `add`
                        and `remove` are ignored
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            description: Id of an existing tag
                            type: string
                          name:
                            description: Name of an existing tag
                            type: string
                customProperties:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                  description: >-
                    Values for the custom contact properties of the workspace,
                    keyed by property name
            examples:
              fields:
                summary: Update contact fields
                value:
                  firstName: John
                  occupation: Engineering Manager
              tags:
                summary: Add and remove tags
                value:
                  tags:
                    add:
                      - name: customers
                    remove:
                      - name: leads
      responses:
        '204':
          description: Contact updated successfully
        '400':
          description: Bad request, invalid input data
        '401':
          description: Unauthorized
        '404':
          description: Contact not found
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key

````