API Authentication & Security

Security is our top priority. This guide covers all authentication methods we support to keep your data safe and your API calls secure.

Authentication Methods

API Key Authentication

The simplest and most common authentication method. Use your API key in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.aspirecodeai.com/v1/projects

How to get your API key:

  1. Log in to your dashboard
  2. Navigate to Settings → API Keys
  3. Click "Generate New Key"
  4. Name your key and select its scope
  5. Copy and store it securely

OAuth 2.0

For third-party integrations and user authentication, we support OAuth 2.0:

POST https://auth.aspirecodeai.com/oauth/token Content-Type: application/json { "grant_type": "client_credentials", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }

OAuth Flows Supported:

JWT (JSON Web Tokens)

For advanced use cases, we support JWT-based authentication:

Header: { "alg": "HS256", "typ": "JWT" } Payload: { "sub": "user_id", "iat": 1516239022, "exp": 1516242622 }

Security Best Practices

Do's

Don'ts

Managing Your API Keys

View Your Keys

All your API keys are visible in the dashboard. You can see:

Rotate a Key

To rotate an API key (recommended every 90 days):

  1. Generate a new API key
  2. Update your applications to use the new key
  3. Test thoroughly
  4. Delete the old key

Revoke a Key

If you suspect a key has been compromised:

  1. Go to Settings → API Keys
  2. Click the key you want to revoke
  3. Click "Revoke" and confirm
  4. The key will be immediately deactivated

Rate Limiting

To ensure fair usage, we implement rate limiting on our APIs:

Plan Requests/Hour Concurrent Connections
Free 1,000 10
Professional 10,000 50
Enterprise Unlimited Unlimited

Handling Rate Limits

If you exceed rate limits, you'll receive a 429 (Too Many Requests) response. Implement exponential backoff:

// Exponential backoff example async function apiCall(url, retries = 3) { for (let i = 0; i < retries; i++) { try { const response = await fetch(url); if (response.status === 429) { const delay = Math.pow(2, i) * 1000; await new Promise(resolve => setTimeout(resolve, delay)); continue; } return response; } catch (error) { console.error('API Error:', error); } } }

Error Codes & Responses

Code Meaning Solution
401 Unauthorized Check your API key and Authorization header
403 Forbidden Your key lacks required permissions
429 Rate Limited Implement exponential backoff
500 Server Error Contact support, retry after 60 seconds

Compliance & Standards

We follow industry-leading security standards:

Support & Resources

For security questions or concerns:

← Back to Documentation