Management API

Categories

Read, update and delete categories.

Categories sort documents for your readers, like sections of a blog. A category can have a parent, so you can nest them. Its description goes to writers with every brief in it. Create categories with a category intent.

A category has an id, name, slug, description, the parent’s id in categoryId (or null) and its projectId.

Endpoints#

List categories#

GET/categories

Lists the project’s categories.

curl "https://api.pmkin.io/categories" \
-H "Authorization: Bearer $PMKIN_MANAGEMENT_TOKEN"
Response: 200 OK
[
{
"categoryId": null,
"description": "Guides to choosing and running a headless CMS.",
"id": "6701c3d4e5f6a7b8c9d0e1f2",
"name": "Headless CMS",
"projectId": "66f0b2c4d5e6f7a8b9c0d1e2",
"slug": "headless-cms"
},
{
"categoryId": "6701c3d4e5f6a7b8c9d0e1f2",
"description": "What headless CMS plans cost.",
"id": "6701c3d4e5f6a7b8c9d0e1f3",
"name": "Pricing",
"projectId": "66f0b2c4d5e6f7a8b9c0d1e2",
"slug": "pricing"
}
]

Get a category#

GET/categories/:id

Returns one category.

Path parameters
idstringrequired
Errors
NotFound404
curl "https://api.pmkin.io/categories/6701c3d4e5f6a7b8c9d0e1f2" \
-H "Authorization: Bearer $PMKIN_MANAGEMENT_TOKEN"
Response: 200 OK
{
"categoryId": null,
"description": "Guides to choosing and running a headless CMS.",
"id": "6701c3d4e5f6a7b8c9d0e1f2",
"name": "Headless CMS",
"projectId": "66f0b2c4d5e6f7a8b9c0d1e2",
"slug": "headless-cms"
}

Update a category#

PATCH/categories/:id

Replaces the category’s name, slug, description and parent. Send all of them: leaving out categoryId makes the category top-level.

Path parameters
idstringrequired
Body
namestringrequired
slugstringrequired
descriptionstringrequired
categoryIdstring
Errors
BadRequest422
NotFound404
curl -X PATCH "https://api.pmkin.io/categories/6701c3d4e5f6a7b8c9d0e1f2" \
-H "Authorization: Bearer $PMKIN_MANAGEMENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Guides to choosing and running a headless CMS.",
"name": "Headless CMS",
"slug": "headless-cms"
}'
Response: 200 OK
{
"categoryId": null,
"description": "Guides to choosing and running a headless CMS.",
"id": "6701c3d4e5f6a7b8c9d0e1f2",
"name": "Headless CMS",
"projectId": "66f0b2c4d5e6f7a8b9c0d1e2",
"slug": "headless-cms"
}

Delete a category#

DELETE/categories/:id

Deletes the category and returns it. Its documents lose their category and its child categories become top-level.

Path parameters
idstringrequired
Errors
NotFound404
curl -X DELETE "https://api.pmkin.io/categories/6701c3d4e5f6a7b8c9d0e1f2" \
-H "Authorization: Bearer $PMKIN_MANAGEMENT_TOKEN"
Response: 200 OK
{
"categoryId": null,
"description": "Guides to choosing and running a headless CMS.",
"id": "6701c3d4e5f6a7b8c9d0e1f2",
"name": "Headless CMS",
"projectId": "66f0b2c4d5e6f7a8b9c0d1e2",
"slug": "headless-cms"
}