API

Campaigns & posts

What a campaign is, what a post is, and how they relate.

A campaign is what you create and send. A post is its public web version. This page explains the two words and where each lives in the API.

Campaigns

In Spoks a campaign is either an email campaign (built from content blocks) or an SMS campaign (plain text); deliveryChannel says which. An email campaign can also notify its recipients with an SMS teaser that links to the web version.

Campaigns are created and read with an API key. The API creates drafts: use Create draft to add one, change it with Update campaign while it is a draft, and publish or schedule it from the app. The list shows every campaign with its status: draft, scheduled, published or failed.

Editing drafts

Create, get and update return the campaign with a hash that changes with each save, also sent as the ETag header; the list leaves it out. Send it as If-Match when updating: if someone changed the campaign in the meantime you get a 412 with the current hash instead of overwriting their change. Omit the header to overwrite regardless.

Omitted fields keep their values, while blocks and recipients.segmentIds replace the whole list. Blocks made in the app that the API cannot express come back as type unsupported and are lost if you send blocks. The delivery channel cannot be changed after creation. Only drafts can be updated; anything else answers 409. editorUrl opens the draft in the app.

Posts

A post is the public web version of an email campaign. Every email campaign gets one, so campaigns can live on the web and be embedded on websites.

Posts need no API key. Use the posts endpoint to read the published web versions, for example from an embed.

The two surfaces

GroupWhat it isAuth
CampaignsCreate and edit drafts, read delivery channel, status and contentAPI key
PostsThe public web versions, powering embedsNone

On this page