Skip to content

Authentication

All API requests require authentication using an API key or OAuth 2.0 token.

API Key Authentication

Include your API key in the Authorization header:

bash
curl https://api.islamicopenfinance.com/v1/contracts \
  -H "Authorization: Bearer iof_sk_live_abc123..."

Key Types

TypePrefixEnvironment
Live Secretiof_sk_live_Production
Test Secretiof_sk_test_Sandbox
Publishableiof_pk_Client-side

Creating Keys

Via the dashboard or API:

typescript
const key = await iof.apiKeys.create({
  name: "Production Server",
  permissions: ["contracts:*", "kyc:read"],
});

OAuth 2.0

For user-delegated access:

bash
curl https://api.islamicopenfinance.com/v1/contracts \
  -H "Authorization: Bearer iof_at_abc123..."

See OAuth 2.0 Guide for implementation details.

Scopes

ScopeAccess
contracts:readRead contracts
contracts:writeCreate/update contracts
contracts:*Full contract access
kyc:readRead KYC data
kyc:writeSubmit verifications
billing:readView billing
admin:*Full admin access

Error Responses

401 Unauthorized

json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}

403 Forbidden

json
{
  "error": {
    "code": "FORBIDDEN",
    "message": "API key lacks required permissions"
  }
}

Security Best Practices

  1. Never expose secret keys in client-side code
  2. Use environment variables for credentials
  3. Rotate keys regularly (90 days recommended)
  4. Use minimum required scopes
  5. Monitor key usage for anomalies

Next Steps

Licensed under the Apache License 2.0