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

# Create a client

> Create a contact in your account.

At least one of `phone_number` or `email` is required. A contact that
already exists with the same phone number is rejected with
`DUPLICATE_CLIENT`. Tags are created on the fly when they do not exist yet.



## OpenAPI

````yaml POST /api/v2/public/clients
openapi: 3.1.0
info:
  title: Dialtu Public API
  version: '2.0'
  description: >-
    Programmatic access to your Dialtu account: schedule AI voice calls, create
    contacts, push leads into Salesflow pipelines, book calendar appointments
    and read WhatsApp conversation history.


    Every request is authenticated with an API key created in the dashboard
    under **Settings → API Keys**, sent as `Authorization: Bearer pk_...`.
servers:
  - url: https://api.dialtu.com
    description: Production
  - url: https://api.stg.dialtu.com
    description: Staging
security:
  - ApiKeyBearer: []
tags:
  - name: Calls
    description: Schedule outbound AI voice calls.
  - name: Clients
    description: Create contacts in your account.
  - name: Salesflow
    description: Push leads into a pipeline through an API input node.
  - name: Salesflow pipelines
    description: Read a pipeline's stages and add, move or remove clients.
  - name: Calendar
    description: Check bookable capacity, book appointments and manage waiting lists.
  - name: WhatsApp
    description: Read-only conversation history and transcripts.
paths:
  /api/v2/public/clients:
    post:
      tags:
        - Clients
      summary: Create a client
      description: >-
        Create a contact in your account.


        At least one of `phone_number` or `email` is required. A contact that

        already exists with the same phone number is rejected with

        `DUPLICATE_CLIENT`. Tags are created on the fly when they do not exist
        yet.
      operationId: createClient
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicCreateClientSchema'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicClientResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicClientErrorResponse'
        '401':
          description: Missing, malformed or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailErrorResponse'
              examples:
                missing_header:
                  summary: No Authorization header
                  value:
                    detail: Unauthorized
                invalid_key:
                  summary: Unknown or revoked key
                  value:
                    detail: Invalid or expired API key. Please check your credentials.
        '422':
          description: The request did not match the documented schema.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestValidationError'
              example:
                detail:
                  - type: missing
                    loc:
                      - body
                      - payload
                      - phone_number
                    msg: Field required
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicClientErrorResponse'
      security:
        - ApiKeyBearer: []
components:
  schemas:
    PublicCreateClientSchema:
      description: Public API request schema for creating a client.
      examples:
        - company: Acme
          data:
            source: website
          email: ana@example.com
          first_name: Ana
          last_name: García
          phone_number: '+525512345678'
          tags:
            - color: '#7B61FF'
              name: lead
          timezone: America/Mexico_City
      properties:
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Given name.
          title: First Name
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          description: Family name.
          title: Last Name
        area_code:
          anyOf:
            - type: string
            - type: 'null'
          default: ''
          description: >-
            Country calling code (for example `52`) stored alongside the phone
            number. Optional when `phone_number` is already in E.164 format.
          title: Area Code
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Phone number, preferably E.164 (`+525512345678`). Required unless
            `email` is provided.
          title: Phone Number
        email:
          anyOf:
            - type: string
            - type: 'null'
          description: Email address. Required unless `phone_number` is provided.
          title: Email
        company:
          anyOf:
            - type: string
            - type: 'null'
          description: Company or organization name.
          title: Company
        timezone:
          default: UTC
          description: IANA timezone of the contact (for example `America/Bogota`).
          title: Timezone
          type: string
        data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: >-
            Free-form custom fields stored on the contact and available to
            agents as prompt variables.
          title: Data
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/PublicTagSchema'
              type: array
            - type: 'null'
          description: Tags to attach. Tags that do not exist yet are created.
          title: Tags
      title: PublicCreateClientSchema
      type: object
    PublicClientResponse:
      description: Public API response schema for created client.
      properties:
        status:
          const: success
          description: Response status
          title: Status
          type: string
        client_id:
          description: Unique identifier for the created client
          title: Client Id
          type: integer
        message:
          description: Human-readable success message
          title: Message
          type: string
      required:
        - status
        - client_id
        - message
      title: PublicClientResponse
      type: object
    PublicClientErrorResponse:
      description: Public API error response for client operations.
      properties:
        status:
          const: error
          description: Error status
          title: Status
          type: string
        error_code:
          description: Machine-readable error code
          title: Error Code
          type: string
        message:
          description: Human-readable error message
          title: Message
          type: string
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Additional error details
          title: Details
      required:
        - status
        - error_code
        - message
      title: PublicClientErrorResponse
      type: object
    DetailErrorResponse:
      description: 'Plain error body: `{"detail": "..."}`. No `error_code` is included.'
      properties:
        detail:
          description: Human-readable reason for the failure.
          title: Detail
          type: string
      required:
        - detail
      title: DetailErrorResponse
      type: object
    RequestValidationError:
      title: RequestValidationError
      type: object
      description: >-
        Returned when the request body, query string or path could not be parsed
        against the documented schema. Fix the listed fields and retry.
      properties:
        detail:
          type: array
          title: Detail
          description: One entry per invalid field.
          items:
            $ref: '#/components/schemas/RequestValidationErrorItem'
      required:
        - detail
    PublicTagSchema:
      description: Tag info for public API.
      properties:
        name:
          description: Tag name; matched case-sensitively against existing tags.
          title: Name
          type: string
        color:
          description: Hex color used when the tag has to be created, e.g. `#7B61FF`.
          title: Color
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional description shown in the dashboard.
          title: Description
      required:
        - name
        - color
      title: PublicTagSchema
      type: object
    RequestValidationErrorItem:
      title: RequestValidationErrorItem
      type: object
      properties:
        loc:
          type: array
          title: Loc
          description: >-
            Where the problem is: the first element is `body`, `query` or
            `path`, followed by the field path.
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          type: string
          title: Msg
          description: What is wrong with the value.
        type:
          type: string
          title: Type
          description: >-
            Machine-readable validation error type, e.g. `missing` or
            `int_parsing`.
      required:
        - loc
        - msg
        - type
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: pk_...
      description: >-
        API key created in the dashboard under **Settings → API Keys**. Send it
        as `Authorization: Bearer pk_...`.

````