API Documentation
Everything you need to integrate apiai.me into your application. Process images through AI workflows with a single API call.
Overview
apiai.me provides a REST API for image processing through pre-configured AI workflows. Each workflow exposes a slug-based endpoint that accepts an image and returns a processed result.
All API responses are JSON unless the endpoint returns binary data (images). Errors follow a consistent format:
{ "error": "description of what went wrong" }
Authentication
All protected endpoints require an API key passed in the X-API-Key header.
X-API-Key: your_api_key_here
You can find your API key in the Dashboard under the API Keys page. If your key is compromised, regenerate it immediately — the old key will stop working.
Base URL
https://apiai.me/api
All endpoint paths below are relative to this base URL.
List Workflows
List all workflows available to your account. Each workflow has a slug used in the process endpoint.
curl https://apiai.me/api/workflows \ -H "X-API-Key: ak_xxxx"
[
{
"id": 7,
"slug": "greyscale",
"name": "Greyscale",
"description": "Convert image to greyscale",
"endpoint": "/api/process/greyscale",
"method": "POST",
"type": "workflow",
"params": [ ... ]
},
{
"id": 3,
"slug": "logo-digitalize",
"name": "Logo Digitalize",
"description": "Multi-step logo pipeline",
"endpoint": "/api/pipeline/logo-digitalize",
"method": "POST",
"type": "pipeline",
"params": []
}
]
The list includes both individual workflows (type: "workflow") and admin-configured pipelines (type: "pipeline"). Use the endpoint field to determine the correct URL to call.
Process Image
Send an image through a workflow. Accepts multipart/form-data. Returns the processed image as binary data.
Parameters
| Field | Type | Description |
|---|---|---|
| image required | file | The image to process (PNG, JPG, WebP) |
| prompt optional | string | Text prompt (for AI generation workflows) |
| {param} optional | string | Any workflow-specific parameter |
curl -X POST https://apiai.me/api/process/greyscale \ -H "X-API-Key: ak_xxxx" \ -F "image=@photo.png" \ --output result.png
The response is the processed image binary with the appropriate Content-Type header. Response headers also include:
| Header | Description |
|---|---|
| X-Processing-Time | Server processing time |
| X-Cost | Cost charged for this request |
Pipelines
Execute a multi-step pipeline. Pipelines chain multiple workflows together — the output of each step feeds into the next.
Parameters
| Field | Type | Description |
|---|---|---|
| image required | file | The input image |
curl -X POST https://apiai.me/api/pipeline/logo-digitalize \ -H "X-API-Key: ak_xxxx" \ -F "image=@logo.png" \ --output result.png
Usage
Get aggregated usage statistics for your account.
curl https://apiai.me/api/usage \ -H "X-API-Key: ak_xxxx"
Logs
Retrieve recent request logs for your account.
Query Parameters
| Param | Type | Description |
|---|---|---|
| limit optional | int | Number of logs to return (default 50, max 200) |
curl https://apiai.me/api/logs?limit=20 \ -H "X-API-Key: ak_xxxx"
SSE Events
Server-Sent Events stream. Pushes real-time updates (new logs, usage changes) to connected clients. Authentication is via the X-API-Key header.
Note: the browser EventSource API does not support custom headers. Use fetch() with a readable stream, or pass the key via a proxy.
const resp = await fetch('/api/events', {
headers: { 'X-API-Key': 'ak_xxxx' }
});
const reader = resp.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
console.log(decoder.decode(value));
}
List Flows
List your custom flows (user-created step chains).
curl https://apiai.me/api/flows \ -H "X-API-Key: ak_xxxx"
Create Flow
Create a custom flow by chaining existing workflows. You must have access to all referenced workflows.
Request Body
| Field | Type | Description |
|---|---|---|
| name required | string | Display name for the flow |
| slug required | string | URL-safe slug (e.g. my-pipeline) |
| workflow_ids required | int[] | Ordered list of workflow IDs (from /workflows) |
curl -X POST https://apiai.me/api/flows \
-H "X-API-Key: ak_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "My Pipeline",
"slug": "my-pipeline",
"workflow_ids": [3, 5]
}'
Execute Flow
Run a custom flow. The image passes through each step sequentially.
| Field | Type | Description |
|---|---|---|
| image required | file | The input image |
curl -X POST https://apiai.me/api/flow/my-pipeline \ -H "X-API-Key: ak_xxxx" \ -F "image=@input.png" \ --output result.png
Delete Flow
Delete a custom flow by its ID.
curl -X DELETE https://apiai.me/api/flows/42 \ -H "X-API-Key: ak_xxxx"