Toast
API Reference

Content

CRUD operations for site content, scoped to the authenticated user's site.

List content for site

GET
/api/content

Retrieves content items for the authenticated user's site with pagination, sorting, and filtering.

Query Parameters

page?integer

Page number

Default1
Range1 <= value
limit?integer

Items per page

Default20
Range1 <= value <= 100
sort?string

Sort field

Default"updated_at"
Value in"created_at" | "updated_at" | "published_at" | "title"
status?string

Filter by status

Value in"draft" | "published"
type?string

Filter by content type

Value in"post" | "page"

Response Body

application/json

application/json

curl -X GET "https://loading/api/content"
{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
      "authorId": "string",
      "title": "string",
      "slug": "string",
      "body": {},
      "status": "draft",
      "contentType": "post",
      "excerpt": "string",
      "featureImage": "http://example.com",
      "metaTitle": "string",
      "metaDescription": "string",
      "ogImage": "http://example.com",
      "publishedAt": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "total": 0,
    "page": 0,
    "limit": 0,
    "pages": 0
  }
}
{
  "error": "string"
}

Create content

POST
/api/content

Creates a new content item for the authenticated user's site. Slug is auto-generated from title if not provided.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/api/content" \  -H "Content-Type: application/json" \  -d '{    "title": "string"  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
  "authorId": "string",
  "title": "string",
  "slug": "string",
  "body": {},
  "status": "draft",
  "contentType": "post",
  "excerpt": "string",
  "featureImage": "http://example.com",
  "metaTitle": "string",
  "metaDescription": "string",
  "ogImage": "http://example.com",
  "publishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string",
  "details": [
    {
      "code": "string",
      "message": "string",
      "path": [
        "string"
      ]
    }
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}
{
  "error": "string"
}

Get content by ID

GET
/api/content/{id}

Retrieves a single content item by ID for the authenticated user's site.

Path Parameters

id*string

Content ID

Formatuuid

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
  "authorId": "string",
  "title": "string",
  "slug": "string",
  "body": {},
  "status": "draft",
  "contentType": "post",
  "excerpt": "string",
  "featureImage": "http://example.com",
  "metaTitle": "string",
  "metaDescription": "string",
  "ogImage": "http://example.com",
  "publishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string"
}
{
  "error": "string"
}

Update content

PUT
/api/content/{id}

Updates an existing content item for the authenticated user's site.

Path Parameters

id*string

Content ID

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
  "authorId": "string",
  "title": "string",
  "slug": "string",
  "body": {},
  "status": "draft",
  "contentType": "post",
  "excerpt": "string",
  "featureImage": "http://example.com",
  "metaTitle": "string",
  "metaDescription": "string",
  "ogImage": "http://example.com",
  "publishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string",
  "details": [
    {
      "code": "string",
      "message": "string",
      "path": [
        "string"
      ]
    }
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}
{
  "error": "string"
}

Delete content

DELETE
/api/content/{id}

Deletes a content item for the authenticated user's site. This action cannot be undone.

Path Parameters

id*string

Content ID

Formatuuid

Response Body

application/json

application/json

curl -X DELETE "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08"
Empty
{
  "error": "string"
}
{
  "error": "string"
}

Publish content

POST
/api/content/{id}/publish

Publishes a content item, setting status to published and publishedAt timestamp.

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/publish"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
  "authorId": "string",
  "title": "string",
  "slug": "string",
  "body": {},
  "status": "draft",
  "contentType": "post",
  "excerpt": "string",
  "featureImage": "http://example.com",
  "metaTitle": "string",
  "metaDescription": "string",
  "ogImage": "http://example.com",
  "publishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string",
  "details": [
    {
      "code": "string",
      "message": "string",
      "path": [
        "string"
      ]
    }
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}

Unpublish content

POST
/api/content/{id}/unpublish

Unpublishes a content item, setting status back to draft.

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

application/json

curl -X POST "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/unpublish"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "siteId": "60189e9c-7d12-438c-b9ca-6998d9c364b1",
  "authorId": "string",
  "title": "string",
  "slug": "string",
  "body": {},
  "status": "draft",
  "contentType": "post",
  "excerpt": "string",
  "featureImage": "http://example.com",
  "metaTitle": "string",
  "metaDescription": "string",
  "ogImage": "http://example.com",
  "publishedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string"
}
{
  "error": "string"
}

List content versions

GET
/api/content/{id}/versions

Lists all version snapshots for a content item with pagination.

Path Parameters

id*string
Formatuuid

Query Parameters

page?integer
Default1
Range1 <= value
limit?integer
Default20
Range1 <= value <= 100

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/versions"
{
  "versions": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "contentId": "21aa1683-ca25-4edf-bc18-01ad04a4821b",
      "version": 0,
      "title": "string",
      "body": {},
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "pagination": {
    "total": 0,
    "page": 0,
    "limit": 0,
    "pages": 0
  }
}
{
  "error": "string"
}
{
  "error": "string"
}

Create version snapshot

POST
/api/content/{id}/versions

Creates a new version snapshot of the current content state.

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

application/json

curl -X POST "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/versions"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "contentId": "21aa1683-ca25-4edf-bc18-01ad04a4821b",
  "version": 0,
  "title": "string",
  "body": {},
  "createdAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string"
}
{
  "error": "string"
}

Get specific version

GET
/api/content/{id}/versions/{version}

Retrieves a specific version snapshot of a content item.

Path Parameters

id*string
Formatuuid
version*integer
Range1 <= value

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/versions/1"
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "contentId": "21aa1683-ca25-4edf-bc18-01ad04a4821b",
  "version": 0,
  "title": "string",
  "body": {},
  "createdAt": "2019-08-24T14:15:22Z"
}
{
  "error": "string"
}
{
  "error": "string"
}

Restore version

POST
/api/content/{id}/versions/{version}/restore

Restores content to a previous version. Creates a snapshot of current state before restoring.

Path Parameters

id*string
Formatuuid
version*integer
Range1 <= value

Response Body

application/json

application/json

application/json

curl -X POST "https://loading/api/content/497f6eca-6276-4993-bfeb-53cbbbba6f08/versions/1/restore"
{
  "restored": true,
  "newVersion": 0
}
{
  "error": "string"
}
{
  "error": "string"
}