Skip to main content

Authentication

Learn how to authenticate your API requests with SafeBank.

API Keys

SafeBank uses API keys to authenticate requests. You can manage your API keys in the merchant dashboard.

Obtaining API Keys

  1. Log in to the merchant dashboard
  2. Navigate to Settings → API Keys
  3. Click "Generate New Key"
  4. Copy and securely store your key

Important: Never share your API keys or commit them to version control.

Test vs Live Keys

  • Test keys - For development and testing
  • Live keys - For production use

Test keys start with test_ and live keys start with live_.

Making Authenticated Requests

Include your API key in the Authorization header:

Authorization: Bearer your_api_key_here

Example Request

const response = await fetch('https://api.safebank.io/v1/payments', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 50.00,
currency: 'USD'
})
});

Security Best Practices

DO:

  • Store API keys securely (environment variables)
  • Use different keys for each environment
  • Rotate keys regularly
  • Revoke compromised keys immediately

DON'T:

  • Commit keys to version control
  • Share keys publicly
  • Use live keys for testing
  • Expose keys in client-side code

Next: Transaction API →