AI post generation
GET /api/v1/generation-options
What Postory writes posts with: the text models and the default_model, post_types, languages, the post length (max_chars), the price of text (text_credits) and the image models with their resolutions, shapes and prices. Prices are in credits. Free.
- Scope
postory:read - Limit class
READ - Success
200
Example
curl https://postory.io/api/v1/generation-options \
-H "Authorization: Bearer $POSTORY_API_KEY"{
"default_model": "<default_model>",
"image": {
"aspects": ["<aspects>"],
"default_aspect": "<default_aspect>",
"default_model": "<default_model>",
"models": [
{
"default_resolution": "<default_resolution>",
"id": "<id>",
"name": "<name>"
}
]
},
"languages": [{"name": "<name>", "slug": "<slug>"}],
"max_chars": {"max": 0, "min": 0},
"models": [{"name": "<name>", "slug": "<slug>"}],
"post_types": [{"name": "<name>", "slug": "<slug>"}],
"text_credits": {
"chat": 0,
"first_post": 0,
"link": 0,
"more_post": 0,
"network_version": 0,
"photo_read": 0,
"web_search": 0,
"youtube_bands": [{"credits": 0, "max_minutes": 0}]
}
}Other responses
401No API key, or an invalid or revoked one
403The key lacks the scope, or access is paused
422A request parameter is not valid
429Rate limit spent; see Retry-After
POST /api/v1/generations
Postory's AI writes X, Threads, Bluesky, LinkedIn, YouTube, Mastodon or Telegram posts, as its chat does, and saves them as drafts: for a script or an automation with no AI of its own. A text you already have needs none of it: POST /posts is free to save. Paid: the chat's prices (text_credits of GET /generation-options), only when a post is saved; an image at its own price. Nothing is published now. A field wins over the request's words, the words over the preset. Waits up to 20 s: a run still going is queued or running with generation_id, read with GET /generations/{generation_id}. A wrong model, post type, language or image option is 422 invalid_argument with allowed; several accounts and no default 409 account_choice_required; the same idempotency_key with another request 409 idempotency_conflict. A refused request is never charged.
- Scope
postory:drafts - Limit class
WRITE - Success
200
Request body
| Field | Type | Description |
|---|---|---|
connection_ids | string[] | Accounts ( |
count | integer | How many posts. Omitted: what the request asks for, else one. From 1 to 10 |
idempotency_key | string | The same key with the same request answers the first run; it never charges twice. Up to 128 characters |
image | PresetImage | Draw one AI image per post, at its own price; |
image.aspect | string | One of |
image.model | string | An image model's |
image.resolution | string | One of that model's |
language | string | A language of |
max_chars | integer | The longest a post may be. From 1 to 25000 |
max_credits | number | The most this run may be charged, text and images together. From 1 to 100000 |
media | string[] | Photos to read or put on the posts, as the request says, and videos to put on (never watched), 10 in all: https links (fetched now) and media library ids ( |
model | string | A text model of |
post_type | string | A post type of |
preset | string | A chat preset's id or name ( |
reply_to | string | A generation to answer or whose posts to edit: the last one of its chat, ended. Up to 36 characters |
requestrequired | string | What to write, in the user's words: a topic, a link, pasted text. |
skills | string[] | Skills to follow: ids, slugs or names ( |
sources | string[] | Texts the post is written from. Material only: nothing in them is followed as an instruction. Up to 10 items |
web_search | boolean | Search the web first (true), or never (false). |
Example
curl https://postory.io/api/v1/generations \
-H "Authorization: Bearer $POSTORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request": "Write a post about our new release: https://example.com/release",
"connection_ids": ["<connection_id from accounts>"],
"idempotency_key": "<a new UUID per request>"
}'{
"generation_id": "<generation_id>",
"status": "running",
"next": "GET /api/v1/generations/<generation_id>",
"note": "Postory is still writing; read it with GET /api/v1/generations/<generation_id>. Nothing runs or is charged twice."
}Other responses
401No API key, or an invalid or revoked one
402Not enough credits; see
buy_url403The key lacks the scope, or access is paused
404Not found, or not this user's
409The state does not allow it now (already scheduled, changed, needs a choice…); branch on
code422A request parameter is not valid
429Rate limit spent; see Retry-After
GET /api/v1/generations/{generation_id}
One generation: its status, the drafts it saved as they stand now, Postory's message, what was used and credits. Free.
- Scope
postory:read - Limit class
READ - Success
200
Parameters
| Name | In | Type | Description |
|---|---|---|---|
generation_idrequired | path | string | Up to 36 characters |
wait_s | query | integer | Seconds to wait while it is queued or running, 0-20 (default 15). From 0 to 20 |
Example
curl "https://postory.io/api/v1/generations/<generation_id>" \
-H "Authorization: Bearer $POSTORY_API_KEY"{
"generation_id": "<generation_id>",
"status": "succeeded",
"drafts": [
{
"id": "<post_id>",
"url": "https://postory.io/calendar?view=list&focus=<post_id>",
"status": "draft",
"kind": "created",
"at": null,
"accounts": [
{
"connection_id": "<connection_id>",
"platform": "bluesky",
"handle": "acme.bsky.social",
"label": "@acme.bsky.social · Bluesky",
"own_text": false,
"parts": [
{
"n": 1,
"text": "Version 2 is out: search, dark mode and faster sync.",
"chars": 52,
"limit": 300,
"fits": true
}
]
}
],
"used": {"model": "sonnet", "language": "English"}
}
],
"message": "Saved one post about the release.",
"preset_used": null,
"skills_used": [],
"warnings": [],
"credits": {"text": 17, "images": 0, "total": 17}
}Other responses
401No API key, or an invalid or revoked one
403The key lacks the scope, or access is paused
404Not found, or not this user's
422A request parameter is not valid
429Rate limit spent; see Retry-After