# Enroll a new user device

## ▶️ Usage

With the Enroll a new user device method, you can begin the enrollment process for a new device to allow for Biometric payments.

> 🚧 Create a customer first
>
> Before you can enroll a user device, you must first create a customer.

Endpoint: POST /payments/br/enrollments/
Version: 1.223.0
Security: basicAuth

## Request fields (application/json):

  - `type` (string, required)
    The type of enrollment. For 🇧🇷 Brazil's OFPI, can be either:

  - open_finance_biometric_pix: For biometric payments using the PIX network.
    Enum: "open_finance_biometric_pix"

  - `details` (object, required)
    The details of the enrollment to be created.

  - `details.customer` (string, required)
    Belvo's unique ID to reference the customer.
    Example: "c860809f-e96d-4d50-9588-f40ffab77302"

  - `details.institution` (string, required)
    Belvo's unique ID to reference the payer's institution.
    Example: "600f1b4a-1ef9-4f89-b341-1a35f0c32cc0"

  - `details.name` (string)
    A human-readable name for the device enrollment.
    Example: "600f1b4a-Mobile"

  - `details.callback_url` (string)
    The URL to redirect your user to after the enrollment process is completed.
    Example: "https://example.com/enrollment-in-progress"

  - `details.platform` (string, required)
    The platform of the device to be enrolled. Can be either:

  - ANDROID: For Android devices.
  - BROWSER: For web browsers.
  - CROSS_PLATFORM: For cross-platform devices.
  - IOS: For iOS devices.
    Enum: "ANDROID", "BROWSER", "CROSS_PLATFORM", "IOS"

  - `details.risk_signals` (object, required)
    Details regarding the device to be enrolled. This is the JSON-formatted object received from the Belvo Android or iOS SDK.

## Response 201 fields (application/json):

  - `id` (string)
    Belvo's unique identifier of the enrollment.
    Example: "600f1b4a-1ef9-4f89-b341-1a35f0c32cc0"

  - `created_by` (string)
    The Belvo ID of the merchant that created the enrollment.
    Example: "dbdce1e9-d089-4b7d-804b-51dd07748202"

  - `created_at` (string)
    The ISO-8601 timestamp of when the data point was created in Belvo's database.
    Example: "2024-11-26T11:20:57.389056Z"

  - `updated_at` (string)
    The ISO-8601 timestamp of when the enrollment was last updated.
    Example: "2024-11-26T11:20:57.389058Z"

  - `external_id` (string)
    An additional unique identifier for the resource for internal purposes.

{% admonition type="success" name="Highly Recommended" %}
  We recommend using this field to store your own unique identifier for each resource (customer, bank account, payment intent, or enrollment). This can be useful for tracking the resource in your system and for debugging purposes.
{% /admonition %}
    Example: "4b8a81a0-e33c-45a6-8567-479efb105f73"

  - `type` (string)
    The type of enrollment. For 🇧🇷 Brazil's OFPI, can be either:

  - open_finance_biometric_pix: For biometric payments using the PIX network.
    Enum: "open_finance_biometric_pix"

  - `status` (string)
    The status of the device enrollment. Can be either:

- PENDING: The enrollment is pending.
- SUCCEEDED: The enrollment was successful.
- CANCELED: The enrollment was canceled.
- FAILED: The enrollment failed.
    Enum: "PENDING", "SUCCEEDED", "CANCELED", "FAILED"

  - `status_reason_code` (string,null)
    A machine-readable code providing the reason for a failed enrollment. Only present when status is FAILED.

Possible values:
  - send_risk_signals_failed: Enrollment rejected due to timeout while sending risk signals.
  - redirection_to_institution_failed: Enrollment rejected because the redirection to the institution was not successfully completed.
  - biometric_registration_failed: Enrollment rejected because the biometric registration was not completed successfully within the allowed time.
  - too_many_device_registration_attempts: Enrollment rejected due to too many failed device registration attempts.
  - rejected_by_user: Enrollment was manually cancelled by the user.
  - device_not_supports_biometric_authentication: Enrollment rejected because the device is not compatible with biometric authentication.
  - institution_infra_failed: Enrollment rejected due to infrastructure issues at the institution.
  - blocked_by_institution_security_policy: Enrollment rejected due to the institution security policy decisions based on risk evaluation.
  - redirection_back_from_institution_failed: Enrollment rejected because the redirection back from the institution was not successfully completed.
  - biometric_validation_error: Enrollment failed due to biometric validation or public key registration issues.
  - rejected_other: Enrollment rejected for an unspecified reason.
  - canceled_due_to_expiration: Enrollment canceled due to expiration of validity period.
    Example: "biometric_registration_failed"

  - `status_reason_message` (string,null)
    A human-readable message providing more details about the reason for a failed enrollment. Only present when status is FAILED. Please see status_reason_code for example messages for each reason code.
    Example: "Enrollment rejected because the biometric registration was not completed successfully within the allowed time."

  - `details` (object)
    Details regarding the enrollment

  - `details.status` (string)
    The status of the Biometric payments enrollment. Can be either:

  - AWAITING_ACCOUNT_HOLDER_VALIDATION: The account holder needs to validate the enrollment by sending their biometric data.
  - AWAITING_ENROLLMENT: The enrollment information has been sent to the institution and is being evaluated.
  - AUTHORIZED: The enrollment has been authorized.
  - REJECTED: The institution has rejected the enrollment.
  - REVOKED: The user or the institution has revoked the enrollment.
    Enum: "AWAITING_ACCOUNT_HOLDER_VALIDATION", "AWAITING_ENROLLMENT", "AUTHORIZED", "REJECTED", "REVOKED"

  - `details.customer` (string)
    Belvo's unique ID to reference the customer.
    Example: "c860809f-e96d-4d50-9588-f40ffab77302"

  - `details.institution` (string)
    Belvo's unique ID to reference the institution the device is enrolled at.
    Example: "600f1b4a-1ef9-4f89-b341-1a35f0c32cc0"

  - `details.platform` (string)
    The platform of the device to be enrolled. Can be either:

  - ANDROID: For Android devices.
  - BROWSER: For web browsers.
  - CROSS_PLATFORM: For cross-platform devices.
  - IOS: For iOS devices.
    Enum: "ANDROID", "BROWSER", "CROSS_PLATFORM", "IOS"

  - `details.name` (string,null)
    An internal name for this device enrollment.
    Example: "600f1b4a-Mobile"

  - `details.callback_url` (string)
    The URL to redirect your user to after the enrollment process is completed.
    Example: "https://example.com/enrollment-in-progress"

  - `details.redirect_url` (string)
    The URL to redirect the user to complete their enrollment at the institution.
    Example: "https://www.acmecorp.com/checkout/3487321"

  - `details.risk_signals` (string)
    An obfuscated string () used to indicate that risk signals have been provided.
    Example: "******"

  - `details.expires_at` (string)
    The ISO-8601 timestamp of when the enrollment will expire. After this time, the enrollment will no longer be valid and the status will transition to CANCELED and the status_reason_code will be set to canceled_due_to_expiration.
    Example: "2026-12-26T11:20:57.389056Z"

  - `metadata` (object)
    Optional and customizable object where you can provide any additional key-value pairs for your internal purposes. For example, an internal reference number for the enrollment.


⚠️ Note: You can only provide up to 50 keys (keys can have up to 50 characters each and each value can be up to 500 characters). We do not support nested objects, only ASCII values.
    Example: {"internal_reference_id":"GGq73487w2"}

## Response 400 fields (application/json):

  - `code` (string, required)
    A unique error code (null, does_not_exist, required, already_registered, invalid_choice, max_length, min_length, blank, null, cancellation_error, idempotency_key_invalid) that allows you to classify and handle the error programmatically.
    Example: "required"

  - `message` (string, required)
    A short description of the error.


The description can be (among others):

  - This field is required.
  - Object with name=narnia does not exist.
  - This field may not be null.
  - This field may not be blank.
  - This customer is already registered
  - Ensure this field has at least 2 characters.
  - Ensure this field has no more than 4 characters.
  - Entered value is not valid.
  - You must set all required fields: username, password, username_type.
  - Payment Intent cannot be canceled because it is not SCHEDULED.
  - Payment Intent cannot be canceled as the cutoff time (23:59:00) has passed.
  - The provided idempotency key is invalid.
    Example: "This field is required."

  - `request_id` (string, required)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

  - `field` (string,null)
    Name of the field where the error was encountered.

> Note: This field is only present when the error is related to a specific field.
    Example: "institution"

## Response 403 fields (application/json):

  - `code` (string)
    A unique error code (access_to_resource_denied) that allows you to classify and handle the error programmatically.


ℹ️ Check our DevPortal for more information on how to handle 403 access_to_resource_denied.
    Example: "access_to_resource_denied"

  - `message` (string)
    A short description of the error. 


For access_to_resource_denied errors, the description is:
  
  - You don't have access to this resource..
    Example: "You don't have access to this resource."

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

## Response 404 fields (application/json):

  - `code` (string)
    A unique error code (not_found) that allows you to classify and handle the error programmatically.
    Example: "not_found"

  - `message` (string)
    A short description of the error.


For not_found errors, the description is:

  - Not found
    Example: "Not found"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

## Response 408 fields (application/json):

  - `code` (string)
    A unique error code (request_timeout) that allows you to classify and handle the error programmatically.


ℹ️ Check our DevPortal for more information on how to handle 408 request_timeout errors.
    Example: "request_timeout"

  - `message` (string)
    A short description of the error. 


For request_timeout errors, the description is:
  
  - The request timed out, you can retry asking for less data by changing your query parameters.
    Example: "The request timed out, you can retry asking for less data by changing your query parameters"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

## Response 500 fields (application/json):

  - `code` (string)
    A unique error code (unexpected_error) that allows you to classify and handle the error programmatically.


ℹ️ Check our DevPortal for more information on how to handle 500 unexpected_error errors.
    Example: "unexpected_error"

  - `message` (string)
    A short description of the error. 


For unexpected_error errors, the description is:
  
  - Belvo is unable to process the request due to an internal system issue or to an unsupported response from an institution.
    Example: "Belvo is unable to process the request due to an internal system issue or to an unsupported response from an institution"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"


