REST API
Direct REST API access for integrating INK into any application or language.
Base URL
https://api.inkai.ph/v1
Authentication
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Endpoints
Generate Content
POST /generate
Create new content from a prompt.
Request
curl -X POST https://api.inkai.ph/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Write a product description for a smart watch",
"template": "marketing-copy",
"options": {
"tone": "professional",
"length": "medium"
}
}'
Response
{
"success": true,
"data": {
"id": "gen_abc123",
"content": "Generated content here...",
"tokens_used": 450,
"template": "marketing-copy",
"created_at": "2025-01-03T12:00:00Z"
}
}
Refine Content
POST /refine
Improve or modify existing content.
Request
curl -X POST https://api.inkai.ph/v1/refine \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Original content to refine...",
"instructions": "Make it more concise and professional"
}'
List Templates
GET /templates
Get available templates.
Request
curl https://api.inkai.ph/v1/templates \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": [
{
"id": "market-analysis",
"name": "Market Analysis",
"description": "Comprehensive market research format"
},
{
"id": "strategic-brief",
"name": "Strategic Brief",
"description": "Executive strategy documents"
}
]
}
Error Responses
Error Format
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message"
}
}
Common Error Codes
| Code | Status | Description |
|------|--------|-------------|
| UNAUTHORIZED | 401 | Invalid or missing API key |
| FORBIDDEN | 403 | Insufficient permissions |
| NOT_FOUND | 404 | Resource not found |
| RATE_LIMIT_EXCEEDED | 429 | Too many requests |
| VALIDATION_ERROR | 400 | Invalid request parameters |
| INTERNAL_ERROR | 500 | Server error |
Rate Limiting
Rate limit headers are included in responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1704288000
Pagination
List endpoints support pagination:
GET /templates?page=1&limit=20
Response includes pagination metadata:
{
"success": true,
"data": [...],
"meta": {
"page": 1,
"limit": 20,
"total": 45,
"pages": 3
}
}
Next Steps
- Review Authentication
- Check Rate Limits
- Explore Examples