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

# Create a new client



## OpenAPI

````yaml /openapi.json post /api/v1/clients
openapi: 3.0.0
info:
  title: Payable API
  description: >-
    REST API for integrating with Payable programmatically. Authenticate with
    Clerk JWT (web app) or API keys (`esk_live_` / `esk_test_`). Test keys
    operate in sandbox mode without wallet charges or real WhatsApp. Request
    bodies and query parameters are documented from class-validator /
    class-transformer DTOs. Every error is RFC 9457 `application/problem+json`;
    branch on `code`, not `detail`.
  version: '1.0'
  contact: {}
servers:
  - url: https://api.payable.run
    description: Production
  - url: https://localhost:3000
    description: Local
security: []
tags: []
paths:
  /api/v1/clients:
    post:
      tags:
        - clients
      summary: Create a new client
      operationId: ClientController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateClientDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientResponseDto'
        '400':
          description: Invalid payload
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        default:
          description: RFC 9457 problem details. Inspect `code` for programmatic handling.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      security:
        - bearer: []
components:
  schemas:
    CreateClientDto:
      type: object
      properties: {}
    ClientResponseDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        firstName:
          type: string
          example: João
        lastName:
          type: string
          example: Silva
        cpf:
          type: object
          nullable: true
          example: '12345678901'
        email:
          type: object
          nullable: true
          example: joao@empresa.com
        phone:
          type: string
          example: '11999999999'
        occupation:
          type: object
          nullable: true
        observation:
          type: object
          nullable: true
        organizationId:
          type: string
          format: uuid
        cep:
          type: object
          nullable: true
        city:
          type: object
          nullable: true
        neighborhood:
          type: object
          nullable: true
        street:
          type: object
          nullable: true
        address:
          type: object
          nullable: true
        streetNumber:
          type: object
          nullable: true
        state:
          type: object
          nullable: true
          example: SP
        status:
          type: string
          enum:
            - UP_TO_DATE
            - OVERDUE
          example: OVERDUE
        isSandbox:
          type: boolean
        debtCount:
          type: number
        totalDebtAmount:
          type: number
        outstandingAmount:
          type: number
        openDebtCount:
          type: number
        overdueDebtCount:
          type: number
        paidDebtCount:
          type: number
        nextDueDate:
          type: object
          nullable: true
        channelPreferences:
          $ref: '#/components/schemas/ClientChannelPreferencesDto'
        overIndebtednessReportedAt:
          type: string
          nullable: true
          format: date-time
          description: >-
            Quando o cliente informou estar em processo de superendividamento
            (Lei 14.181/2021). Enquanto preenchido, toda a cobrança dele fica
            pausada; só um administrador retoma.
        overIndebtednessSource:
          type: string
          nullable: true
          enum:
            - agent
            - voice
          description: 'Quem ouviu: o agente do WhatsApp (`agent`) ou o de voz (`voice`).'
        createdAt:
          type: object
        updatedAt:
          type: object
      required:
        - id
        - firstName
        - lastName
        - phone
        - organizationId
        - status
        - createdAt
        - updatedAt
    ProblemDetails:
      type: object
      required:
        - type
        - title
        - status
        - detail
        - instance
        - code
        - requestId
      properties:
        type:
          type: string
          format: uri
          example: https://docs.payable.run/errors/validation_error
        title:
          type: string
          example: Bad Request
        status:
          type: integer
          example: 400
        detail:
          type: string
          example: One or more request fields are invalid.
        instance:
          type: string
          example: /api/v1/clients
        code:
          type: string
          example: VALIDATION_ERROR
        requestId:
          type: string
          format: uuid
        errors:
          type: array
          items:
            type: object
            required:
              - message
            properties:
              field:
                type: string
              message:
                type: string
    ClientChannelPreferencesDto:
      type: object
      properties:
        whatsapp:
          $ref: '#/components/schemas/ChannelPreferenceSnapshotDto'
        email:
          $ref: '#/components/schemas/ChannelPreferenceSnapshotDto'
        sms:
          $ref: '#/components/schemas/ChannelPreferenceSnapshotDto'
      required:
        - whatsapp
        - email
        - sms
    ChannelPreferenceSnapshotDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - open
            - pending_cancel
            - snoozed
            - opted_out
        mutedUntil:
          type: object
          nullable: true
        optedOutAt:
          type: object
          nullable: true
        source:
          type: object
          nullable: true
        reason:
          type: string
          nullable: true
          enum:
            - already_paid
            - not_my_debt
            - family
            - new_child
            - high_bills
            - wrong_channel
            - stop_channel
            - other
        reasonDetail:
          type: object
          nullable: true
      required:
        - status
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: API Key or JWT
      type: http
      description: >-
        Use `Authorization: Bearer esk_live_...` or `esk_test_...` for API
        access

````

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