Sandbox Headers
The new BTG Pactual Empresas sandbox environment offers a custom header called x-response that lets you force the desired response type: success or error.
This feature is especially useful during development to validate the application's behavior across different response scenarios.
APIs that support sandbox headers are marked in the API reference with a notice similar to:
📘 Sandbox Headers
This endpoint supports Sandbox Headers
Header Description x-response Control the API's response type.
Header: x-response
⚠️ The
x-responseheader works exclusively in the sandbox environment. Calls in production environments do not support this header and will result in an error.
Accepted Values
| Value | Description |
|---|---|
success | Forces the API to return a success response (200 or 201) |
error | Forces the API to return an error response (400) with a simulated payload |
Usage Examples
1. Simulate a success response
GET /30306294000145/banking/direct-debit/debits HTTP/1.1
Host: api.sandbox.empresas.btgpactual.com
x-response: success
Content-Type: application/json
2. Simulate an error response
GET /30306294000145/banking/direct-debit/debits HTTP/1.1
Host: api.sandbox.empresas.btgpactual.com
x-response: error
Content-Type: application/json