List posts
Get a paginated list of published posts with filtering and search capabilities
Authorization
ApiKeyAuth API key for V2 endpoints. Use format: Bearer {your_api_key}. Get your key from the AstraCMS dashboard.
In: header
Query Parameters
Number of posts per page or 'all' for no pagination
"10"Page number for pagination
"1"Sort order by published date
"desc""asc" | "desc"Comma-separated category slugs to filter by
Comma-separated category slugs to exclude
Comma-separated tag slugs to filter by
Comma-separated tag slugs to exclude
Search query to filter posts by title or content
Content format (html or markdown)
"html" | "markdown"When true, omits the content field from posts to reduce payload size. Useful for list views where only metadata is needed.
"true" | "false"Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://api.astracms.dev/v2/posts"{
"posts": [
{
"id": "clx4b6d8f0h2j4l6n8p0r",
"slug": "my-first-post",
"title": "My First Blog Post",
"content": "<p>This is the content of my first blog post.</p>",
"featured": true,
"coverImage": "https://example.com/cover.jpg",
"description": "A brief description of the post",
"publishedAt": "2024-01-01T12:00:00Z",
"updatedAt": "2024-01-02T12:00:00Z",
"attribution": "Originally published on Medium",
"authors": [
{
"id": "clx1a2b3c4d5e6f7g8h9i",
"name": "John Doe",
"image": "https://example.com/avatar.jpg",
"bio": "Tech writer and developer",
"role": "Senior Developer",
"slug": "john-doe",
"socials": [
{
"url": "https://twitter.com/johndoe",
"platform": "twitter"
}
]
}
],
"category": {
"id": "clx2k4m6n8p0r2t4v6x8z",
"name": "Technology",
"slug": "technology",
"description": "Tech articles and news"
},
"tags": [
{
"id": "clx3y5a7c9e1g3i5k7m9o",
"name": "JavaScript",
"slug": "javascript",
"description": "JavaScript programming"
}
]
}
],
"pagination": {
"limit": 10,
"currentPage": 1,
"nextPage": 2,
"previousPage": null,
"totalPages": 5,
"totalItems": 48
}
}{
"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": "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