Skip to content

Producer API

Your other services can use the console too. A service puts a card in front of you, such as an article to publish or a video to post, and takes your answer back. The cards are A2UI v1.0 surfaces with the basic catalog, the same as the steward's own, and they show on the board next to its cards.

The running example is a RetroSpeedLab article pipeline: it drafts an article about a game, asks the owner to publish it, and publishes only after Publish was pressed.

Authentication

Every call sends the console's producer key, CONSOLE_API_KEY:

Authorization: Bearer <CONSOLE_API_KEY>

A missing or wrong key gets 401 with {"error": "a valid API key is required"}. The producer API needs no Discord session, so it also works from a server-side job. All producers share the key and the list of actions; tell your cards apart by their ids.

Calls

Call Answer
PUT /api/cards/{card} 204; 422 with {"error": ...} for an invalid id or card
DELETE /api/cards/{card} 204, or 404 when no such card exists
GET /api/actions?wait=N 200 with the actions not yet taken: [{id, card, action}]
DELETE /api/actions/{id} 204, or 404 when no such action exists

Put a card

PUT /api/cards/{card} creates the card or replaces the one with the same id. The id is 1 to 64 lowercase letters, digits and hyphens, starting with a letter or digit, for example article-12. Every field of the body is required, and unknown fields are refused:

Field Type Meaning
title string, 1 to 200 characters The card's title; also the push's title
notify boolean true pushes A card from {title} waits for you to the owner's phone
components list, at least one A2UI v1.0 basic-catalog components. Their ids are unique identifiers (^[A-Za-z_][A-Za-z0-9_]*$), and one is named root
data object The surface's A2UI data model, for bindings; {} when none
{
  "title": "New article: The HUD clock",
  "notify": true,
  "components": [
    {"id": "root", "component": "Card", "child": "body"},
    {"id": "body", "component": "Column", "children": ["headline", "publish"]},
    {"id": "headline", "component": "Text", "text": "**The HUD clock** is ready to publish."},
    {
      "id": "publish",
      "component": "Button",
      "child": "publish_label",
      "variant": "primary",
      "action": {"event": {"name": "publish", "context": {"article": "12"}}}
    },
    {"id": "publish_label", "component": "Text", "text": "Publish"}
  ],
  "data": {}
}

Take the owner's actions

A press on a button of your card is kept until a producer takes it. GET /api/actions?wait=N long-polls: it answers as soon as at least one action waits, or after N seconds with []. wait is required, and the steward waits at most 25 seconds; wait=0 answers at once.

[
  {
    "id": 1,
    "card": "article-12",
    "action": {
      "name": "publish",
      "surfaceId": "producer-article-12",
      "sourceComponentId": "publish",
      "timestamp": "2026-12-03T10:00:00Z",
      "context": {"article": "12"}
    }
  }
]

action is the A2UI action message as the console sent it: the event's name and context from your button, the surface producer-{card} and the component that was pressed. The list holds every waiting action of every producer card, oldest first.

Mark it handled

DELETE /api/actions/{id} removes the action, so the next poll does not return it again. Delete it after you acted on it: an action you never delete comes back on every poll.

Take the card away

The card stays after a press. DELETE /api/cards/{card} removes it from the board, for example once the article is published.

A producer in Python

import httpx

CONSOLE = "https://steward.retrospeedlab.com"


def publish(article: str) -> None: ...


def serve(key: str, card: dict[str, object]) -> None:
    headers = {"Authorization": f"Bearer {key}"}
    with httpx.Client(base_url=CONSOLE, headers=headers, timeout=40) as console:
        console.put("/api/cards/article-12", json=card).raise_for_status()
        while True:
            for taken in console.get("/api/actions", params={"wait": 20}).raise_for_status().json():
                if taken["card"] != "article-12":
                    continue
                if taken["action"]["name"] == "publish":
                    publish(taken["action"]["context"]["article"])
                console.delete(f"/api/actions/{taken['id']}").raise_for_status()
                console.delete("/api/cards/article-12").raise_for_status()
                return

The cards and the waiting actions are kept in /workspace/producer-cards.json and /workspace/producer-actions.json, so they survive a restart of the steward.