Plain fetch
For any language or framework: the Delivery API is a GET with your key. No SDK.
const res = await fetch(
`https://pluma.so/api/v1/spaces/${process.env.PLUMA_SPACE}/entries?content_type=event&order=fields.startsAt&rich_text=html`,
{ headers: { Authorization: `Bearer ${process.env.PLUMA_DELIVERY_KEY}` } }
);
if (!res.ok) throw new Error((await res.json()).error.message);
const { items } = await res.json();
for (const event of items) console.log(event.fields.title, event.fields.startsAt);
- The key goes on the server or in the build, never in code that runs in the browser:
PLUMA_DELIVERY_KEYas an environment variable. rich_text=htmlgives you long text already as HTML;markdownif your site converts it; without the parameter, the JSON blocks.- References and images in the same response:
include=1brings them inincludes.Entryandincludes.Asset. See Delivery API. - Pagination: up to 1000 per request with
limit; the rest withskip.totalsays how many there are. - Cache: with a
deliverykey, responses come with anETag. SendIf-None-Matchand, if nothing changed, you get a304with no body. - Errors: always
{ "error": { "code", "message", "fix", "doc_url" } }. See Errors.