Alt text generator API
Upload an image and get alt text for screen reader users, with a shorter alternative, or write your own with the checklist. We don't keep your image.
- Endpoint:
POST https://postboost.co/app/api/tools/alt-text-generator(operationIdgenerateAltText) - Web tool: postboost.co/tools/alt-text-generator
- Token: required. A new generation spends 1 AI credit of the workspace you name (or your active workspace); a repeated identical request is answered from the cache for free. A scoped API key needs the
aiability and pays with its own workspace - MCP: tool
generate-alt-textonhttps://postboost.co/mcp/tools(listed only with a token)
Request
| Field | Type | Default | Description |
|---|---|---|---|
image_base64 | string | The image itself, base64-encoded without a data: prefix: JPEG, PNG, WebP or GIF (first frame), up to 5 MB. On the API you can upload the file as image in a multipart/form-data body instead. A request to the MCP server at /mcp/tools may be at most 1.5 MB, so send larger images as image_url there. Send this or image_url. | |
image_url | string | A public https URL of the image, up to 5 MB. Fetched once and never stored; each fetch also counts against the daily limit of the tools that load a URL. Send this or image_base64. | |
context | string | Optional: what the post is about, so the text describes what matters for it. | |
length | string: short, detailed | "short" | short (up to 125 characters) or detailed (up to 250). |
workspace | string | UUID of the workspace whose AI credits pay for the call. Default: your active workspace (a scoped API key: its own workspace). |
Call it
- curl
- Python
- Node.js
- PHP
- Go
- Ruby
- Java
- C#
- Rust
- CLI
curl -X POST https://postboost.co/app/api/tools/alt-text-generator \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"image_url":"https://example.com/images/sourdough.jpg","context":"our bakery opens on Saturday","length":"short"}'
from postboost import ApiClient, Configuration
from postboost.api.free_tools_api import FreeToolsApi
from postboost.models import FreeToolGenerateAltTextRequest
with ApiClient(Configuration()) as client:
api = FreeToolsApi(client)
result = api.generate_alt_text(FreeToolGenerateAltTextRequest.from_dict({"image_url": "https://example.com/images/sourdough.jpg", "context": "our bakery opens on Saturday", "length": "short"}))
print(result.to_dict())
import { FreeToolsApi } from 'postboost';
const api = new FreeToolsApi();
const { body } = await api.generateAltText({ imageUrl: "https://example.com/images/sourdough.jpg", context: "our bakery opens on Saturday", length: "short" });
console.log(body);
use PostBoostClient\Api\FreeToolsApi;
use PostBoostClient\Model\FreeToolGenerateAltTextRequest;
$api = new FreeToolsApi(new GuzzleHttp\Client());
$result = $api->generateAltText(new FreeToolGenerateAltTextRequest(['image_url' => "https://example.com/images/sourdough.jpg", 'context' => "our bakery opens on Saturday", 'length' => "short"]));
echo $result;
import (
"context"
"encoding/json"
"fmt"
postboost "github.com/postboost-co/postboost-go"
)
var request postboost.FreeToolGenerateAltTextRequest
if err := json.Unmarshal([]byte(`{"image_url":"https://example.com/images/sourdough.jpg","context":"our bakery opens on Saturday","length":"short"}`), &request); err != nil {
panic(err)
}
client := postboost.NewAPIClient(postboost.NewConfiguration())
result, _, err := client.FreeToolsAPI.GenerateAltText(context.Background()).FreeToolGenerateAltTextRequest(request).Execute()
fmt.Println(result, err)
require 'postboost'
api = PostBoost::FreeToolsApi.new
result = api.generate_alt_text(PostBoost::FreeToolGenerateAltTextRequest.new({ image_url: "https://example.com/images/sourdough.jpg", context: "our bakery opens on Saturday", length: "short" }))
puts result.to_hash
import com.postboost.ApiClient;
import com.postboost.api.FreeToolsApi;
import com.postboost.model.FreeToolGenerateAltTextRequest;
import com.postboost.model.FreeToolGenerateAltTextResponse;
FreeToolsApi api = new FreeToolsApi(new ApiClient());
FreeToolGenerateAltTextRequest request = FreeToolGenerateAltTextRequest.fromJson("{\"image_url\":\"https://example.com/images/sourdough.jpg\",\"context\":\"our bakery opens on Saturday\",\"length\":\"short\"}");
FreeToolGenerateAltTextResponse result = api.generateAltText(request);
System.out.println(result.toJson());
using Newtonsoft.Json;
using PostBoost.Client.Api;
using PostBoost.Client.Client;
using PostBoost.Client.Model;
var api = new FreeToolsApi(new Configuration());
var request = JsonConvert.DeserializeObject<FreeToolGenerateAltTextRequest>(@"{""image_url"":""https://example.com/images/sourdough.jpg"",""context"":""our bakery opens on Saturday"",""length"":""short""}");
var result = await api.GenerateAltTextAsync(request);
Console.WriteLine(result.ToJson());
use postboost::apis::configuration::Configuration;
use postboost::apis::free_tools_api;
use postboost::models::FreeToolGenerateAltTextRequest;
let config = Configuration::new();
let request: FreeToolGenerateAltTextRequest = serde_json::from_str(r##"{"image_url":"https://example.com/images/sourdough.jpg","context":"our bakery opens on Saturday","length":"short"}"##)?;
let result = free_tools_api::generate_alt_text(&config, request).await?;
println!("{:?}", result);
echo '{"image_url":"https://example.com/images/sourdough.jpg","context":"our bakery opens on Saturday","length":"short"}' | ./postboost-cli --content-type application/json generateAltText -
This tool needs a token: send Authorization: Bearer YOUR_API_TOKEN as a default header (how, per SDK).
Response
{
"alt_text": "A golden sourdough loaf cooling on a wire rack in a bakery window",
"short_alt_text": "Sourdough loaf on a cooling rack",
"credits_spent": 1,
"cached": false
}
With MCP
Connect https://postboost.co/mcp/tools (setup) and ask, for example: Write alt text for an image with AI (needs a token, spends AI credits) with the PostBoost generate-alt-text tool.
MCP requests are capped at 128 KB without a token and 1.5 MB with one; send bigger requests to the API (7 MB).
Errors
| Status | When |
|---|---|
401 | No token, or an invalid one. The body has register_url to create a free account. |
403 | workspace is not a workspace you belong to, or your account has no workspace, or a scoped API key lacks the ai ability or is bound to another workspace (code: insufficient_scope). |
413 | The JSON body is larger than 7 MB. |
422 | A field is invalid; the body lists the errors per field. |
429 | The workspace has no AI credits left this billing cycle (code: ai_credits_exhausted, upgrade_url), or the per-minute limit is reached. |
502 | The AI provider failed or timed out. No credit was spent. |
503 | AI tools are switched off right now. |