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

# Update a customer

> Changes the customer's name, email or phone, their `tags` (the whole set) and their `attributes` (only the ones you send).
Send at least one of them. Everything is checked before anything is changed, so a request that fails changes nothing.

Required scope: `customers:write`.




## OpenAPI

````yaml /openapi.yaml patch /customers/{customerId}
openapi: 3.1.0
info:
  title: Cerium API
  version: 1.0.0
  description: |
    Send your customers and their conversations to Cerium from your own backend.
    Every request is authenticated with an API key.
servers:
  - url: https://api.usecerium.com/v1
    description: Production
security:
  - apiKey: []
tags:
  - name: Customers
  - name: Conversations
  - name: Messages
paths:
  /customers/{customerId}:
    parameters:
      - $ref: '#/components/parameters/CustomerId'
    patch:
      tags:
        - Customers
      summary: Update a customer
      description: >
        Changes the customer's name, email or phone, their `tags` (the whole
        set) and their `attributes` (only the ones you send).

        Send at least one of them. Everything is checked before anything is
        changed, so a request that fails changes nothing.


        Required scope: `customers:write`.
      operationId: updateCustomer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomer'
            example:
              tags:
                - vip
                - beta
              attributes:
                plan: Business
                country: null
      responses:
        '200':
          description: The updated customer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          $ref: '#/components/responses/Invalid'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The email is already used by another customer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: email_in_use
                message: Another customer already uses that email.
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    CustomerId:
      name: customerId
      in: path
      required: true
      description: The customer's Cerium id, as returned when you created them.
      schema:
        type: string
      example: prt_8271
  schemas:
    UpdateCustomer:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
        email:
          type: string
          format: email
          maxLength: 320
        phone:
          type: string
          pattern: ^\+[1-9]\d{6,14}$
        tags:
          type: array
          maxItems: 20
          items:
            type: string
            maxLength: 30
          description: >-
            The whole set. Tags you leave out are removed, so send `[]` to clear
            them.
        attributes:
          type: object
          description: >
            Values for your own attributes, by the name you gave them in the
            dashboard. Only the ones you send change;

            a blank value or `null` removes one. An attribute that does not
            exist is refused. A value is up to 120 characters.
          additionalProperties:
            type:
              - string
              - 'null'
    CustomerResponse:
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          example: success
        data:
          allOf:
            - $ref: '#/components/schemas/Customer'
            - type: object
              properties:
                created:
                  type: boolean
                  description: Only on create. `true` if this call created the customer.
    Error:
      type: object
      description: >
        `message` is always present. `code` is a stable identifier for specific
        errors you may want to handle in code.

        A validation error has a `message` that is a list of everything to fix.
      properties:
        code:
          type: string
          description: A stable identifier you can match on.
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        statusCode:
          type: integer
        error:
          type: string
      required:
        - message
    Customer:
      type: object
      properties:
        id:
          type: string
          example: prt_8271
          description: Cerium's id for the customer.
        externalId:
          type:
            - string
            - 'null'
          example: user_8271
          description: Your own id for the customer.
        name:
          type:
            - string
            - 'null'
          example: Ada Obi
        email:
          type:
            - string
            - 'null'
          format: email
          example: ada@example.com
        phone:
          type:
            - string
            - 'null'
          example: '+2348012345678'
        tags:
          type: array
          items:
            type: string
          example:
            - vip
        attributes:
          type: object
          description: Values for your own attributes, by name.
          additionalProperties:
            type: string
          example:
            plan: Business
        createdAt:
          type: string
          format: date-time
  responses:
    Invalid:
      description: The request is not valid. `message` says what to fix.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            error: Bad Request
            message:
              - email must be an email
    Unauthorized:
      description: The key is missing or not valid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Authentication token is missing.
    Forbidden:
      description: The key does not have the scope this call needs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 403
            message: This key cannot do that.
    NotFound:
      description: Nothing has that id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: thread_not_found
            message: No conversation has that id.
    RateLimited:
      description: Too many requests. Wait, then try again.
      headers:
        Retry-After:
          description: Seconds to wait before trying again.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >
        Your API key, sent as `Authorization: Bearer <key>`. Create keys in the
        Cerium dashboard.

        Keep them on your servers only.

````