API Documentation | CaptionAI (latest)

Download OpenAPI specification:Download

License: proprietary

Welcome to the API documentation of CaptionAI.

Create a caption request

Add a caption request to the queue.

The caption request only generate a caption (alternate-text) for the image by default. You can expand the response to include description, seo-filename and tags by setting expand to true.

This request is processed asynchronously in the background, and results are available via GET /request/{job-id} endpoint. The {id} of the queued job is returned in the response header X-Job-Id of this request. You can also get this ID from the CaptionAI dashboard.

The credit is deducted from your account only when the request is successfully processed. You can use the job ID to fetch the response details via GET /request/{job-id} once they are available.

You can either pass publicly accessible location of the image or a base64 encoded image file. See request and response samples on the right section of this document for more details.

Most of the standard image formats are supported: jpeg, png, gif, webp, etc. Maximum allowed file size for this request is 10MB. The request is rate-limited based on your plan.

Authorizations:
bearerAuth
Request Body schema: application/json
image
string

A publicly downloadable image location or base64 encoded image string.

expand
boolean
Default: false

Whether to expand the caption to include description, seo-filename and tags.

sync
boolean
Default: false

When set to true, this option triggers an immediate, direct request instead of queuing the job. Please note that these direct request could get slow (timeout 30s) and is not recommended for production use.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "error": "string"
}

Fetch response details

Get SEO-friendly caption/alternate-text, description and other metadata of an image queued via POST /caption endpoint.

This endpoint can also be used to get response details for successful POST /alt and POST /categorize requests. Note that unsuccessful requests are not logged for these endpoints.

You can find job id in the response header X-Job-Id of your POST requests or on the CaptionAI dashboard. No credit is deducted from your account for this request. However, the request is rate-limited based on your plan.

See request and response examples for more details.

Authorizations:
bearerAuth
path Parameters
id
required
string

ID of the resource

Responses

Response Schema: application/json
One of
caption
string

The caption or alternate text of the image.

description
string

A few line of description for the image.

seo_filename
string

The proposed seo-friendly filename of the image.

tags
Array of strings

3 to 5 tags for the image.

Request samples

curl -X GET "https://api.captionai.co/v1/request/<job-id>" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json"

Response samples

Content type
application/json
Example
{
  • "caption": "string",
  • "description": "string",
  • "seo_filename": "string",
  • "tags": [
    ]
}

Categorize image

Classify image based on given categories.

The purpose of this endpoint is to classify images into predefined categories, providing a convenient way to categorize and organize your image data.

You can either pass the publicly accessible location of an image or a local path to an image file. Most of the standard image formats are supported: jpeg, png, gif, webp, etc. Maximum allowed file size for this request is 3MB.

Same as other endpoints, successful requests are logged and are available on the CaptionAI dashboard. A job ID is returned in the response header X-Job-Id for the successful requests. You can use this ID to fetch the response details via GET /request/{job-id} endpoint without exhausting your API credit. The request is rate-limited based on your plan.

See request and response examples for more details.

Authorizations:
bearerAuth
Request Body schema:
image
string

A publicly downloadable image location or base64 encoded image string.

categories
Array of strings

The categories to classify the image into.

Responses

Response Schema: application/json
Array
category
string

A category of the image.

relevance
number

The relevance of the category.

Request samples

Content type
{}

Response samples

Content type
application/json
[
  • {
    }
]