API Reference
REST endpoints, authentication, and response formats for the Craveva AI platform.
Base URL
https://ai.craveva.com/api/v1All API requests should be made to this base URL with the appropriate endpoint path.
Full API Reference: For complete API documentation with interactive playground, see API Reference.
Authentication
All API requests require authentication using an API key. Include your API key in the request headers.
Header Format
Authorization: Bearer YOUR_API_KEYReplace YOUR_API_KEY with your actual API key.
Getting Your API Key
- Log in to your Craveva AI dashboard
- Navigate to Account → API Keys
- Click Generate New Key
- Copy and store your API key securely (it's only shown once)
Security Note: Never commit API keys to version control or share them publicly. Store them securely using environment variables or secret management systems.
Request Format
HTTP Methods
GET- Retrieve resourcesPOST- Create resourcesPUT- Update resourcesPATCH- Partial updatesDELETE- Delete resources
Content-Type
All requests with a body must include:
Content-Type: application/jsonExample Request
curl -X GET https://api.craveva.ai/v1/agents \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"
Response Format
All API responses are returned in JSON format.
Success Response
{
"success": true,
"data": {
// Response data here
},
"meta": {
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "req_123456"
}
}Error Response
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {
// Additional error details
}
},
"meta": {
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "req_123456"
}
}HTTP Status Codes
200- Success201- Created400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Too Many Requests500- Internal Server Error
Endpoints
Agents
/agentsList all agents
/agents/{id}Get agent by ID
/agentsCreate a new agent
/agents/{id}Update an agent
/agents/{id}Delete an agent
/agents/{id}/executeExecute an agent query
Data Sources
/data-sourcesList all data sources
/data-sources/{id}Get data source by ID
/data-sourcesConnect a new data source
/data-sources/{id}/testTest data source connection
Deployments
/deploymentsList all deployments
/deploymentsCreate a new deployment
Usage & Billing
/billing/usageGet usage statistics
/billing/creditsGet current credit balance
Rate Limiting
API requests are rate-limited to ensure fair usage and system stability. Rate limits vary by plan:
- Free Plan: 100 requests/hour
- Pro Plan: 1,000 requests/hour
- Enterprise: Custom limits
When rate limits are exceeded, you'll receive a 429 Too Many Requests response.
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000 X-RateLimit-Remaining: 999 X-RateLimit-Reset: 1640995200
Pagination
List endpoints support pagination using query parameters:
page- Page number (default: 1)limit- Items per page (default: 20, max: 100)
Paginated responses include pagination metadata:
{
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 100,
"total_pages": 5,
"has_next": true,
"has_prev": false
}
}