# Create a Consent

Create the initial Consent for a Payment Method. Once you create a Consent, you can upload supporting documents that serve as consent from your customer to debit their bank account using the Upload Consent Files endpoint.

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

## Request fields (application/json):

  - `paymentMethodId` (string, required)
    The unique identifier created by Belvo used to reference the payment method that you want to upload consent documents for.
    Example: "0d1a377b-b4c5-4a94-9e2e-83e59d1f6a9c"

## Response 201 fields (application/json):

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

  - `status` (string, required)
    The status of the consent. Can be one of the following:

Initial:
- awaiting_information: The consent has been created and now the accompanying files must be uploaded.

After file upload:
- submitted: All the necessary documents have been uploaded and the consent is pending confirmation.
- incomplete_information: One or more files are missing or invalid.

Final states:
- confirmed: The associated files have been reviewed and accepted. The consent is now active and you can make payments requests.
- rejected: The submitted documents were rejected and the consent was not granted.
- received_chargeback: The customer received a chargeback after the consent was confirmed.
    Enum: "awaiting_information", "submitted", "confirmed", "incomplete_information", "rejected", "received_chargeback"

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

  - `isBankNotified` (boolean, required)
    Indicates whether the bank has been notified of the Consent. This is set to true in the case a chargeback is received and the Consent evidence has been sent through to the bank.

## 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"


