Skip to main content
The Bila API authenticates requests via API keys. Manage your keys in the Bila Console.

Key Types

Key TypePrefixEnvironmentDescription
Live Secret Keysk_live_ProductionUse for live transactions
Test Secret Keysk_test_SandboxUse for testing and development
Never share API keys in client-side code, public repositories, or anywhere accessible without authentication.

Making Authenticated Requests

Include your API key in the x-api-key header with every request:
curl -X GET "https://api.usebila.com/api/v1/bila/accounts" \
  -H "x-api-key: sk_live_your_api_key_here" \
  -H "Content-Type: application/json"

Authentication Errors

Failed authentication returns a 401 response:
{
  "status": false,
  "message": "Unauthorized - Invalid or missing API key"
}

Common Authentication Issues

ErrorCauseSolution
Missing API keyNo x-api-key headerAdd the header to your request
Invalid API keyKey doesn’t exist or is malformedCheck your key in the dashboard
Expired API keyKey has been revokedGenerate a new key
Wrong environmentUsing test key in productionUse the correct key type

Best Practices

Use environment variables or a secrets manager to store your API keys. Never hardcode them in your source code.
Use test keys (sk_test_) for development and live keys (sk_live_) for production.
Regularly rotate your API keys as a security best practice.
If available, create keys with only the permissions your application needs.