# Create a customer

Create a new Direct Debit customer

Endpoint: POST /customers
Version: 1.0.0
Security: ApiKeyAuth, ApiKeySecret

## Request fields (application/json):

  - `firstname` (string, required)
    The first name of the customer.
    Example: "Carlos"

  - `lastname` (string, required)
    The last name of the customer.
    Example: "Vives"

  - `email` (string, required)
    The email of the customer.
    Example: "carlos-vives@musica.mx"

  - `documentType` (string, required)
    The document type of the individual.

For 🇲🇽 Mexico, can be one of the following:
  - mx_rfc: Tax Identification Number (Registro Federal de Contribuyentes)
  - mx_curp: Unique Population Registry Code (Clave Única de Registro de Población)
    Enum: "mx_rfc", "mx_curp"

  - `documentNumber` (string, required)
    The document number of the customer.
For Mexico, this must be 18 characters.

> Note: If the documentNumber does not match the expected character length and format for a given documentType, we return a 400 input_validation error.
    Example: "123456789"

  - `phone` (string)
    The phone number of the customer (including country code).
    Example: "+523001234567"

## Response 201 fields (application/json):

  - `customerId` (string)
    The unique identifier created by Belvo used to reference the customer.
    Example: "0d1a377b-b4c5-4a94-9e2e-83e59d1f6a9c"

## Response 400 fields (application/json):

  - `statusCode` (integer)
    The HTTP status code for this error.
    Example: 400

  - `error` (string)
    The HTTP status code description for this error.
    Example: "Bad Request"

  - `message` (any)
    A short description of the error, indicating what is wrong with the request.
> Note: We return either a string or an array of strings, depending on the validation error(s). 

The description can be (among others):

  - id must be a UUID
  - Not enough balance
  - amount is not a valid decimal number.
  - currency must be one of the following values: cop, mxn, usd
  - reference must be a string
  - Customer not found for merchant
  - documentType is a required field
    Example: "id must be a UUID"

## Response 401 fields (application/json):

  - `statusCode` (integer)
    The HTTP status code for this error.
    Example: 401

  - `error` (string)
    The HTTP status code description for this error.
    Example: "Unauthorized"

  - `message` (string)
    A short description of the error, indicating what is wrong with the request.
In the case of a 401 Unauthorized error, the message is:

  - Unauthorized credentials
    Example: "Unauthorized credentials"

## Response 404 fields (application/json):

  - `statusCode` (integer)
    The HTTP status code for this error.
    Example: 404

  - `error` (string)
    The HTTP status code description for this error.
    Example: "Not Found"

  - `message` (string)
    A short description of the error, indicating what is wrong with the request.
The description can be (among others):

  - Payout Target not found
  - Payment method not found
  - Customer not found
    Example: "Payout Target not found"


