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

# Create or get a customer

> Creates the customer, or returns the one you already sent, unchanged (`200`).
The same `externalId`, or the same `email`, is the same customer.

A request whose `externalId` and `email` belong to two different customers is refused (`409`).
A `device` sent with it is added; to change details use [Update a customer](/api-reference/customers/update-a-customer).

Required scope: `customers:write`.




## OpenAPI

````yaml /openapi.yaml post /customers
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:
    post:
      tags:
        - Customers
      summary: Create or get a customer
      description: >
        Creates the customer, or returns the one you already sent, unchanged
        (`200`).

        The same `externalId`, or the same `email`, is the same customer.


        A request whose `externalId` and `email` belong to two different
        customers is refused (`409`).

        A `device` sent with it is added; to change details use [Update a
        customer](/api-reference/customers/update-a-customer).


        Required scope: `customers:write`.
      operationId: createCustomer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomer'
            example:
              externalId: user_8271
              name: Ada Obi
              email: ada@example.com
              phone: '+2348012345678'
      responses:
        '200':
          description: You had already sent this customer. It is returned unchanged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '201':
          description: The customer was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
              example:
                message: Customer created successfully.
                status: success
                data:
                  id: prt_8271
                  externalId: user_8271
                  name: Ada Obi
                  email: ada@example.com
                  phone: '+2348012345678'
                  tags: []
                  attributes: {}
                  createdAt: '2026-11-20T09:14:03.000Z'
                  created: true
        '400':
          $ref: '#/components/responses/Invalid'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: The `externalId` and the `email` belong to different customers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: participant_conflict
                message: The externalId and the email belong to different customers.
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    CreateCustomer:
      type: object
      required:
        - name
        - email
      properties:
        externalId:
          type: string
          pattern: ^[A-Za-z0-9._:@+-]{1,128}$
          description: >
            Your own id for this customer. With the email, it decides whether
            this is a customer you already sent:

            the same `externalId`, or the same `email`, is the same customer.
          example: user_8271
        name:
          type: string
          maxLength: 255
          example: Ada Obi
        email:
          type: string
          format: email
          maxLength: 320
          example: ada@example.com
        phone:
          type: string
          pattern: ^\+[1-9]\d{6,14}$
          description: International format.
          example: '+2348012345678'
        device:
          type: object
          description: A push-notification device to add to the customer.
          required:
            - token
            - platform
          properties:
            token:
              type: string
              maxLength: 512
            platform:
              type: string
              enum:
                - ios
                - android
                - web
    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.
    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.

````