General Definitions
API Endpoints
| Environment | API Endpoint | BTG Id Endpoint |
|---|---|---|
| Sandbox | https://api.sandbox.empresas.btgpactual.com | https://id.sandbox.btgpactual.com |
| Production | https://api.empresas.btgpactual.com | https://id.btgpactual.com |
Security
HTTPS
All BTG Pactual Empresas API endpoints use the HTTPS protocol.
OAuth 2
The BTG Empresas APIs use the OpenID Connect authorization protocol, based on OAuth 2.0, which lets third-party applications access the client's resources. To learn more, go here.
📘 BTG Id
The BTG Empresas Authorization Server is called BTG Id. Using BTG Id, a partner application obtains consent and authorization to perform operations on the BTG APIs on the client's behalf.
Response Codes
The BTG Pactual Empresas APIs use conventional HTTP response codes to indicate the status of requests.
- 2XX codes: success.
- 4XX codes: an error in the parameters the client sent to the API. This class of errors usually requires adjusting the requests.
- 5XX codes: an error on the BTG Empresas servers.
| Status Code | Definition |
|---|---|
| 200 - OK | Successful request. |
| 201 - Created | Resource created. This code always comes with the Location header containing the address of the created resource. |
| 202 - Accepted | Successful asynchronous operation request. |
| 400 - Bad Request | Invalid request. Usually happens due to invalid parameters being sent or missing data for the operation. |
| 401 - Unauthorized | Unauthorized request. Usually happens due to errors related to token authentication. |
| 403 - Forbidden | Request authenticated successfully, but the token used does not have permission for the operation. |
| 404 - Not Found | The resource for the request does not exist. |
| 409 - Conflict | Request conflicts with a previous request. This may be due to the use of the same idempotent key, or the resulting resource conflicts with an existing one. |
| 429 - Too Many Requests | Too many requests by the same client in a short period of time. |
| 500, 502, 503, 504 - Server Errors | A problem on the BTG Empresas API servers. To learn more, visit the status page. |
Conventions
Requests to consume the BTG Empresas APIs must follow the date format YYYY-MM-DD and the currency format 000.01.