AstraCMS
Categories

Get a single category

Get a single category by slug or ID, optionally including related posts

GET
/v2/categories/{identifier}

Authorization

ApiKeyAuth

AuthorizationBearer <token>

API key for V2 endpoints. Use format: Bearer {your_api_key}. Get your key from the AstraCMS dashboard.

In: header

Path Parameters

identifier*string

Category slug or ID

Query Parameters

limit?string

Number of posts per page when including posts

Default"10"
page?string

Page number for pagination when including posts

Default"1"
include?string

Related resources to include (e.g., posts)

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.astracms.dev/v2/categories/technology"
{
  "id": "clx2k4m6n8p0r2t4v6x8z",
  "name": "Technology",
  "slug": "technology",
  "description": "Tech articles and news",
  "count": {
    "posts": 42
  }
}
{
  "error": "Bad Request",
  "details": null,
  "message": "Additional error context"
}
{
  "error": "Unauthorized",
  "message": "Missing or invalid API key"
}
{
  "error": "Forbidden",
  "message": "Insufficient permissions for this resource"
}
{
  "error": "Bad Request",
  "details": null,
  "message": "Additional error context"
}
{
  "error": "Too Many Requests",
  "message": "Rate limit exceeded. Please try again later.",
  "retryAfter": 60
}
{
  "error": "Bad Request",
  "details": null,
  "message": "Additional error context"
}

Last updated on