Authentication
Learn how to authenticate with the Ajrly API using API keys, OAuth 2.0, and JWT tokens.
All API requests require authentication. Choose the method that best fits your use case.
API Keys
API keys are the simplest way to authenticate. They’re best suited for server-to-server communication.
Generating an API Key
- Go to Settings → API Keys
- Click Create New Key
- Give it a descriptive name and set permissions
- Copy the key — it won’t be shown again
Using API Keys
Include the key in the Authorization header:
curl -X GET https://api.ajrly.com/v1/projects \
-H "Authorization: Bearer sk_live_abc123def456"const response = await fetch('https://api.ajrly.com/v1/projects', {
headers: {
Authorization: 'Bearer sk_live_abc123def456',
},
});
const data = await response.json();import requests
response = requests.get(
'https://api.ajrly.com/v1/projects',
headers={'Authorization': 'Bearer sk_live_abc123def456'}
)
data = response.json()
OAuth 2.0
Use OAuth 2.0 when your application needs to access resources on behalf of a user.
Authorization Flow
- Redirect the user to the authorization URL
- User grants permission
- Receive an authorization code
- Exchange the code for an access token
GET https://auth.ajrly.com/authorize
?client_id=your_client_id
&redirect_uri=https://yourapp.com/callback
&response_type=code
&scope=read write
Token Exchange
curl -X POST https://auth.ajrly.com/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"code": "auth_code_here",
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"redirect_uri": "https://yourapp.com/callback"
}'
Token Response
{
"access_token": "at_live_abc123",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_live_xyz789",
"scope": "read write"
}
JWT Tokens
JWT tokens are used for session-based authentication, typically in web and mobile applications.
Token Structure
Ajrly JWTs contain:
sub— User IDorg— Organization IDexp— Expiration timestampiat— Issued at timestampscope— Granted permissions
Scopes
Control access granularity with scopes:
| Scope | Description |
|---|---|
read | Read access to all resources |
write | Write access to all resources |
projects:read | Read access to projects |
projects:write | Write access to projects |
team:manage | Team management permissions |
billing:read | Read billing information |
Security Best Practices
- Rotate API keys regularly
- Use the minimum required scopes
- Store secrets in environment variables
- Implement token refresh logic
- Monitor API key usage in your dashboard
Last updated: February 28, 2026
Edit this page on GitHub
Was this page helpful?
Thanks for your feedback!