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

# Create or update a customer

> Matched by email, ignoring case: an unknown address creates the customer, and an existing one changes only `name` and `note`, because `email` and `external_id` are set only at creation (an `external_id` marks the customer verified).

Creating a customer with an `external_id` that already belongs to someone else returns 409 and writes nothing. An address that was merged into another customer updates and returns that customer. A blank `note` clears it.



## OpenAPI

````yaml /api-reference/openapi.json put /customers
openapi: 3.1.0
info:
  title: miniDesk API
  version: 1.0.0
  description: >-
    Create and work support tickets from your own systems. Every response
    carries an `X-Request-Id`; quote it when reporting a problem.
servers:
  - url: https://api.minidesk.ai/v1
security:
  - bearerAuth: []
paths:
  /customers:
    put:
      tags:
        - Customers
      summary: Create or update a customer
      description: >-
        Matched by email, ignoring case: an unknown address creates the
        customer, and an existing one changes only `name` and `note`, because
        `email` and `external_id` are set only at creation (an `external_id`
        marks the customer verified).


        Creating a customer with an `external_id` that already belongs to
        someone else returns 409 and writes nothing. An address that was merged
        into another customer updates and returns that customer. A blank `note`
        clears it.
      operationId: upsertCustomer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  maxLength: 254
                  format: email
                  pattern: >-
                    ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                name:
                  type: string
                  minLength: 1
                  maxLength: 120
                external_id:
                  type: string
                  minLength: 1
                  maxLength: 200
                note:
                  type: string
                  maxLength: 2000
              required:
                - email
      responses:
        '200':
          description: The customer already existed and was updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '201':
          description: The customer was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '400':
          description: The body failed validation. `field` names the offending property.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, malformed, or revoked credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflicts with existing data. `field` names the offending property.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Over the rate limit. See the `Retry-After` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Customer:
      type: object
      properties:
        id:
          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)$
        email:
          anyOf:
            - type: string
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        external_id:
          anyOf:
            - type: string
            - type: 'null'
        is_verified:
          type: boolean
        note:
          anyOf:
            - type: string
            - type: 'null'
        created_at:
          type: string
      required:
        - id
        - email
        - name
        - external_id
        - is_verified
        - note
        - created_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_failed
                - invalid_credential
                - identity_required
                - identity_invalid
                - forbidden
                - email_unconfirmed
                - seat_unavailable
                - not_found
                - conflict
                - quota_exceeded
                - invalid_transition
                - ai_disabled
                - rate_limited
                - internal_error
                - service_unavailable
            message:
              type: string
            field:
              type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API credential from **Settings → API**, sent as `Authorization:
        Bearer mdsk_api_...`. Issued per workspace and shown once.

````

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