Playgun API
Articles

Get Article

Retrieve a specific article with its content

Get Article

Retrieves a specific published article by ID, including its full content.

GET /api/v1/parable/articles/:id

Parameters

ParameterTypeDescription
idstringThe article ID

Authentication

Requires a valid API key with read:articles permission.

Authorization: Bearer pk_live_your_api_key

Response

{
  "data": {
    "article": {
      "id": "abc123xyz",
      "title": "My First Article",
      "subtitle": "An introduction to writing",
      "coverImage": "https://pub-playgun.r2.dev/images/cover.jpg",
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T14:30:00.000Z"
    },
    "body": [
      {
        "type": "paragraph",
        "content": [
          { "type": "text", "text": "Hello " },
          { "type": "text", "text": "world", "marks": ["bold"] }
        ]
      },
      {
        "type": "heading",
        "level": 2,
        "content": [
          { "type": "text", "text": "Getting Started" }
        ]
      },
      {
        "type": "code",
        "language": "typescript",
        "code": "const greeting = 'Hello';"
      }
    ]
  }
}

Response Fields

Article Object

FieldTypeDescription
idstringUnique article identifier
titlestringArticle title
subtitlestring?Optional subtitle
coverImagestring?URL to cover image
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last update timestamp

Body Array

The body field contains an array of content blocks. See the Content Format reference for details on each block type.

Example Request

cURL

curl -X GET \
  -H "Authorization: Bearer pk_live_your_api_key" \
  https://aware-squirrel-935.convex.site/api/v1/parable/articles/abc123xyz

JavaScript

const articleId = "abc123xyz";
const response = await fetch(
  `https://aware-squirrel-935.convex.site/api/v1/parable/articles/${articleId}`,
  {
    headers: {
      Authorization: `Bearer ${process.env.PARABLE_API_KEY}`,
    },
  }
);

const { data } = await response.json();
console.log(data.article.title);
console.log(`${data.body.length} blocks`);

Error Responses

Article Not Found

{
  "error": "Article not found"
}

This error is returned when:

  • The article ID doesn't exist
  • The article is not published (still a draft or idea)
  • The article belongs to a different user