API pipeline: Write articles and posts

Index: API pipelines — index

Goal: write an article (long form) or a post (short; what announcement campaigns send to Telegram groups) in one or more languages, with images; choose who sees it; edit, archive or delete it.

Articles and posts take the same calls. Paths below say articles; use posts for a post.

Steps

1. Upload images (optional).

POST /v0/my/media/upload          multipart/form-data: up to 10 image files, 10 MB each
→ {"files": [{"hash": "9f2c…e41a", "format": "webp", "width": 1280, "height": 720, "size": 81234, …}]}

Images are stored as webp. Put each into the text as ![caption](media:<hash>.webp).

2. Create.

POST /v0/my/articles
Idempotency-Key: art-7d1e…
{"title": "Spring menu",
 "content": "Fresh pasta every day.\n\n![Our kitchen](media:9f2c…e41a.webp)",
 "language": "en",
 "project": "470000000000000001",
 "rubrics": ["<rubric nonce>"], "location": "<place nonce>",
 "translate_mode": "auto", "translate_langs": ["ru", "es"]}
→ {"nonce": "470000000000000042", "card_type": "article", "visibility": "Private",
   "canonical_lang": "en", "i18n": [{"lang": "en", "source": "authored", "title": "Spring menu", "content": "…"}], …}

3. Choose who sees it.

PATCH /v0/my/articles/470000000000000042
{"visibility": "Public", "publicity": "Everyone",
 "permissions": {"read": true, "write": false, "execute": false}}

4. Edit. PATCH /v0/my/articles/{nonce} with any of title, content, handle, project, rubrics, location; articles also take teaser (the short line shown on tiles).

5. Archive or restore. POST /v0/my/archive {"nonce": "470000000000000042", "archived": true} → it leaves your lists; GET /v0/my/articles?archived=true shows archived ones; "archived": false brings it back.

6. Delete. DELETE /v0/my/articles/{nonce} → {"success": true}. An article only by its owner; a post by anyone with write on it.

Read.

Behind

Rules (400)

API surface

Endpoint Purpose FE AI / oracle
POST /v0/my/media/upload Upload images yes yes
POST /v0/my/articles, POST /v0/my/posts Create yes yes
PATCH /v0/my/articles/{nonce}, PATCH /v0/my/posts/{nonce} Edit, publish, translate yes yes
POST /v0/my/archive Archive, restore yes yes
DELETE /v0/my/articles/{nonce}, DELETE /v0/my/posts/{nonce} Delete yes yes
GET /v0/my/articles, GET /v0/my/posts (+ /{nonce}) Yours yes yes
GET /v0/graph/articles, GET /v0/graph/posts (+ /{nonce}) Public yes yes

Mentioned