AstraCMS
Posts

Get a single post

Get a single post by slug or ID

GET
/v2/posts/{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

Post slug or ID

Query Parameters

format?string

Content format (html or markdown)

Value in"html" | "markdown"

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.astracms.dev/v2/posts/my-first-post"
{
  "post": {
    "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"
      }
    ]
  }
}
{
  "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