Manage API keys for your users via the REST API
curl -X GET \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys
{ "data": [ { "id": "key_123", "name": "Production API Key", "user_id": 456, "plan_id": "plan_789", "status": "active", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } ], "count": 1 }
curl -X POST \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ -H "Content-Type: application/json" \ -d '{ "name": "New API Key", "user_id": 123, "plan_id": "plan_456", "status": "active" }' \ https://api.limitly.dev/v1/keys
{ "data": { "id": "key_123", "api_key": "lk_user_abcdef1234567890abcdef1234567890", "name": "New API Key", "user_id": 123, "plan_id": "plan_456", "status": "active", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } }
curl -X GET \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys/key_123
{ "data": { "id": "key_123", "name": "Production API Key", "user_id": 456, "plan_id": "plan_789", "status": "active", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } }
curl -X PUT \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated API Key Name", "status": "inactive" }' \ https://api.limitly.dev/v1/keys/key_123
curl -X DELETE \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys/key_123
{ "data": { "message": "API key deleted successfully" } }
curl -X POST \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys/key_123/regenerate
{ "data": { "id": "key_123", "api_key": "lk_user_newabcdef1234567890abcdef1234567890", "name": "Production API Key", "user_id": 456, "plan_id": "plan_789", "status": "active", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } }
curl -X GET \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys/key_123/usage
{ "data": { "current_usage": 45, "limit": 1000, "remaining": 955, "reset_time": "2024-02-01T00:00:00Z", "period": "month" } }
curl -X GET \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ https://api.limitly.dev/v1/keys/key_123/requests
{ "data": { "requests": [ { "timestamp": "2024-01-01T12:00:00Z", "endpoint": "/api/users", "method": "GET", "status": "allowed", "ip_address": "192.168.1.1" } ], "count": 1 } }
{ "error": "Invalid API key", "code": "INVALID_API_KEY" }
{ "error": "API key not found", "code": "API_KEY_NOT_FOUND" }
{ "error": "Validation failed", "code": "VALIDATION_ERROR", "details": { "field": "name", "message": "Name is required" } }
curl -X GET \ -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \ "https://api.limitly.dev/v1/keys?page=2&limit=20"
Was this page helpful?