Authentication

All PearMedica API requests require authentication via API keys. This guide covers key management, rate limiting, and security best practices.

API Key Format

PearMedica issues two types of API keys, distinguished by their prefix:

PrefixEnvironmentUsage
sk_live_ProductionLive patient assessments. Usage is metered and billed.
sk_test_DevelopmentSandbox testing. Returns mock data, not billed.

Using Your API Key

Include your API key in the Authorization header of every request:

http
Authorization: Bearer sk_live_your_api_key_here

Security Best Practices

  • Never expose API keys in client-side code (browsers, mobile apps)
  • Store keys in environment variables, not in source code
  • Use sk_test_ keys for development and testing
  • Rotate keys immediately if you suspect they've been compromised
  • Use separate keys for each environment (staging, production)

Key Management

Manage your API keys from the Dashboard → API Keys page. Available actions:

Create Key

Generate a new API key with a descriptive label. The full key is shown once — save it immediately.

Rotate Key

Generates a new key and invalidates the old one. Use POST /v1/keys/rotate or the dashboard.

Revoke Key

Permanently disables a key. All requests using it will receive 401 Unauthorized.

View Usage

See per-key usage metrics: total requests, last used timestamp, and rate limit status.

Rate Limiting

All API keys have a default rate limit of 100 requests per minute using a sliding window algorithm. Rate limit headers are included in every response:

http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1709193600
TierRate LimitMonthly Quota
Pilot100 req/min200 assessments (free)
Professional100 req/min1,000 included + ₦20/additional
EnterpriseCustomCustom — contact sales

If you exceed the rate limit, you'll receive a 429 Too Many Requests response. Implement exponential backoff to handle this gracefully.

Next Steps