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 Response
{ "error": "description of what went wrong" }

Authentication

All protected endpoints require an API key passed in the X-API-Key header.

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

GET /workflows

List all workflows available to your account. Each workflow has a slug used in the process endpoint.

Example
curl https://apiai.me/api/workflows \
  -H "X-API-Key: ak_xxxx"
Response 200
[
  {
    "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

POST /process/{slug}

Send an image through a workflow. Accepts multipart/form-data. Returns the processed image as binary data.

Parameters

FieldTypeDescription
image requiredfileThe image to process (PNG, JPG, WebP)
prompt optionalstringText prompt (for AI generation workflows)
{param} optionalstringAny workflow-specific parameter
Example
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:

HeaderDescription
X-Processing-TimeServer processing time
X-CostCost charged for this request

Pipelines

POST /pipeline/{slug}

Execute a multi-step pipeline. Pipelines chain multiple workflows together — the output of each step feeds into the next.

Parameters

FieldTypeDescription
image requiredfileThe input image
Example
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 /usage

Get aggregated usage statistics for your account.

Example
curl https://apiai.me/api/usage \
  -H "X-API-Key: ak_xxxx"

Logs

GET /logs

Retrieve recent request logs for your account.

Query Parameters

ParamTypeDescription
limit optionalintNumber of logs to return (default 50, max 200)
Example
curl https://apiai.me/api/logs?limit=20 \
  -H "X-API-Key: ak_xxxx"

SSE Events

GET /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.

Example (fetch)
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

GET /flows

List your custom flows (user-created step chains).

Example
curl https://apiai.me/api/flows \
  -H "X-API-Key: ak_xxxx"

Create Flow

POST /flows

Create a custom flow by chaining existing workflows. You must have access to all referenced workflows.

Request Body

FieldTypeDescription
name requiredstringDisplay name for the flow
slug requiredstringURL-safe slug (e.g. my-pipeline)
workflow_ids requiredint[]Ordered list of workflow IDs (from /workflows)
Example
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

POST /flow/{slug}

Run a custom flow. The image passes through each step sequentially.

FieldTypeDescription
image requiredfileThe input image
Example
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 /flows/{id}

Delete a custom flow by its ID.

Example
curl -X DELETE https://apiai.me/api/flows/42 \
  -H "X-API-Key: ak_xxxx"