Authentication
API key management and user authentication
Authenticate user and receive JWT token
User's password
password
Login successful
Authentication failed - invalid or missing API key
POST /api/auth/login HTTP/1.1
Host: dev.granularregistry.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 51
"username='[email protected]'&password='password'"
{
"access_token": "text",
"token_type": "bearer",
"user_id": 3
}
Get all API keys for the current user
List of API keys
Authentication failed - invalid or missing API key
GET /api/auth/api-keys HTTP/1.1
Host: dev.granularregistry.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
{
"id": 1,
"key_name": "Clean Incentive Marketplace Integration",
"key_prefix": "gcreg_2f",
"scopes": "read",
"rate_limit": 1000,
"is_active": true,
"last_used": "2024-01-01T14:30:00Z",
"expires_at": "2025-10-20T11:45:48.640Z",
"created_at": "2024-01-01T13:10:00Z"
}
]
Create a new API key for external integrations
Human-readable name for the API key
Clean Incentive Marketplace Integration
Comma-separated scopes
read
Example: read
Possible values: Hourly rate limit for this key
1000
Example: 1000
When the key expires (optional)
API key created successfully
Request validation failed
Authentication failed - invalid or missing API key
POST /api/auth/api-keys HTTP/1.1
Host: dev.granularregistry.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 128
{
"key_name": "Clean Incentive Marketplace Integration",
"scopes": "read",
"rate_limit": 1000,
"expires_at": "2025-10-20T11:45:48.640Z"
}
{
"id": 1,
"key_name": "Clean Incentive Marketplace Integration",
"key_prefix": "gcreg_2f",
"api_key": "gcreg_2fCeA78CA62644eB55B0A36249245A27",
"scopes": "read",
"rate_limit": 1000,
"expires_at": "2025-10-20T11:45:48.640Z",
"created_at": "2024-01-01T13:10:00Z"
}
Delete an existing API key
API key ID to delete
1
API key deleted successfully
No content
Authentication failed - invalid or missing API key
Resource not found
DELETE /api/auth/api-keys/{api_key_id} HTTP/1.1
Host: dev.granularregistry.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Update an existing API key's properties
API key ID to update
1
Updated Marketplace Integration
true
2000
API key updated successfully
Request validation failed
Authentication failed - invalid or missing API key
Resource not found
PATCH /api/auth/api-keys/{api_key_id} HTTP/1.1
Host: dev.granularregistry.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 121
{
"key_name": "Updated Marketplace Integration",
"is_active": true,
"rate_limit": 2000,
"expires_at": "2025-10-20T11:45:48.640Z"
}
{
"id": 1,
"key_name": "Clean Incentive Marketplace Integration",
"key_prefix": "gcreg_2f",
"scopes": "read",
"rate_limit": 1000,
"is_active": true,
"last_used": "2024-01-01T14:30:00Z",
"expires_at": "2025-10-20T11:45:48.640Z",
"created_at": "2024-01-01T13:10:00Z"
}
Was this helpful?