← BRPix API documentation

Authentication

Use API keys to obtain, refresh and revoke tokens.

Authentication flow

Merchant BRPix API | | |-- POST /v1/auth/token (mTLS + API keys) ------>| | |-- verifies the credential hash | |-- checks the IP allowlist |<-- 200 access_token (15 min) -----------------| | + refresh_token (7 days) | | | |-- GET /v1/balance --------------------------->| | mTLS + Bearer access_token | |<-- 200 balance -------------------------------| | | |-- POST /v1/auth/refresh (refresh_token) ----->| |<-- 200 new access_token (15 min) --------------|

POST /v1/auth/token

Exchange your key_id and key_secret for a pair of tokens.

# Request
curl -s -X POST https://api.brpix.app/v1/auth/token \
  --cert cert.pem --key key.pem \
  -H "Content-Type: application/json" \
  -d '{
    "key_id": "bk_live_abc123",
    "key_secret": "sk_live_xxxxxxxxxxxxx"
  }'

# 200 response
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 900,
  "refresh_token": "d2f4a8b1-1234-5678-abcd-ef0123456789"
}

POST /v1/auth/refresh

Use your refresh_token to obtain a new access_token.

# Request
curl -s -X POST https://api.brpix.app/v1/auth/refresh \
  --cert cert.pem --key key.pem \
  -H "Content-Type: application/json" \
  -d '{"refresh_token": "d2f4a8b1-1234-5678-abcd-ef0123456789"}'

# 200 response
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 900
}

DELETE /v1/auth/revoke

Revoke a refresh_token before its seven-day expiry. Use this when signing out or rotating credentials.

# Request (requires a valid bearer token)
curl -s -X DELETE https://api.brpix.app/v1/auth/revoke \
  --cert cert.pem --key key.pem \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{"refresh_token": "d2f4a8b1-1234-5678-abcd-ef0123456789"}'

# 204 No Content response

Available scopes

ScopeDescription
balance:readRead available, pending and blocked balances
statement:readRead the account statement (paginated ledger entries)
pix_in:createCreate Pix In charges and cancel eligible pending charges
pix_in:readRead Pix In charges and registered Pix keys
pix_out:createInitiate Pix Out transfers. Requires authorized IP addresses.
pix_out:readRead Pix Out transfer status
infractions:readList MED disputes and check whether a defense can be submitted
infractions:writeSubmit a MED defense for internal review
An API key can have multiple scopes. Set them when creating or editing a key in the BRPix dashboard under Settings → API Keys.

Authorized IP addresses

To obtain a token, your server's outbound IP address must be on the credential's allowlist. Requests from other addresses and credentials with an empty allowlist receive 403 IP_NOT_AUTHORIZED.

For pix_out:create, restrict the allowlist to the IP addresses that need to send transfers. This limits misuse if the key_secret is exposed.

mTLS

A client mTLS certificate is required to obtain a token and access protected endpoints. Generate the certificate in the BRPix dashboard. In these examples, cert.pem and key.pem represent the certificate and its private key.