Skip to content

Create and fill editions by API

Three calls let a script or an agent work on an edition without the editor: read one, create a draft, and save its subject, preheader and slots. They run the editor’s own checks, and each change is recorded in your audit log under the key that made it. Scheduling and sending stay in the console.

A console API key holding publication:write, sent as Authorization: Bearer <key>. An owner issues it in the console; see Config as code. A signed-in console session with the same permission works too.

Each call is a request to your console, https://console.edgekit.ai:

Call Request
editions.get GET /api/trpc/editions.get?input=<URL-encoded {"json": {"id": "…"}}>
editions.create POST /api/trpc/editions.create, body {"json": {…}}
editions.save POST /api/trpc/editions.save, body {"json": {…}}

The answer is {"result": {"data": {"json": <answer>}}}. Timestamps in an answer are ISO-8601 strings.

Every answer is a value: {"ok": true, "edition": {…}}, or {"ok": false, "reason": "…", "message": "…"} with one sentence saying why. A request that does not match the shapes below, or a key without the permission, is an HTTP error instead.

editions.get takes {"id": "<edition id>"} and answers the edition as the editor reads it: its state, subject, preheader and send time, and each slot with its id, position, kind and content. A save names slots by those ids.

editions.create takes {"publicationId": "…", "sendAt": "2026-12-01T07:00:00+01:00"}: the send time as an ISO-8601 instant with its offset. The draft gets the publication’s slots and nothing in them. It is refused when the publication is not on a site you can reach, or another edition of it already has that send time.

Terminal window
curl -s https://console.edgekit.ai/api/trpc/editions.create \
-H "Authorization: Bearer $CONSOLE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"json": {"publicationId": "<publication id>", "sendAt": "2026-12-01T07:00:00+01:00"}}'

editions.save is the editor’s Save: send the edition’s whole subject, preheader and slots, as the editor would.

const response = await fetch(
'https://console.edgekit.ai/api/trpc/editions.save',
{
method: 'POST',
headers: {
authorization: `Bearer ${process.env.CONSOLE_API_KEY}`,
'content-type': 'application/json',
},
body: JSON.stringify({
json: {
id: editionId,
subject: 'Your morning in five minutes',
preheader: '',
slots: [{ id: introSlotId, content: introBlocks }],
},
}),
},
);
const answer = (await response.json()).result.data.json;
Field Holds
subject The edition’s subject. No Liquid.
preheader The text shown after the subject in most inboxes; "" for none.
slots Each rich-text slot’s content, by slot id: Portable Text blocks, as editions.get answers them.
curated Optional. Each curated slot’s stories, by slot id: contentItemId, and headline, summary, image and link, "" to show the story’s own.

A save is refused:

  • while someone has the edition open in the editor. Try again once they close it.
  • once sending has started. A scheduled edition can still be saved until then.
  • when it would change the edition’s sold ads. The refusal lists them in adsChanged; send the same save again with "acknowledgeAds": true to go ahead.
  • with the editor’s own sentence for anything else it refuses: an unknown slot, Liquid in the subject, an image the organization’s release cannot render yet.

Scheduling, sending, test sends, AI assists and deleting an edition. An agent fills a draft; a person sends it.

edgekit.ai