Developer
API Documentation
Build powerful integrations with ContextFile.ai. Access your context files, skills, and tasks programmatically using our REST API.
Quick Links
Base URL
https://contextfile.aiAll API endpoints are relative to this base URL.
Authentication
ContextFile.ai supports three authentication methods. Choose the one that best fits your use case.
API Key
Simple bearer token authentication for server-to-server requests
Token prefix:
cf_OAuth 2.0
Industry-standard authorization for third-party applications
Token prefix:
cf_at_Session
Cookie-based authentication for browser requests
Token prefix:
N/AAuthentication Header
Authorization: Bearer YOUR_TOKENAPI Endpoints
GET
/api/v1/contextsList all context filesGET
/api/v1/contexts/:idGet a specific context filePOST
/api/v1/contextsCreate a new context filePATCH
/api/v1/contexts/:idUpdate a context fileDELETE
/api/v1/contexts/:idDelete a context fileExample Requests
List Context Files
curl https://contextfile.ai/api/v1/contexts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Create a Context File
curl -X POST https://contextfile.ai/api/v1/contexts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Context",
"content": "Your context content here...",
"description": "Optional description"
}'Execute a Skill
curl -X POST https://contextfile.ai/api/v1/skills/SKILL_ID/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Your input prompt",
"variables": { "key": "value" }
}'Response Format
Success Response
{
"data": { ... },
"meta": {
"total": 100,
"page": 1,
"limit": 20
}
}Error Response
{
"error": "error_code",
"message": "Human readable message"
}Error Codes
400Bad RequestInvalid request parameters
401UnauthorizedMissing or invalid authentication
403ForbiddenInsufficient permissions or scope
404Not FoundResource does not exist
429Rate LimitedToo many requests, slow down
500Server ErrorInternal server error
Rate Limiting
API requests are rate limited to ensure fair usage. Limits vary by plan:
100
requests/hour
Free1,000
requests/hour
Pro10,000
requests/hour
EnterpriseRate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
SDKs & Libraries
JavaScript / TypeScript
npm install @contextfile/sdkComing SoonREST API
Use any HTTP client to interact with our REST API. Works with curl, fetch, axios, and more.
Available NowAPI Integration Tips
- Use API keys for server-side integrations, OAuth for user-facing apps
- Always include proper error handling for API responses
- Implement exponential backoff for rate limit errors (429)
- Cache responses when appropriate to reduce API calls
- Use pagination for list endpoints to handle large datasets
- Store tokens securely and never expose them in client-side code