Skip to content

Publishing ​

Resources in Diggama have a publication state (draft, scheduled or published) controlled by the published_at field.

Draft vs published ​

Statepublished_atVisible with view abilityVisible with preview ability
DraftnullNoYes
ScheduledA date in the futureNoYes
PublishedA date now or in the pastYesYes

A token with view (and not preview) only sees published resources, on the list, get and export endpoints. Use a preview token to include drafts and scheduled resources (useful for staging environments and content previews).

Publishing on creation ​

Set published_at when creating a resource to publish it immediately:

json
{
  "attributes": { "title": "My post", "slug": "my-post" },
  "published_at": "2026-02-07T12:00:00Z"
}

Omit published_at or set it to null to create as a draft. Setting it needs no extra ability: the create ability is enough.

Publishing an existing resource ​

Use a PATCH request to publish or unpublish a single resource:

bash
# Publish
curl -X PATCH "https://api.diggama.com/v2/resources/posts/gKqv6dx6pBk9" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{ "published_at": "2026-02-07T12:00:00Z" }'

# Unpublish (revert to draft)
curl -X PATCH "https://api.diggama.com/v2/resources/posts/gKqv6dx6pBk9" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{ "published_at": null }'

Both operations only require the update ability. The same applies to published_at in a PUT request.

Bulk publish / unpublish ​

Publish or unpublish multiple resources at once using bulk operations:

bash
# Bulk publish
curl -X POST "https://api.diggama.com/v2/resources/posts/bulk-publish" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["gKqv6dx6pBk9", "xR4mN2vBwQy7"] }'

Bulk publish and bulk unpublish require the publish ability.

Scheduled publishing ​

Set published_at to a future date to schedule a resource. Until that moment it is treated like a draft: view tokens don't see it, preview tokens do. Once the date passes, it is published: no further request is needed.

Static sites

If your site is built ahead of time, schedule a rebuild for the publication date: the API makes the resource visible, but your pages only change when you fetch again.

Filtering by publication status ​

Use the published filter on list endpoints:

GET /v2/resources/posts?filter[published]=true
GET /v2/resources/posts?filter[published]=false

filter[published]=true matches resources whose published_at is on or before today; false matches drafts and resources scheduled after today. This filter compares by calendar day, so a resource scheduled for later today already matches true.

See Filtering & search for more filter options.

Diggama Documentation