Authentication
You'll need to authenticate every request to the Cobrofácil API. Cobrofácil uses bearer tokens generated in the app.
Generate a token
Create API tokens from the Cobrofácil app.
The token is generated for the mode currently active in the app:
- When
Ambiente de Pruebais enabled, the token accesses sandbox data. - When
Ambiente de Pruebais disabled, the token accesses production data.
Generating a new token replaces the previous token for the active environment. Copy the token when it is shown and store it securely.
Send the token
Pass the token in the Authorization header using the Bearer scheme. Also
send X-Environment with either default for production data or sandbox for
sandbox data.
Example request with bearer token
curl https://api.cobrofacil.com/api/v1/stp/balance \
-H "Authorization: Bearer {token}" \
-H "X-Environment: sandbox"
Do not send tokens in query strings or request bodies. Always keep your token safe and regenerate it if you suspect it has been compromised.
Use an SDK
Official SDKs accept the environment and bearer token when you build the client.