Delivery API

Queries

Every query, with its arguments and an example.

The delivery API has six queries: three for documents, one for the documents in a category and two for categories. They only ever return content from the project of your delivery key. Each example below runs as is: copy it, set PMKIN_API_KEY and swap in your own slug or id.

Combine queries in one request to fetch everything a page needs at once, for example a document and the list of categories for the navigation.

documentBySlug#

Fetches a published document by its slug. This is the query most pages of a website need: the slug comes from the URL.

Returns Document.

Arguments
slugString!required
curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query DocumentBySlug($slug: String!) {\n documentBySlug(slug: $slug) {\n id\n title\n subtitle\n html\n publishedAt\n metaTitle\n metaDescription\n category {\n name\n slug\n }\n }\n}",
"variables": {
"slug": "pumpkin-soup"
}
}
EOF
Response
{
"data": {
"documentBySlug": {
"category": {
"name": "Cooking",
"slug": "cooking"
},
"html": "<p>Roast the pumpkin first. It makes all the difference.</p>",
"id": "6650e5f3a1b2c3d4e5f60101",
"metaDescription": "A silky pumpkin soup in 30 minutes and one pot.",
"metaTitle": "Easy pumpkin soup recipe",
"publishedAt": "2026-10-01T08:00:00.000Z",
"subtitle": "Ready in 30 minutes",
"title": "The easiest pumpkin soup"
}
}
}

document#

Fetches a published document by its id. Returns null when there’s no published document with that id in your project.

Returns Document.

Arguments
idID!required
curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query Document($id: ID!) {\n document(id: $id) {\n id\n title\n markdown\n }\n}",
"variables": {
"id": "6650e5f3a1b2c3d4e5f60101"
}
}
EOF
Response
{
"data": {
"document": {
"id": "6650e5f3a1b2c3d4e5f60101",
"markdown": "Roast the pumpkin first. It makes all the difference.\n",
"title": "The easiest pumpkin soup"
}
}
}

documents#

Lists the project’s published documents, most recently published first. Fetch only the fields a list needs: leaving out html keeps the response small and the query cheap.

Returns [Document!]!.

Arguments
includeDraftsBoolean
limitInt
offsetInt
curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query Documents($limit: Int, $offset: Int) {\n documents(limit: $limit, offset: $offset) {\n id\n title\n slug\n excerpt\n publishedAt\n coverImage {\n url\n }\n }\n}",
"variables": {
"limit": 10,
"offset": 0
}
}
EOF
Response
{
"data": {
"documents": [
{
"coverImage": {
"url": "https://images.pmkin.io/6650e5f3/pumpkin-soup.webp"
},
"excerpt": "A silky soup that takes 30 minutes and one pot.",
"id": "6650e5f3a1b2c3d4e5f60101",
"publishedAt": "2026-10-01T08:00:00.000Z",
"slug": "pumpkin-soup",
"title": "The easiest pumpkin soup"
}
]
}
}

documentsInCategory#

Lists the published documents in one category, most recently published first. Returns an empty list for a category that isn’t in your project.

Returns [Document!]!.

Arguments
categoryIdID!required
includeDraftsBoolean
limitInt
offsetInt
curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query DocumentsInCategory($categoryId: ID!, $limit: Int) {\n documentsInCategory(categoryId: $categoryId, limit: $limit) {\n id\n title\n slug\n excerpt\n publishedAt\n coverImage {\n url\n }\n }\n}",
"variables": {
"categoryId": "6650e5f3a1b2c3d4e5f60001",
"limit": 10
}
}
EOF
Response
{
"data": {
"documentsInCategory": [
{
"coverImage": {
"url": "https://images.pmkin.io/6650e5f3/pumpkin-soup.webp"
},
"excerpt": "A silky soup that takes 30 minutes and one pot.",
"id": "6650e5f3a1b2c3d4e5f60101",
"publishedAt": "2026-10-01T08:00:00.000Z",
"slug": "pumpkin-soup",
"title": "The easiest pumpkin soup"
}
]
}
}

category#

Fetches a category by its id, or null when it isn’t in your project.

Returns Category.

Arguments
idID!required
curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query Category($id: ID!) {\n category(id: $id) {\n id\n name\n slug\n description\n category {\n name\n slug\n }\n }\n}",
"variables": {
"id": "6650e5f3a1b2c3d4e5f60001"
}
}
EOF
Response
{
"data": {
"category": {
"category": null,
"description": "Recipes, tips and stories from our kitchen.",
"id": "6650e5f3a1b2c3d4e5f60001",
"name": "Cooking",
"slug": "cooking"
}
}
}

categories#

Lists all of the project’s categories, by name. A subcategory’s category is its parent.

Returns [Category!]!.

curl https://content.pmkin.io/graphql \
--header "Authorization: Bearer $PMKIN_API_KEY" \
--header "Content-Type: application/json" \
--data @- <<'EOF'
{
"query": "query Categories {\n categories {\n id\n name\n slug\n description\n }\n}",
"variables": {}
}
EOF
Response
{
"data": {
"categories": [
{
"description": "Recipes, tips and stories from our kitchen.",
"id": "6650e5f3a1b2c3d4e5f60001",
"name": "Cooking",
"slug": "cooking"
}
]
}
}