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

# Créer un client

> Creates a customer.

All fields are required except `address.street2`, `bankAccounts` and `payrollProviders`. Bank accounts and payroll providers can be included now or added later.

Mandate signature requests are sent to the `contact`.

Any field outside the documented ones is rejected with `unknownField`.

An enterprise number can belong to only one accounting firm. If another firm already registered it, the call returns `403 belongsToAnotherTenant`.

In that case, the accountant must contact Codaclean support to start a transfer procedure, which requires the end customer's agreement.

**Required scope:** `customers:write`




## OpenAPI

````yaml POST /customers/new
openapi: 3.1.0
info:
  title: Codaclean API
  version: '1.0'
  description: >
    The Codaclean external API lets partner software (accounting tools, practice
    management software, sync agents) integrate with Codaclean on behalf of an
    accounting firm: manage its customers, request CODA and CODB mandates, and
    retrieve the CODA and CODB files Codaclean receives for them.
servers:
  - url: https://api.codaclean.io/v1
    description: Production
  - url: https://api.test.codaclean.io/v1
    description: Staging
security:
  - apiKeyAuth: []
    bearerAuth: []
tags:
  - name: Authentication
    description: Obtain and refresh the ID token sent with every other call.
  - name: Utilities
    description: Connectivity check.
  - name: Customers
    description: The customers (client companies) managed by the accounting firm.
  - name: Bank accounts
    description: Bank accounts (IBANs) linked to a customer.
  - name: Customer payroll providers
    description: Payroll providers (social secretariats) linked to a customer.
  - name: Mandates
    description: CODA mandates (per bank account) and CODB mandates (per payroll provider).
  - name: Reference data
    description: Banks and payroll providers known to Codaclean.
  - name: CODA files
    description: Bank statement files in CODA format.
  - name: CODB files
    description: Payroll files in CODB format, delivered by payroll providers.
paths:
  /customers/new:
    post:
      tags:
        - Customers
      summary: Create a customer
      description: >
        Creates a customer.


        All fields are required except `address.street2`, `bankAccounts` and
        `payrollProviders`. Bank accounts and payroll providers can be included
        now or added later.


        Mandate signature requests are sent to the `contact`.


        Any field outside the documented ones is rejected with `unknownField`.


        An enterprise number can belong to only one accounting firm. If another
        firm already registered it, the call returns `403
        belongsToAnotherTenant`.


        In that case, the accountant must contact Codaclean support to start a
        transfer procedure, which requires the end customer's agreement.


        **Required scope:** `customers:write`
      operationId: createCustomer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerCreate'
            examples:
              customer:
                summary: New customer
                value:
                  enterpriseNumber: 0159.145.821
                  name: Atelier Martin SRL
                  accountingRef: MARTIN
                  address:
                    street: Place du Jeu de Balle 3
                    zipCode: '1000'
                    municipality: Bruxelles
                    country: Belgique
                  contact:
                    name: Sophie Martin
                    function: Manager
                    email: accounting@example.com
                    language: fr
      responses:
        '201':
          description: Customer created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
              examples:
                created:
                  summary: Customer created
                  value:
                    id: 6ab7bba70d0379c741b7f74c
                    enterpriseNumber: 0159.145.821
                    name: Atelier Martin SRL
                    accountingRef: MARTIN
                    address:
                      street: Place du Jeu de Balle 3
                      zipCode: '1000'
                      municipality: Bruxelles
                      country: Belgique
                    contact:
                      name: Sophie Martin
                      function: Manager
                      email: accounting@example.com
                      language: fr
                    isConfidential: false
                    bankAccounts: []
                    payrollProviders: []
                    createdOn: '2026-09-26T12:33:43.783Z'
        '400':
          description: >-
            `invalidPayload`, `unknownField`, `invalidEnterpriseNumber` or
            `invalidIban`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unknownField:
                  summary: Field not accepted
                  value:
                    message: 'Unknown field(s): isConfidential'
                    code: unknownField
                    fields:
                      - isConfidential
                invalidEnterpriseNumber:
                  summary: Invalid enterprise number
                  value:
                    message: Enterprise number 0000000000 is not valid
                    code: invalidEnterpriseNumber
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            `forbiddenScope`, or `belongsToAnotherTenant` — the enterprise
            number or an IBAN is already used by another accounting firm.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                belongsToAnotherTenant:
                  summary: Registered by another accounting firm
                  value:
                    message: Customer 0184.574.865 already exists
                    code: belongsToAnotherTenant
                noApiKey:
                  summary: No API key
                  value:
                    message: Forbidden
                invalidApiKey:
                  summary: Invalid API key
                  value:
                    message: Forbidden
        '404':
          description: '`payrollProviderNotFound` — unknown payroll provider code.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                payrollProviderNotFound:
                  summary: Unknown payroll provider code
                  value:
                    message: Payroll provider UNKNOWN not found
                    code: payrollProviderNotFound
        '409':
          description: >-
            `customerAlreadyExists` or `ibanAlreadyInUse` — already registered
            in your accounting firm.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                customerAlreadyExists:
                  summary: Already registered
                  value:
                    message: Customer 0159.145.821 already exists
                    code: customerAlreadyExists
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    CustomerCreate:
      type: object
      required:
        - enterpriseNumber
        - name
        - accountingRef
        - address
        - contact
      additionalProperties: false
      properties:
        enterpriseNumber:
          type: string
          pattern: ^[01]\d{3}\.\d{3}\.\d{3}$
          description: >
            Belgian enterprise number, formatted `0123.456.789`: 10 digits with
            dots, without the `BE` prefix. Its check digits are validated, and
            it must be unique across Codaclean.
        name:
          type: string
          description: Non-empty.
        accountingRef:
          type: string
          description: Your internal reference for the customer.
        address:
          description: All fields are required except `street2`.
          allOf:
            - $ref: '#/components/schemas/Address'
            - required:
                - street
                - zipCode
                - municipality
                - country
        contact:
          description: >-
            All fields are required. Mandate signature requests are sent to this
            contact.
          allOf:
            - $ref: '#/components/schemas/Contact'
            - required:
                - name
                - function
                - email
                - language
        bankAccounts:
          type: array
          description: Only `iban` is accepted. BIC and bank name are derived by Codaclean.
          items:
            type: object
            required:
              - iban
            additionalProperties: false
            properties:
              iban:
                type: string
        payrollProviders:
          type: array
          description: Only `code` is accepted. See `POST /payroll-providers`.
          items:
            type: object
            required:
              - code
            additionalProperties: false
            properties:
              code:
                type: string
    Customer:
      type: object
      description: >-
        Fields without a value are omitted from the response. Arrays are always
        present.
      properties:
        id:
          type: string
        enterpriseNumber:
          type: string
          description: Belgian enterprise number, formatted `0123.456.789`.
        name:
          type: string
        accountingRef:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        contact:
          $ref: '#/components/schemas/Contact'
        isConfidential:
          type: boolean
          description: >-
            Confidential customers are only visible to users with the
            Administrator access level.
        bankAccounts:
          type: array
          description: Active bank accounts only.
          items:
            $ref: '#/components/schemas/BankAccount'
        payrollProviders:
          type: array
          description: Active payroll providers only.
          items:
            $ref: '#/components/schemas/CustomerPayrollProvider'
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
    Error:
      type: object
      description: >
        Error body. `code` is a stable, machine-readable token; it is present on
        errors returned by the customers, mandates and reference-data endpoints.
        Some errors carry extra keys, such as `fields` or `candidates`.
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable description. Do not parse it.
        code:
          type: string
          description: |
            Machine-readable error code.

            **See also:** [Errors](/api/errors#error-codes)
        fields:
          type: array
          items:
            type: string
          description: >-
            Offending fields. Present with `unknownField` and
            `fieldNotUpdatable`.
        candidates:
          type: array
          description: Present with `connectorSelectionRequired`.
          items:
            $ref: '#/components/schemas/ConnectorCandidate'
    Address:
      type: object
      additionalProperties: false
      properties:
        street:
          type: string
        street2:
          type: string
        zipCode:
          type: string
        municipality:
          type: string
        country:
          type: string
    Contact:
      type: object
      additionalProperties: false
      description: >-
        Contact person at the customer. Mandate signature requests are sent to
        this contact.
      properties:
        name:
          type: string
          description: Name of the person who signs the mandates.
        function:
          type: string
        email:
          type: string
          description: Email address the mandate signature requests are sent to.
        language:
          type: string
          description: >-
            Language of the contact: `fr`, `nl` or `en`. Used for the mandate
            documents and emails.
    BankAccount:
      type: object
      properties:
        iban:
          type: string
        currency:
          type: string
          description: >-
            Always `EUR` unless another value is stored. Output only; not
            accepted as input.
        bic:
          type: string
          description: >-
            Derived from the IBAN by Codaclean. Formatted with spaces, for
            example `GEBA BE BB`.
        bankName:
          type: string
        connectorId:
          type: integer
          description: >-
            Present when the bank account is served through a CODAlight
            connector.
    CustomerPayrollProvider:
      type: object
      properties:
        code:
          type: string
          description: >-
            Payroll provider code. `***other***` means another payroll provider,
            not handled by Codaclean.
        nameFr:
          type: string
        nameNl:
          type: string
    ConnectorCandidate:
      type: object
      properties:
        connectorId:
          type: integer
        name:
          type: string
        bicCode:
          type: string
        available:
          type: boolean
    Message:
      type: object
      description: Confirmation returned by actions that do not return a resource.
      required:
        - message
      properties:
        message:
          type: string
  responses:
    Unauthorized:
      description: >-
        Missing, invalid or expired ID token, or user not allowed to use the
        API.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          examples:
            noToken:
              summary: No ID token
              value:
                message: Unauthorized
            invalidToken:
              summary: Invalid or expired ID token
              value:
                message: Unauthorized
    TooManyRequests:
      description: Rate limit or quota exceeded for this API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          examples:
            tooManyRequests:
              summary: Rate limit exceeded
              value:
                message: Too Many Requests
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            internalError:
              summary: Unexpected server error
              value:
                message: Internal server error
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Identifies the partner software. Issued by Codaclean. Required on every
        call, including `POST /token`.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT (Cognito ID token)
      description: >-
        Identifies the user and their accounting firm. Send the `idToken`
        returned by `POST /token` as `Authorization: Bearer <idToken>`. Valid
        for 1 hour.

````