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

# Create or update a contact

> Only the fields you send change. Set an attribute to `null` to remove it. A phone number links the contact to their WhatsApp chats, even ones that start later.



## OpenAPI

````yaml /openapi.yaml put /contacts/{userId}
openapi: 3.1.0
info:
  title: Frictionless Context API
  version: '1.0'
  description: >-
    Send who your customers are and what just happened to them, so agents see it
    beside the chat.
servers:
  - url: https://api.usefrictionless.com/api/v1
security:
  - apiKey: []
tags:
  - name: Contacts
  - name: Events
paths:
  /contacts/{userId}:
    parameters:
      - $ref: '#/components/parameters/userId'
    put:
      tags:
        - Contacts
      summary: Create or update a contact
      description: >-
        Only the fields you send change. Set an attribute to `null` to remove
        it. A phone number links the contact to their WhatsApp chats, even ones
        that start later.
      operationId: upsertContact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: Ada Obi
                email:
                  type: string
                  format: email
                  example: ada@example.com
                phone:
                  type: string
                  description: 7 to 15 digits with the country code.
                  example: '+2348012345678'
                attributes:
                  type: object
                  description: >-
                    Up to 50 per request and 100 in total. Values are text up to
                    500 characters, numbers or true/false. `null` removes one.
                  additionalProperties:
                    type:
                      - string
                      - number
                      - boolean
                      - 'null'
                  example:
                    plan: Business
                    kycVerified: true
                    walletBalance: 45000
      responses:
        '200':
          description: The contact, and how many chats it's linked to.
          content:
            application/json:
              schema:
                type: object
                properties:
                  contact:
                    $ref: '#/components/schemas/Contact'
                  linkedChats:
                    type: integer
                    example: 1
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PlanRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    userId:
      name: userId
      in: path
      required: true
      description: 'Your own ID for this user. 1 to 128 letters, numbers or `_ . : @ + -`.'
      schema:
        type: string
        example: user_42
  schemas:
    Contact:
      type: object
      properties:
        userId:
          type: string
          example: user_42
        name:
          type:
            - string
            - 'null'
          example: Ada Obi
        email:
          type:
            - string
            - 'null'
          example: ada@example.com
        phone:
          type:
            - string
            - 'null'
          example: '+2348012345678'
        attributes:
          type: object
          additionalProperties: true
        createdAt:
          type: string
          format: date-time
          example: '2026-10-15T09:30:00Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-10-15T09:30:00Z'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
              description: Says what to fix.
  responses:
    BadRequest:
      description: >-
        `invalid_request` or `invalid_user_id`: something is missing or the
        wrong shape.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: '`missing_key` or `invalid_key`: no API key, or one that was rotated.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PlanRequired:
      description: '`plan_required`: the Context API is on the Pro plan and above.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: '`rate_limited`: over 300 requests a minute. Wait and retry.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Your API key (`fk_live_…`) from Settings → Developers.

````

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