Skip to main content

Authentication

The COPA API uses API keys to authenticate requests. Each API key has specific scopes that determine what data it can access.

Getting an API Key

To obtain an API key:

  1. Contact the COPA team at partners@copa.rw
  2. Provide your organization details and use case
  3. Receive your API key with appropriate scopes

API Key Format

API keys follow this format:

sk_copa_{type}_{32_random_characters}

Example: sk_copa_partner_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

Key Types

TypeDescription
partnerPartner integrations (banks, government)
webhookWebhook integrations
mobileMobile application access
systemSystem-to-system integrations

Using Your API Key

You can authenticate using either method:

curl -X GET "https://api.copa.rw/api/v1/cooperatives" \
-H "Authorization: Bearer sk_copa_partner_your_api_key"

Option 2: X-API-Key Header

curl -X GET "https://api.copa.rw/api/v1/cooperatives" \
-H "X-API-Key: sk_copa_partner_your_api_key"

Scopes

API keys are granted specific scopes that control access. Each endpoint requires a specific scope — if your key doesn't have it, you'll get a 403 Forbidden error.

ScopePermission
cooperatives:readRead cooperative data
cooperatives:writeCreate/update cooperatives
members:readRead member data
members:writeCreate/update members
loans:readRead loan data
loans:writeCreate/update loans
payments:readRead payment data
payments:writeCreate/update payments
webhooks:receiveReceive webhook events
info

Most partner integrations only need cooperatives:read and members:read scopes.

For detailed information about how permissions work, see Permissions & Scopes.

Security Best Practices

  1. Keep keys secret — Never expose API keys in client-side code or public repositories
  2. Use environment variables — Store keys in environment variables, not in code
  3. Rotate regularly — Request new keys periodically
  4. Use minimal scopes — Only request scopes you actually need

Authentication Errors

StatusErrorDescription
401Invalid API keyThe API key is invalid or inactive
403Insufficient scopeThe API key lacks required scope

Example error response:

{
"detail": "Invalid API key"
}

Next Steps