# Beulog Publishing API documentation

> Complete reference for connecting a website to Beulog: authentication, parameters, response fields, status codes, pagination, synchronization, and runnable request examples.

API version: 1.2  
Base URL: https://beulog.com/api/v1  
Last reviewed: 2026-10-11  
Canonical documentation: https://beulog.com/guides/api  
Arabic documentation: https://beulog.com/ar/guides/api

## Documentation resources

- [HTML guide](https://beulog.com/guides/api)
- [OpenAPI specification](https://beulog.com/integrations/openapi.json)
- [TypeScript client](https://beulog.com/integrations/beulog-client.ts)
- [Markdown reference](https://beulog.com/guides/api.md)
- [Documentation index for assistants](https://beulog.com/llms.txt)
- [Complete reference as plain text](https://beulog.com/llms-full.txt)

## Authentication and request conventions

Send Authorization: Bearer ab_live_YOUR_WORKSPACE_KEY on every request. The key belongs to one workspace and its owner must have a verified account. Create keys in your workspace integrations settings. Keep them on your server or in a secret environment variable; never include them in browser JavaScript or a public repository. Use articles:read for publishing, add drafts:read only for draft previews, and use a separate articles:generate key for generation.

A publishing key belongs to one workspace; verify the connection's workspace ID before importing. Rotate a key if exposed. The request examples read a key from `BEULOG_PUBLISHING_KEY`; this is a placeholder environment variable name, not a credential. For generation examples, set this variable to a separate key with generation permissions. Run requests on your server or in a trusted terminal. Use `Accept: application/json`. Send `Content-Type: application/json` when a request includes a JSON body. Endpoint tables distinguish path, query, header, and body parameters. Paths below are relative to the API base URL.

Scopes are checked for each endpoint. Reading published articles requires `articles:read`; reading drafts additionally requires `drafts:read`. Article generation requires a separate `articles:generate` key and can spend credits. Do not grant generation permissions to an ordinary website import key.

## Request limits

All public API requests share a limit of 120 requests per 60 seconds per key. Generation requests also have a limit of 20 requests per 3,600 seconds per account, shared across its keys; validation failures and idempotent retries can consume this limit. A 429 response includes Retry-After: 60. Poll jobs with a delay, back off after errors, and never continuously retry in a tight loop.

## Response conventions

JSON object and array fields retain the documented names and types. A nullable field can contain JSON `null`; an optional field may be absent. API version `1.2` is distinct from article `schema_version`, which describes the exported content format. Example responses use fictional IDs, article content, and publishing domains.

| Response header | Type | Meaning |
| --- | --- | --- |
| Content-Type | application/json | Successful 200 and error responses use JSON. A 304 response has no body. |
| X-API-Version | string: "1.2" | Response contract version. The URL continues to use /api/v1. |
| X-Request-Id | UUID | Unique request identifier; include it when contacting support about a failed request. |
| ETag | quoted string | Returned on successful GET requests. Send the exact value in If-None-Match to receive 304 when the complete response is unchanged. |
| Cache-Control | string: "no-store" | Do not rely on shared HTTP caches for workspace data. Store an authenticated copy in your own integration if needed. |
| Vary | string: "Authorization" | Responses depend on the workspace API key. |
| Retry-After | string: "60" (429 only) | Wait at least 60 seconds before retrying a rate-limited request. The account generation window lasts one hour and may require a longer wait. |

## Endpoint index

| Method | Path | Permission | Purpose |
| --- | --- | --- | --- |
| GET | /connection | articles:read | Validate the key and confirm which workspace and permissions it can access. |
| GET | /articles | articles:read; drafts:read when drafts=true | Read published articles with their HTML, structured content, metadata and sources. |
| GET | /articles/{id} | articles:read; drafts:read when drafts=true | Download a complete article by its UUID in this key's workspace. |
| GET | /sync | articles:read | Get a lightweight manifest of published article IDs and change tokens. |
| GET | /pricing | articles:generate | Read current maximum credit reservations before requesting generation. |
| POST | /generate | articles:generate | Reserve credits and queue an asynchronous generation job. |
| GET | /jobs/{id} | articles:generate | Read generation progress, the result article ID and credit settlement fields. |

## GET /connection — Check your workspace connection

HTML section: https://beulog.com/guides/api#api-endpoint-connection

Validate the key and confirm which workspace and permissions it can access.

This request has no body or query parameters. Run it before importing content and compare workspace.id with the workspace you intend to publish. A successful request also updates the key's last connection time.

analytics is null when visitor analytics is disabled or unconfigured. When enabled, it contains public browser configuration; it never contains the workspace API key. Request visitor consent before loading analytics.

Required permission: articles:read.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| api_version | string: "1.2" | Current public API version. |
| workspace.id | UUID | The workspace attached to this API key. |
| workspace.name | string | Human-readable workspace name. |
| workspace.language | "en" \| "ar" \| "es" \| "fr" \| "de" | Workspace's default content language. |
| scopes | string[] | Permissions granted to this key; not all account permissions. |
| analytics | object \| null | Public analytics configuration, or null when disabled. |
| analytics.site_id | 36-character hexadecimal string | Public site identifier for analytics, present only when enabled. |
| analytics.consent_required | boolean: true | Visitor consent is required before analytics tracking. |
| analytics.allowed_origins | string[] | Website origins allowed to submit analytics events. |

### Example response

```json
{
  "api_version": "1.2",
  "workspace": {
    "id": "00000000-0000-4000-8000-000000000001",
    "name": "Example publication",
    "language": "en"
  },
  "scopes": [
    "articles:read"
  ],
  "analytics": null
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | Connected workspace and granted permissions. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/connection')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/connection", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/connection", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/connection",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/connection');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/connection')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/connection",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/connection"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## GET /articles — List articles

HTML section: https://beulog.com/guides/api#api-endpoint-articles

Read published articles with their HTML, structured content, metadata and sources.

Articles are ordered by creation time, newest first, with ID as a stable tie-breaker. The response includes full article bodies, so use a modest limit and follow pagination.next_cursor until it is null. An empty workspace returns data: [].

Prefer cursor pagination while new articles may be added. Keep the same drafts filter and workspace for the whole list. Do not combine a cursor with a nonzero offset; offset=0 is accepted. List cursors belong to /articles and cannot be reused for /sync.

Required permission: articles:read; drafts:read when drafts=true.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| limit | query | integer: 1–100 | No | 20 | Maximum articles in this page. Invalid numbers and values outside the range return 400. |
| cursor | query | string, up to 1,000 characters | No | None | Use the exact pagination.next_cursor from the previous page, URL encoded. It records workspace, drafts filter, creation time and ID. Invalid or mismatched cursors return 400. |
| offset | query | integer: 0–100,000 | No | 0 | Legacy number of rows to skip. Prefer cursor for a changing collection; new articles can shift offset pages. |
| drafts | query | boolean | No | false | Only the literal query value true includes drafts. Requires drafts:read in addition to articles:read. Other values behave as false; never expose draft responses on public pages. |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| data | Article[] | An array of complete article exports. The single-article endpoint also uses this array envelope. |
| pagination.limit | integer | Page size; 1 for a single-article request. |
| pagination.offset | integer \| null | Current legacy offset, or null when cursor pagination is used. |
| pagination.has_more | boolean | True when another page exists. Always false for a single-article response. |
| pagination.next_cursor | string \| null | Exact opaque token for the next page. null means the list is complete. Keep the same workspace and drafts filter. |
| pagination.next_offset | integer \| null | Legacy next offset; null at the end or after switching to cursor pagination. |

### Example response

```json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000002",
      "workspace_id": "00000000-0000-4000-8000-000000000001",
      "version": 1,
      "status": "published",
      "title": "How to plan an editorial calendar",
      "slug": "plan-an-editorial-calendar",
      "language": "en",
      "translation_group_id": null,
      "created_at": "2026-10-01T09:00:00.000Z",
      "updated_at": "2026-10-01T09:00:00.000Z",
      "published_at": "2026-10-01T09:00:00.000Z",
      "canonical_url": null,
      "image_url": null,
      "image_width": null,
      "image_height": null,
      "quality": [],
      "generation_warnings": null,
      "content": {
        "title": "How to plan an editorial calendar",
        "slug": "plan-an-editorial-calendar",
        "excerpt": "Create a practical publishing plan for your team.",
        "metaTitle": "How to plan an editorial calendar",
        "metaDescription": "Plan useful topics, clear deadlines and a review process for your publication.",
        "category": "Publishing",
        "keywords": [
          "editorial calendar"
        ],
        "takeaways": [
          "Choose useful topics",
          "Assign a review date",
          "Review before publishing"
        ],
        "sections": [
          {
            "heading": "Start with your readers",
            "summary": "Plan around questions your readers ask.",
            "paragraphs": [
              "Choose one question and prepare an article that answers it clearly."
            ],
            "bullets": [
              "Keep the calendar manageable."
            ],
            "sourceIds": [],
            "subsections": [],
            "steps": [
              "Choose your next topic."
            ],
            "table": null,
            "callout": null
          }
        ],
        "faqs": [
          {
            "question": "How often should we publish?",
            "answer": "Choose a schedule your team can maintain."
          }
        ],
        "imagePrompt": "",
        "imageAlt": "",
        "imageCaption": "",
        "searchIntent": "Build an editorial calendar",
        "reviewNotes": [],
        "recommendedPublish": true
      },
      "references": [],
      "references_json": [],
      "schema_version": "1.1",
      "html": "<article class=\"aiblogs-article\" lang=\"en\" dir=\"ltr\"><header><p class=\"aiblogs-category\">Publishing</p><h1>How to plan an editorial calendar</h1><p class=\"aiblogs-lead\">Create a practical publishing plan for your team.</p><p class=\"aiblogs-byline\">Example publication · Updated <time datetime=\"2026-10-01T09:00:00.000Z\">October 1, 2026</time> · 1 min read</p></header>\n  <aside class=\"aiblogs-takeaways\"><h2>Key takeaways</h2><ul><li>Choose useful topics</li><li>Assign a review date</li><li>Review before publishing</li></ul></aside>\n  <nav class=\"aiblogs-toc\" aria-label=\"In this article\"><h2>In this article</h2><ol><li><a href=\"#article-00000000-0000-4000-8000-000000000002-1\">Start with your readers</a></li><li><a href=\"#article-00000000-0000-4000-8000-000000000002-faq\">Frequently asked questions</a></li></ol></nav>\n  <section id=\"article-00000000-0000-4000-8000-000000000002-1\"><h2>Start with your readers</h2><p class=\"aiblogs-section-summary\">Plan around questions your readers ask.</p><p>Choose one question and prepare an article that answers it clearly.</p><ul><li>Keep the calendar manageable.</li></ul><ol class=\"aiblogs-steps\"><li>Choose your next topic.</li></ol></section>\n  <section id=\"article-00000000-0000-4000-8000-000000000002-faq\" class=\"aiblogs-faq\"><h2>Frequently asked questions</h2><details open><summary>How often should we publish?</summary><p>Choose a schedule your team can maintain.</p></details></section>\n  <section class=\"aiblogs-references\"><h2>Sources & references</h2><ol></ol></section></article>",
      "head_html": "<title>How to plan an editorial calendar</title><meta name=\"description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><meta name=\"robots\" content=\"index, follow, max-image-preview:large\" /><link rel=\"canonical\" href=\"https://example.com/blog/plan-an-editorial-calendar\" /><meta property=\"og:type\" content=\"article\" /><meta property=\"og:title\" content=\"How to plan an editorial calendar\" /><meta property=\"og:description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><meta property=\"og:url\" content=\"https://example.com/blog/plan-an-editorial-calendar\" /><meta property=\"og:site_name\" content=\"Example publication\" /><meta property=\"og:locale\" content=\"en_US\" /><meta property=\"article:published_time\" content=\"2026-10-01T09:00:00.000Z\" /><meta property=\"article:modified_time\" content=\"2026-10-01T09:00:00.000Z\" /><meta name=\"twitter:card\" content=\"summary\" /><meta name=\"twitter:title\" content=\"How to plan an editorial calendar\" /><meta name=\"twitter:description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#article\",\"url\":\"https://example.com/blog/plan-an-editorial-calendar\",\"mainEntityOfPage\":{\"@type\":\"WebPage\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar\"},\"headline\":\"How to plan an editorial calendar\",\"description\":\"Plan useful topics, clear deadlines and a review process for your publication.\",\"inLanguage\":\"en\",\"articleSection\":\"Publishing\",\"keywords\":\"editorial calendar\",\"datePublished\":\"2026-10-01T09:00:00.000Z\",\"dateModified\":\"2026-10-01T09:00:00.000Z\",\"author\":{\"@type\":\"Organization\",\"name\":\"Example publication\"},\"publisher\":{\"@type\":\"Organization\",\"name\":\"Example publication\",\"url\":\"https://example.com/\"},\"citation\":[],\"wordCount\":29,\"isAccessibleForFree\":true},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#breadcrumbs\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https://example.com/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to plan an editorial calendar\",\"item\":\"https://example.com/blog/plan-an-editorial-calendar\"}]},{\"@type\":\"FAQPage\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#faq\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"How often should we publish?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Choose a schedule your team can maintain.\"}}]}]}</script>",
      "seo": {
        "title": "How to plan an editorial calendar",
        "description": "Plan useful topics, clear deadlines and a review process for your publication.",
        "canonical": "https://example.com/blog/plan-an-editorial-calendar",
        "robots": "index, follow, max-image-preview:large",
        "language": "en",
        "openGraph": {
          "type": "article",
          "title": "How to plan an editorial calendar",
          "description": "Plan useful topics, clear deadlines and a review process for your publication.",
          "url": "https://example.com/blog/plan-an-editorial-calendar",
          "siteName": "Example publication",
          "locale": "en_US",
          "images": [],
          "publishedTime": "2026-10-01T09:00:00.000Z",
          "modifiedTime": "2026-10-01T09:00:00.000Z"
        },
        "twitter": {
          "card": "summary",
          "title": "How to plan an editorial calendar",
          "description": "Plan useful topics, clear deadlines and a review process for your publication.",
          "image": null,
          "imageAlt": ""
        }
      },
      "publishing_checks": [
        {
          "label": "Title and search description",
          "passed": true
        },
        {
          "label": "Cover image and descriptive alt text",
          "passed": false
        },
        {
          "label": "Canonical article address",
          "passed": true
        },
        {
          "label": "Named publisher",
          "passed": true
        },
        {
          "label": "Sections, takeaways and FAQs",
          "passed": false
        },
        {
          "label": "Sources cited throughout the article",
          "passed": false
        },
        {
          "label": "Configured internal links",
          "passed": true
        }
      ],
      "reading_minutes": 1,
      "json_ld": {
        "@context": "https://schema.org",
        "@graph": [
          {
            "@type": "BlogPosting",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#article",
            "url": "https://example.com/blog/plan-an-editorial-calendar",
            "mainEntityOfPage": {
              "@type": "WebPage",
              "@id": "https://example.com/blog/plan-an-editorial-calendar"
            },
            "headline": "How to plan an editorial calendar",
            "description": "Plan useful topics, clear deadlines and a review process for your publication.",
            "inLanguage": "en",
            "articleSection": "Publishing",
            "keywords": "editorial calendar",
            "datePublished": "2026-10-01T09:00:00.000Z",
            "dateModified": "2026-10-01T09:00:00.000Z",
            "author": {
              "@type": "Organization",
              "name": "Example publication"
            },
            "publisher": {
              "@type": "Organization",
              "name": "Example publication",
              "url": "https://example.com/"
            },
            "citation": [],
            "wordCount": 29,
            "isAccessibleForFree": true
          },
          {
            "@type": "BreadcrumbList",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#breadcrumbs",
            "itemListElement": [
              {
                "@type": "ListItem",
                "position": 1,
                "name": "Home",
                "item": "https://example.com/"
              },
              {
                "@type": "ListItem",
                "position": 2,
                "name": "How to plan an editorial calendar",
                "item": "https://example.com/blog/plan-an-editorial-calendar"
              }
            ]
          },
          {
            "@type": "FAQPage",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#faq",
            "mainEntity": [
              {
                "@type": "Question",
                "name": "How often should we publish?",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "Choose a schedule your team can maintain."
                }
              }
            ]
          }
        ]
      },
      "revision": "772066718e41650d049603388c9a374c62817f529ed062f281a5e695c161ef70"
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "has_more": false,
    "next_offset": null,
    "next_cursor": null
  }
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | A page of article exports, including an empty data array when there are no matching articles. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 400 | Invalid pagination numbers, cursor, or a cursor combined with a nonzero offset. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/articles?limit=20')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/articles?limit=20", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/articles?limit=20", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/articles?limit=20",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/articles?limit=20');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/articles?limit=20')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/articles?limit=20",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/articles?limit=20"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## GET /articles/{id} — Get one article

HTML section: https://beulog.com/guides/api#api-endpoint-article

Download a complete article by its UUID in this key's workspace.

The result uses the same data array as the article list, with exactly one element at data[0] and pagination.limit: 1. A missing article, an article in another workspace, or a draft hidden by the published-only filter returns 404.

Use this endpoint after finding a changed ID through /sync. Read data[0].seo and data[0].json_ld for page metadata, or render data[0].head_html once. There is no standalone article object outside the data array.

Required permission: articles:read; drafts:read when drafts=true.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| id | path | UUID | Yes | None | Article UUID from /articles, /sync or a completed article job. Slugs are not accepted. |
| drafts | query | boolean | No | false | Only the literal query value true includes drafts. Requires drafts:read in addition to articles:read. Other values behave as false; never expose draft responses on public pages. |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| data | Article[] | An array of complete article exports. The single-article endpoint also uses this array envelope. |
| pagination.limit | integer | Page size; 1 for a single-article request. |
| pagination.offset | integer \| null | Current legacy offset, or null when cursor pagination is used. |
| pagination.has_more | boolean | True when another page exists. Always false for a single-article response. |
| pagination.next_cursor | string \| null | Exact opaque token for the next page. null means the list is complete. Keep the same workspace and drafts filter. |
| pagination.next_offset | integer \| null | Legacy next offset; null at the end or after switching to cursor pagination. |

### Example response

```json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000002",
      "workspace_id": "00000000-0000-4000-8000-000000000001",
      "version": 1,
      "status": "published",
      "title": "How to plan an editorial calendar",
      "slug": "plan-an-editorial-calendar",
      "language": "en",
      "translation_group_id": null,
      "created_at": "2026-10-01T09:00:00.000Z",
      "updated_at": "2026-10-01T09:00:00.000Z",
      "published_at": "2026-10-01T09:00:00.000Z",
      "canonical_url": null,
      "image_url": null,
      "image_width": null,
      "image_height": null,
      "quality": [],
      "generation_warnings": null,
      "content": {
        "title": "How to plan an editorial calendar",
        "slug": "plan-an-editorial-calendar",
        "excerpt": "Create a practical publishing plan for your team.",
        "metaTitle": "How to plan an editorial calendar",
        "metaDescription": "Plan useful topics, clear deadlines and a review process for your publication.",
        "category": "Publishing",
        "keywords": [
          "editorial calendar"
        ],
        "takeaways": [
          "Choose useful topics",
          "Assign a review date",
          "Review before publishing"
        ],
        "sections": [
          {
            "heading": "Start with your readers",
            "summary": "Plan around questions your readers ask.",
            "paragraphs": [
              "Choose one question and prepare an article that answers it clearly."
            ],
            "bullets": [
              "Keep the calendar manageable."
            ],
            "sourceIds": [],
            "subsections": [],
            "steps": [
              "Choose your next topic."
            ],
            "table": null,
            "callout": null
          }
        ],
        "faqs": [
          {
            "question": "How often should we publish?",
            "answer": "Choose a schedule your team can maintain."
          }
        ],
        "imagePrompt": "",
        "imageAlt": "",
        "imageCaption": "",
        "searchIntent": "Build an editorial calendar",
        "reviewNotes": [],
        "recommendedPublish": true
      },
      "references": [],
      "references_json": [],
      "schema_version": "1.1",
      "html": "<article class=\"aiblogs-article\" lang=\"en\" dir=\"ltr\"><header><p class=\"aiblogs-category\">Publishing</p><h1>How to plan an editorial calendar</h1><p class=\"aiblogs-lead\">Create a practical publishing plan for your team.</p><p class=\"aiblogs-byline\">Example publication · Updated <time datetime=\"2026-10-01T09:00:00.000Z\">October 1, 2026</time> · 1 min read</p></header>\n  <aside class=\"aiblogs-takeaways\"><h2>Key takeaways</h2><ul><li>Choose useful topics</li><li>Assign a review date</li><li>Review before publishing</li></ul></aside>\n  <nav class=\"aiblogs-toc\" aria-label=\"In this article\"><h2>In this article</h2><ol><li><a href=\"#article-00000000-0000-4000-8000-000000000002-1\">Start with your readers</a></li><li><a href=\"#article-00000000-0000-4000-8000-000000000002-faq\">Frequently asked questions</a></li></ol></nav>\n  <section id=\"article-00000000-0000-4000-8000-000000000002-1\"><h2>Start with your readers</h2><p class=\"aiblogs-section-summary\">Plan around questions your readers ask.</p><p>Choose one question and prepare an article that answers it clearly.</p><ul><li>Keep the calendar manageable.</li></ul><ol class=\"aiblogs-steps\"><li>Choose your next topic.</li></ol></section>\n  <section id=\"article-00000000-0000-4000-8000-000000000002-faq\" class=\"aiblogs-faq\"><h2>Frequently asked questions</h2><details open><summary>How often should we publish?</summary><p>Choose a schedule your team can maintain.</p></details></section>\n  <section class=\"aiblogs-references\"><h2>Sources & references</h2><ol></ol></section></article>",
      "head_html": "<title>How to plan an editorial calendar</title><meta name=\"description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><meta name=\"robots\" content=\"index, follow, max-image-preview:large\" /><link rel=\"canonical\" href=\"https://example.com/blog/plan-an-editorial-calendar\" /><meta property=\"og:type\" content=\"article\" /><meta property=\"og:title\" content=\"How to plan an editorial calendar\" /><meta property=\"og:description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><meta property=\"og:url\" content=\"https://example.com/blog/plan-an-editorial-calendar\" /><meta property=\"og:site_name\" content=\"Example publication\" /><meta property=\"og:locale\" content=\"en_US\" /><meta property=\"article:published_time\" content=\"2026-10-01T09:00:00.000Z\" /><meta property=\"article:modified_time\" content=\"2026-10-01T09:00:00.000Z\" /><meta name=\"twitter:card\" content=\"summary\" /><meta name=\"twitter:title\" content=\"How to plan an editorial calendar\" /><meta name=\"twitter:description\" content=\"Plan useful topics, clear deadlines and a review process for your publication.\" /><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#article\",\"url\":\"https://example.com/blog/plan-an-editorial-calendar\",\"mainEntityOfPage\":{\"@type\":\"WebPage\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar\"},\"headline\":\"How to plan an editorial calendar\",\"description\":\"Plan useful topics, clear deadlines and a review process for your publication.\",\"inLanguage\":\"en\",\"articleSection\":\"Publishing\",\"keywords\":\"editorial calendar\",\"datePublished\":\"2026-10-01T09:00:00.000Z\",\"dateModified\":\"2026-10-01T09:00:00.000Z\",\"author\":{\"@type\":\"Organization\",\"name\":\"Example publication\"},\"publisher\":{\"@type\":\"Organization\",\"name\":\"Example publication\",\"url\":\"https://example.com/\"},\"citation\":[],\"wordCount\":29,\"isAccessibleForFree\":true},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#breadcrumbs\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https://example.com/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to plan an editorial calendar\",\"item\":\"https://example.com/blog/plan-an-editorial-calendar\"}]},{\"@type\":\"FAQPage\",\"@id\":\"https://example.com/blog/plan-an-editorial-calendar#faq\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"How often should we publish?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Choose a schedule your team can maintain.\"}}]}]}</script>",
      "seo": {
        "title": "How to plan an editorial calendar",
        "description": "Plan useful topics, clear deadlines and a review process for your publication.",
        "canonical": "https://example.com/blog/plan-an-editorial-calendar",
        "robots": "index, follow, max-image-preview:large",
        "language": "en",
        "openGraph": {
          "type": "article",
          "title": "How to plan an editorial calendar",
          "description": "Plan useful topics, clear deadlines and a review process for your publication.",
          "url": "https://example.com/blog/plan-an-editorial-calendar",
          "siteName": "Example publication",
          "locale": "en_US",
          "images": [],
          "publishedTime": "2026-10-01T09:00:00.000Z",
          "modifiedTime": "2026-10-01T09:00:00.000Z"
        },
        "twitter": {
          "card": "summary",
          "title": "How to plan an editorial calendar",
          "description": "Plan useful topics, clear deadlines and a review process for your publication.",
          "image": null,
          "imageAlt": ""
        }
      },
      "publishing_checks": [
        {
          "label": "Title and search description",
          "passed": true
        },
        {
          "label": "Cover image and descriptive alt text",
          "passed": false
        },
        {
          "label": "Canonical article address",
          "passed": true
        },
        {
          "label": "Named publisher",
          "passed": true
        },
        {
          "label": "Sections, takeaways and FAQs",
          "passed": false
        },
        {
          "label": "Sources cited throughout the article",
          "passed": false
        },
        {
          "label": "Configured internal links",
          "passed": true
        }
      ],
      "reading_minutes": 1,
      "json_ld": {
        "@context": "https://schema.org",
        "@graph": [
          {
            "@type": "BlogPosting",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#article",
            "url": "https://example.com/blog/plan-an-editorial-calendar",
            "mainEntityOfPage": {
              "@type": "WebPage",
              "@id": "https://example.com/blog/plan-an-editorial-calendar"
            },
            "headline": "How to plan an editorial calendar",
            "description": "Plan useful topics, clear deadlines and a review process for your publication.",
            "inLanguage": "en",
            "articleSection": "Publishing",
            "keywords": "editorial calendar",
            "datePublished": "2026-10-01T09:00:00.000Z",
            "dateModified": "2026-10-01T09:00:00.000Z",
            "author": {
              "@type": "Organization",
              "name": "Example publication"
            },
            "publisher": {
              "@type": "Organization",
              "name": "Example publication",
              "url": "https://example.com/"
            },
            "citation": [],
            "wordCount": 29,
            "isAccessibleForFree": true
          },
          {
            "@type": "BreadcrumbList",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#breadcrumbs",
            "itemListElement": [
              {
                "@type": "ListItem",
                "position": 1,
                "name": "Home",
                "item": "https://example.com/"
              },
              {
                "@type": "ListItem",
                "position": 2,
                "name": "How to plan an editorial calendar",
                "item": "https://example.com/blog/plan-an-editorial-calendar"
              }
            ]
          },
          {
            "@type": "FAQPage",
            "@id": "https://example.com/blog/plan-an-editorial-calendar#faq",
            "mainEntity": [
              {
                "@type": "Question",
                "name": "How often should we publish?",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "Choose a schedule your team can maintain."
                }
              }
            ]
          }
        ]
      },
      "revision": "772066718e41650d049603388c9a374c62817f529ed062f281a5e695c161ef70"
    }
  ],
  "pagination": {
    "limit": 1,
    "offset": 0,
    "has_more": false,
    "next_offset": null,
    "next_cursor": null
  }
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | One complete article in data[0]. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 400 | The article ID is not a valid UUID. |
| 404 | Article not found in this workspace or not visible under the selected drafts filter. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/articles/00000000-0000-4000-8000-000000000002"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## GET /sync — Discover changed articles

HTML section: https://beulog.com/guides/api#api-endpoint-sync

Get a lightweight manifest of published article IDs and change tokens.

For the first scan omit since and settings_revision. For subsequent scans send both the saved checkpoint as since and the saved settings_revision. A missing or changed settings revision triggers a full published-article scan because workspace settings affect rendered metadata.

Follow pagination.next_cursor through every page. It preserves the scan's time boundary and filters. Only save checkpoint and settings_revision after every page is processed or durably queued. The next scan includes a five-minute overlap before since, so deduplicate by article ID and manifest revision.

Sync revision is distinct from the full article export revision. Fetch /articles/{id} for changed entries. This feed contains published articles only; it does not contain deletion or unpublishing records. Periodically reconcile the complete published list with your imports. Restart a scan after an invalid/outdated cursor response.

Required permission: articles:read.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| limit | query | integer: 1–100 | No | 50 | Maximum manifest entries per page. Does not download article bodies. |
| since | query | UTC ISO 8601 date-time | No | None | Saved checkpoint from the last completed scan, such as 2026-10-01T09:00:00.000Z. Use UTC with a Z suffix. The server includes a five-minute overlap. Omit for the first scan. |
| settings_revision | query | string | No | None | Exact settings token saved with that checkpoint. Missing or different values reset since and run a full scan. |
| cursor | query | string, up to 2,000 characters | No | None | Exact pagination.next_cursor for the current scan. Overrides its saved since and time boundary; must belong to this workspace and current settings revision. Omit to start a new scan. |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| api_version | string: "1.2" | Public API contract version. |
| workspace_id | UUID | Workspace scanned; compare with your expected workspace. |
| settings_revision | string | Current opaque digest of workspace settings; save with checkpoint after the complete scan. |
| checkpoint | UTC ISO 8601 date-time | Scan upper boundary. It remains the same across cursor pages. It is not the time of the last returned article. |
| data[] | { id: UUID, title: string, revision: string }[] | Published-article manifest entries ordered by update time then ID. data can be empty. revision tracks ID, edit version, update timestamp and workspace settings. |
| data[].id | UUID | Published article identifier. Fetch /articles/{id} for the complete export. |
| data[].title | string | Saved article title; included for identification without downloading the body. |
| data[].revision | string | Opaque manifest change token based on ID, edit version, update time and workspace settings. Distinct from data[0].revision in a complete article export. |
| pagination.next_cursor | string \| null | Token for the next page of this scan; null marks completion. Do not advance your stored checkpoint before this point. |

### Example response

```json
{
  "api_version": "1.2",
  "workspace_id": "00000000-0000-4000-8000-000000000001",
  "settings_revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "checkpoint": "2026-10-01T09:05:00.000000Z",
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000002",
      "title": "How to plan an editorial calendar",
      "revision": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
    }
  ],
  "pagination": {
    "next_cursor": null
  }
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | A lightweight manifest page; empty data is valid. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 400 | Invalid limit or UTC date-time, or an invalid/outdated cursor. Restart the current scan for cursor errors. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/sync?limit=50')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/sync?limit=50", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/sync?limit=50", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/sync?limit=50",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/sync?limit=50');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/sync?limit=50')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/sync?limit=50",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/sync?limit=50"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## GET /pricing — Check credit reservations

HTML section: https://beulog.com/guides/api#api-endpoint-pricing

Read current maximum credit reservations before requesting generation.

These amounts are spending ceilings reserved when a job is queued, not fixed final charges. Successful generation settles against actual usage and returns unused credits; failed jobs refund the reservation. Retrieve the current values and set maxCredits on /generate to enforce your own ceiling.

The sample values are illustrative of the current contract, and may change. Treat the live /pricing response as the source for reservation limits.

Required permission: articles:generate.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| billing | string: "usage_based" | Generation is charged by usage, with a maximum reservation. |
| article | integer (credits) | Maximum reservation for an article with image=false. |
| article_with_image | integer (credits) | Maximum reservation for an article with image=true. |
| research | integer (credits) | Maximum reservation for a research job. |
| description | string | Human-readable explanation of reservations and refunds. |

### Example response

```json
{
  "billing": "usage_based",
  "article": 40,
  "article_with_image": 45,
  "research": 10,
  "description": "Maximum credits reserved per job. Unused credits are returned on completion. Failed jobs are fully refunded."
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | Current credit reservation ceilings. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/pricing')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/pricing", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/pricing", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/pricing",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/pricing');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/pricing')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/pricing",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/pricing"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## POST /generate — Queue article or research generation

HTML section: https://beulog.com/guides/api#api-endpoint-generate

Reserve credits and queue an asynchronous generation job.

Send a JSON object, even when using every default ({} is valid). The body limit is 300,000 bytes. A successful response is HTTP 200 with a job identifier, not the generated article. Poll GET /jobs/{id} with a delay; fetch GET /articles/{article_id} after an article job completes. New content defaults to draft; reading it before publication also needs drafts:read and drafts=true.

Use a new Idempotency-Key for each intended job. Reuse the same key with the same workspace API key when retrying that job; the existing job is returned without another credit reservation. Changing the body does not change an existing job with the same key. Idempotency is scoped to the API key; another key can create a separate job. There is no documented expiry window.

Workspace settings supply the audience, language, tone and other generation choices. An archived workspace cannot generate content. Billing holds, insufficient credits, unavailable generation services or a reservation above maxCredits are rejected before a new job is queued. autoPublish requests publishing, but quality checks can still keep the result as a draft; inspect the resulting article's status.

Required permission: articles:generate.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| Idempotency-Key | header | string: 1–128 characters | Yes | None | Your unique retry identifier for this intended job. Reuse for retries; use a new value for a new job. |
| Content-Type | header | application/json | No | None | Recommended header for JSON encoded as UTF-8. The handler parses JSON regardless of this header; malformed JSON or a body that is not an object returns 400. |
| topic | body | string: up to 1,500 characters | No | "" | Topic or editorial instructions. Leading/trailing whitespace is trimmed. Empty string lets generation use the workspace's configured topics. |
| image | body | boolean | No | true | Request a cover image for article generation. Set false for text-only articles and research. This flag is checked for image service availability even when kind=research. |
| autoPublish | body | boolean | No | false | Request publication after generation; quality review can leave the article as a draft. Does not publish a research brief. |
| kind | body | "article" \| "research" | No | "article" | article produces an article. research produces a research brief visible in the workspace; its completed job can have article_id=null, and this public API has no research retrieval endpoint. |
| researchId | body | UUID | No | None | Optional existing research brief in this workspace to seed generation. A missing or other-workspace brief returns 404. |
| maxCredits | body | integer: 1–1,000,000 | No | None | Optional maximum acceptable reservation. If the current reservation exceeds it, return 409 without reserving credits. Omission accepts the current reservation; check /pricing first. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| id | UUID | Generation job identifier. Use it with GET /jobs/{id}. |
| status | "queued" \| "running" \| "completed" \| "failed" | queued/running are pending; completed/failed are terminal. A research job may complete without an article_id. |
| cost | integer (credits) | Reserved amount while pending; final charged amount after successful settlement. On failed jobs this stored value can remain the former reservation even though credits were refunded. |
| reserved_credits | integer \| null | Original credit reservation. Generation response falls back to cost for older jobs; job polling may return null for legacy jobs. |
| settled_at | ISO 8601 date-time \| null | Successful usage settlement timestamp; null before settlement and potentially on legacy or failed jobs. It is not a job completion timestamp. |

### Example response

```json
{
  "id": "00000000-0000-4000-8000-000000000003",
  "status": "queued",
  "cost": 40,
  "reserved_credits": 40,
  "settled_at": null
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | New queued job or existing idempotent job; the returned status may already be running/completed/failed on retry. |
| 400 | Invalid JSON/body fields or missing/overlong Idempotency-Key. |
| 402 | Insufficient credits for the current reservation. |
| 404 | Workspace or research brief not found. |
| 409 | Reservation exceeds maxCredits, or the workspace is archived. |
| 413 | Request body exceeds 300,000 bytes. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | Missing articles:generate permission, or the account requires billing review. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request POST \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json' \
    --header 'Idempotency-Key: editorial-calendar-001' \
    --data-raw '{"topic":"How to plan an editorial calendar","image":false,"autoPublish":false,"kind":"article","maxCredits":40}' \
    'https://beulog.com/api/v1/generate')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/generate", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "editorial-calendar-001",
    },
    body: JSON.stringify({
      "topic": "How to plan an editorial calendar",
      "image": false,
      "autoPublish": false,
      "kind": "article",
      "maxCredits": 40
    }),
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/generate", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "editorial-calendar-001",
    },
    body: JSON.stringify({
      "topic": "How to plan an editorial calendar",
      "image": false,
      "autoPublish": false,
      "kind": "article",
      "maxCredits": 40
    }),
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Idempotency-Key": "editorial-calendar-001",
}
request = Request(
    "https://beulog.com/api/v1/generate",
    headers=headers,
    method="POST",
    data="{\"topic\":\"How to plan an editorial calendar\",\"image\":false,\"autoPublish\":false,\"kind\":\"article\",\"maxCredits\":40}".encode("utf-8"),
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/generate');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
            'Content-Type: application/json',
            'Idempotency-Key: editorial-calendar-001',
        ],
        CURLOPT_POSTFIELDS => '{"topic":"How to plan an editorial calendar","image":false,"autoPublish":false,"kind":"article","maxCredits":40}',
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/generate')
  request = Net::HTTP::Post.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'
  request['Content-Type'] = 'application/json'
  request['Idempotency-Key'] = 'editorial-calendar-001'
  request.body = '{"topic":"How to plan an editorial calendar","image":false,"autoPublish":false,"kind":"article","maxCredits":40}'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "strings"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "POST", "https://beulog.com/api/v1/generate",
        strings.NewReader("{\"topic\":\"How to plan an editorial calendar\",\"image\":false,\"autoPublish\":false,\"kind\":\"article\",\"maxCredits\":40}"),
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")
    request.Header.Set("Content-Type", "application/json")
    request.Header.Set("Idempotency-Key", "editorial-calendar-001")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/generate"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .header("Content-Type", "application/json")
                .header("Idempotency-Key", "editorial-calendar-001")
                .method("POST", HttpRequest.BodyPublishers.ofString("{\"topic\":\"How to plan an editorial calendar\",\"image\":false,\"autoPublish\":false,\"kind\":\"article\",\"maxCredits\":40}"))
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## GET /jobs/{id} — Check a generation job

HTML section: https://beulog.com/guides/api#api-endpoint-job

Read generation progress, the result article ID and credit settlement fields.

Poll with a delay while status is queued or running, and stop on completed or failed. Stage describes current work and is an informational string that may expand; do not assume a fixed progress percentage. A completed research job can have article_id=null; its brief is available in the workspace rather than this public endpoint.

When completed with article_id, fetch /articles/{article_id}. A draft result requires drafts=true and drafts:read. Failed generation returns a safe explanation in error and refunds the reservation. cost and reserved_credits can retain the former reservation on failed jobs; do not infer a charge solely from those fields.

Required permission: articles:generate.

### Request parameters

| Name | Location | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| id | path | UUID | Yes | None | The job UUID returned by POST /generate. The job must belong to this key's workspace. |
| If-None-Match | header | string | No | None | Optional exact ETag from a previous successful request to the same URL and key. A match returns 304 with no response body. |

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| id | UUID | Generation job identifier. Use it with GET /jobs/{id}. |
| status | "queued" \| "running" \| "completed" \| "failed" | queued/running are pending; completed/failed are terminal. A research job may complete without an article_id. |
| cost | integer (credits) | Reserved amount while pending; final charged amount after successful settlement. On failed jobs this stored value can remain the former reservation even though credits were refunded. |
| reserved_credits | integer \| null | Original credit reservation. Generation response falls back to cost for older jobs; job polling may return null for legacy jobs. |
| settled_at | ISO 8601 date-time \| null | Successful usage settlement timestamp; null before settlement and potentially on legacy or failed jobs. It is not a job completion timestamp. |
| stage | string | Current processing stage, such as queued, researching, writing, reviewing, image, saving, completed or failed. Treat additional stages as valid. |
| error | string \| null | Safe failure explanation, or null when there is no recorded error. |
| article_id | UUID \| null | Created article identifier when available. Null while pending, for research jobs, or if the linked article was deleted. |

### Example response

```json
{
  "id": "00000000-0000-4000-8000-000000000003",
  "status": "completed",
  "stage": "completed",
  "error": null,
  "article_id": "00000000-0000-4000-8000-000000000002",
  "cost": 18,
  "reserved_credits": 40,
  "settled_at": "2026-10-01T09:03:00.000Z"
}
```

### HTTP status codes

| Status | Meaning |
| --- | --- |
| 200 | Current job state and result reference; a failed generation job still returns HTTP 200 with status=failed. |
| 304 | The exact If-None-Match value matches this GET response. No body; use the previously stored response. |
| 400 | Job ID is not a valid UUID. |
| 404 | Job not found in this key's workspace. |
| 401 | Missing, invalid or revoked API key, or the workspace owner's account is unverified. |
| 403 | The key does not have the required permission. |
| 429 | Request limit reached. Inspect Retry-After and back off. |
| 500 | Unexpected server error. Save X-Request-Id for support. |
| 503 | A required service is temporarily unavailable. Retry later. |

### Request examples

Choose the language used by your server. Each example performs the same request. Install any library named in the example, set the environment variable, and replace the fictional IDs before running it.

#### cURL / Shell

Requirements: Bash and cURL 7.76 or newer. No extra libraries.  
Save as: request.sh  
Run: bash request.sh

```bash
#!/usr/bin/env bash
set -euo pipefail

# Set BEULOG_PUBLISHING_KEY in your server environment before running.
: "${BEULOG_PUBLISHING_KEY:?Set your server-side publishing key}"

# cURL returns a failure for HTTP errors and keeps the response body.
if response="$(curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET \
    --header "Authorization: Bearer $BEULOG_PUBLISHING_KEY" \
    --header 'Accept: application/json' \
    'https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003')"; then
  printf '%s\n' "$response"
else
  printf '%s\n' "$response" >&2
  exit 1
fi
```

#### JavaScript

Requirements: Node.js 20.20 or newer, using its built-in fetch. No extra libraries.  
Save as: request.mjs  
Run: node request.mjs

```javascript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}
```

#### TypeScript

Requirements: Node.js 20.20 or newer. Install the TypeScript tools once with: npm install -D typescript tsx @types/node  
Save as: request.ts  
Run: npx tsx request.ts

```typescript
// Run on your server. Never put this key in browser code.
const key = process.env.BEULOG_PUBLISHING_KEY;
if (!key) throw new Error("Set BEULOG_PUBLISHING_KEY on your server");

try {
  const response = await fetch("https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${key}`,
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });
  const text = await response.text();
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${text}`);
  }
  const payload: unknown = JSON.parse(text);
  console.log(JSON.stringify(payload, null, 2));
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error));
  process.exitCode = 1;
}

export {};
```

#### Python

Requirements: Python 3.10 or newer. Uses only the standard library.  
Save as: request.py  
Run: python3 request.py

```python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

# Read the key from your server environment, never browser code.
key = os.environ.get("BEULOG_PUBLISHING_KEY")
if not key:
    sys.exit("Set BEULOG_PUBLISHING_KEY on your server")

headers = {
    "Authorization": f"Bearer {key}",
    "Accept": "application/json",
}
request = Request(
    "https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003",
    headers=headers,
    method="GET",
)

try:
    with urlopen(request, timeout=30) as response:
        payload = json.loads(response.read().decode("utf-8"))
        print(json.dumps(payload, indent=2, ensure_ascii=False))
except HTTPError as error:
    print(f"HTTP {error.code}: {error.read().decode('utf-8')}", file=sys.stderr)
    sys.exit(1)
except (URLError, OSError, ValueError) as error:
    print(f"Request failed: {error}", file=sys.stderr)
    sys.exit(1)
```

#### PHP

Requirements: PHP 8.2 or newer with the cURL extension enabled.  
Save as: request.php  
Run: php request.php

```php
<?php
// Run on your server; the key must never be embedded in browser code.
try {
    $key = getenv('BEULOG_PUBLISHING_KEY');
    if (!$key) {
        throw new RuntimeException('Set BEULOG_PUBLISHING_KEY on your server');
    }
    $curl = curl_init('https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003');
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $key,
            'Accept: application/json',
        ],
    ]);
    $text = curl_exec($curl);
    if ($text === false) {
        throw new RuntimeException(curl_error($curl));
    }
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP $status: $text");
    }
    $payload = json_decode($text, true, 512, JSON_THROW_ON_ERROR);
    echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
```

#### Ruby

Requirements: Ruby 3.1 or newer. Uses the standard net/http and json libraries.  
Save as: request.rb  
Run: ruby request.rb

```ruby
require 'net/http'
require 'uri'
require 'json'

begin
  # Read the key from your server environment, never browser code.
  key = ENV.fetch('BEULOG_PUBLISHING_KEY')
  raise 'Set BEULOG_PUBLISHING_KEY on your server' if key.empty?
  uri = URI('https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003')
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = "Bearer #{key}"
  request['Accept'] = 'application/json'

  response = Net::HTTP.start(
    uri.host, uri.port, use_ssl: uri.scheme == 'https',
    open_timeout: 10, read_timeout: 30, write_timeout: 30
  ) { |http| http.request(request) }
  unless response.is_a?(Net::HTTPSuccess)
    raise "HTTP #{response.code}: #{response.body}"
  end
  puts JSON.pretty_generate(JSON.parse(response.body))
rescue StandardError => error
  warn "Request failed: #{error.message}"
  exit 1
end
```

#### Go

Requirements: Go 1.20 or newer. Uses only the standard library.  
Save as: request.go  
Run: go run request.go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func run() error {
    // Read the key from your server environment, never browser code.
    key := os.Getenv("BEULOG_PUBLISHING_KEY")
    if key == "" {
        return fmt.Errorf("set BEULOG_PUBLISHING_KEY on your server")
    }
    request, err := http.NewRequest(
        "GET", "https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003",
        nil,
    )
    if err != nil { return err }
    request.Header.Set("Authorization", "Bearer " + key)
    request.Header.Set("Accept", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(request)
    if err != nil { return err }
    defer response.Body.Close()
    text, err := io.ReadAll(response.Body)
    if err != nil { return err }
    if response.StatusCode < 200 || response.StatusCode >= 300 {
        return fmt.Errorf("HTTP %d: %s", response.StatusCode, text)
    }
    var pretty bytes.Buffer
    if err := json.Indent(&pretty, text, "", "  "); err != nil { return err }
    fmt.Println(pretty.String())
    return nil
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, "Request failed:", err)
        os.Exit(1)
    }
}
```

#### Java

Requirements: JDK 17 or newer. Uses the built-in HTTP client; no dependencies.  
Save as: RequestExample.java  
Run: java RequestExample.java

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class RequestExample {
    public static void main(String[] args) {
        try {
            // Read the key from your server environment, never browser code.
            String key = System.getenv("BEULOG_PUBLISHING_KEY");
            if (key == null || key.isBlank()) {
                throw new IllegalStateException("Set BEULOG_PUBLISHING_KEY on your server");
            }
            HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10)).build();
            HttpRequest request = HttpRequest.newBuilder(URI.create("https://beulog.com/api/v1/jobs/00000000-0000-4000-8000-000000000003"))
                .timeout(Duration.ofSeconds(30))
                .header("Authorization", "Bearer " + key)
                .header("Accept", "application/json")
                .method("GET", HttpRequest.BodyPublishers.noBody())
                .build();
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            if (response.statusCode() < 200 || response.statusCode() >= 300) {
                throw new IOException("HTTP " + response.statusCode() + ": " + response.body());
            }
            System.out.println(response.body());
        } catch (Exception error) {
            if (error instanceof InterruptedException) Thread.currentThread().interrupt();
            System.err.println("Request failed: " + error.getMessage());
            System.exit(1);
        }
    }
}
```

## Complete article export field reference

Article objects returned by the list and single-article endpoints use this shared schema. Dot paths describe nested fields; `[]` describes array items. Read endpoint response fields above for the containing `data` object or array. Revision values are opaque tokens: compare for equality, not order.

| Field | Type | Description |
| --- | --- | --- |
| id | UUID | Stable article identifier. Pair it with workspace_id for imports. |
| workspace_id | UUID | Workspace that owns this article. |
| schema_version | string: "1.1" | Article export schema version; separate from API version 1.2. |
| revision | string | Opaque digest of the full article export, including rendered data from workspace settings. Compare for changes; do not treat it as the sync manifest revision. |
| version | integer | Saved article edit version. Workspace setting changes can change revision without changing this number. |
| status | "published" \| "draft" | Published articles are returned by default. Drafts require drafts=true and drafts:read. |
| title | string | Saved article title used to identify the article in listings. |
| slug | string | Saved URL slug. This is not accepted instead of a UUID in /articles/{id}. |
| language | "en" \| "ar" \| "es" \| "fr" \| "de" | Language stored for the article; seo.language is the resolved export language. |
| translation_group_id | UUID \| null | Optional association between complete language editions; null means no translation group. |
| created_at | ISO 8601 date-time | Article creation timestamp, used for article list ordering. |
| updated_at | ISO 8601 date-time | Most recent saved article update timestamp, used for sync ordering. |
| published_at | ISO 8601 date-time \| null | Publication timestamp; may be null for drafts. |
| canonical_url | string \| null | Saved canonical override. seo.canonical resolves this or the workspace website and article path. |
| image_url | string \| null | Cover image address, or null when no image exists. |
| image_width | integer \| null | Stored cover width in pixels, or null if unavailable. |
| image_height | integer \| null | Stored cover height in pixels, or null if unavailable. |
| html | string | Escaped semantic article body fragment: heading, takeaways, contents, sections, FAQs, citations and optional image. Render on the server as a native page. |
| head_html | string | Ready-to-render title, meta tags, canonical and safely serialized JSON-LD. Use this or map seo/json_ld through your framework; using both duplicates metadata. |
| reading_minutes | integer | Estimated reading duration, at least one minute, based on 200 words per minute. |
| quality | string[] | Saved article quality issues or review notes. An empty array means no saved issues. |
| generation_warnings | string[] \| null | Optional warnings saved during generation. Review them before publication. |
| publishing_checks[] | { label: string, passed: boolean } | Readiness checks for metadata, images, canonical, publisher, structure, citations and internal links; these are guidance, not ranking guarantees. |
| references[] | object[] | Sources for this article. Each has id, title and url, and may have publisher and accessedAt. sourceIds in sections refer to these IDs. |
| references_json | object[] | The stored source array is also included by the current export. Prefer references for integrations. |
| content.title | string | Editable article heading; used in rendered HTML and BlogPosting.headline. |
| content.slug | string | Editable slug stored inside the content. |
| content.excerpt | string | Short introduction displayed below the article heading; fallback for empty metaDescription. |
| content.category | string | Editorial category rendered above the heading and as articleSection in structured data. |
| content.metaTitle | string | Editable search title. Empty values fall back to content.title in seo.title. |
| content.metaDescription | string | Editable search description. Empty values fall back to content.excerpt in seo.description. |
| content.keywords | string[] | Topic keywords; serialized as comma-separated keywords in BlogPosting. |
| content.takeaways | string[] | Key reader takeaways rendered as a list near the beginning. |
| content.sections[] | object[] | Ordered sections, each with heading, summary, paragraphs, bullets and sourceIds. |
| content.sections[].subsections[] | object[] (optional) | Nested headings and paragraph arrays. Older articles may omit this field. |
| content.sections[].steps | string[] (optional) | Ordered practical steps rendered as a numbered list. |
| content.sections[].table | object \| null (optional) | caption, columns (string[]) and rows (string[][]); null means no comparison table. |
| content.sections[].callout | object \| null (optional) | Highlighted title and text; null means no callout. |
| content.faqs[] | { question: string, answer: string }[] | Reader questions and answers, also used to build FAQPage structured data. |
| content.imagePrompt | string | Saved instructions used to create the cover image, if requested. |
| content.imageAlt | string | Accessible cover description used for HTML alt, social image alt and structured data image caption. |
| content.imageCaption | string (optional) | Visible caption below the cover image; omitted on some legacy articles. |
| content.searchIntent | string (optional) | Intended reader question or search goal; editorial context rather than an HTML meta tag. |
| content.reviewNotes | string[] (optional) | Editorial review observations saved with the content. |
| content.recommendedPublish | boolean | Generation recommendation only; status determines whether the article is actually published. |
| seo.title | string | Resolved page title from metaTitle or content.title. |
| seo.description | string | Resolved search description from metaDescription or content.excerpt. |
| seo.robots | string | Published pages use index, follow, max-image-preview:large; drafts use noindex, nofollow. |
| seo.canonical | string \| null | Resolved full canonical URL; null means no valid canonical was configured. |
| seo.language | "en" \| "ar" \| "es" \| "fr" \| "de" | Resolved language for HTML and structured data. |
| seo.openGraph | object | Article social metadata: type, title, description, url, siteName, locale, images, publishedTime and modifiedTime. URLs/times can be null. |
| seo.openGraph.images[] | { url, alt, width, height }[] | Cover image objects; [] when no valid cover image. Width and height can be null. |
| seo.twitter | object | card, title, description, image and imageAlt. card is summary_large_image with a cover, otherwise summary; image can be null. |
| json_ld | object | Schema.org @context and @graph containing BlogPosting, optional BreadcrumbList and FAQPage. Render safely once, consistently with the visible article. |
| publishing_checks[].label | string | Human-readable name of a readiness check. |
| publishing_checks[].passed | boolean | Whether that individual readiness condition is met. |
| references[].id | string | Source identifier used by section sourceIds and rendered citations. |
| references[].title | string | Source page title shown in the references list. |
| references[].url | string | Source URL; the renderer includes only safe HTTPS source links. |
| references[].publisher | string (optional) | Source publisher's name when recorded. |
| references[].accessedAt | string (optional) | Recorded source access timestamp when available. |
| content.sections[].heading | string | Section heading, rendered as h2 and in the table of contents. |
| content.sections[].summary | string | Optional text within the required summary field; an empty value renders no summary paragraph. |
| content.sections[].paragraphs | string[] | Main paragraphs in their display order. |
| content.sections[].bullets | string[] | Unordered list items; an empty array renders no bullet list. |
| content.sections[].sourceIds | string[] | IDs of entries in references cited at the end of this section. |
| content.sections[].subsections[].heading | string | Subsection heading rendered as h3. |
| content.sections[].subsections[].paragraphs | string[] | Paragraphs displayed below the subsection heading. |
| content.sections[].table.caption | string | Accessible caption for the table. |
| content.sections[].table.columns | string[] | Header labels, in column order. |
| content.sections[].table.rows | string[][] | Table rows; each inner array holds cell values in column order. |
| content.sections[].callout.title | string | Heading of a highlighted editorial note. |
| content.sections[].callout.text | string | Text of the highlighted note. |
| content.faqs[].question | string | Question displayed in an expandable details summary. |
| content.faqs[].answer | string | Answer shown below the question and in FAQPage structured data. |
| seo.openGraph.type | string: "article" | Social object type for article sharing. |
| seo.openGraph.title | string | Resolved social title, matching seo.title. |
| seo.openGraph.description | string | Resolved social description, matching seo.description. |
| seo.openGraph.url | string \| null | Canonical social URL, matching seo.canonical. |
| seo.openGraph.siteName | string | Workspace publisherName, falling back to workspace name. |
| seo.openGraph.locale | "en_US" \| "ar_SA" \| "es_ES" \| "fr_FR" \| "de_DE" | Social locale derived from the resolved article language. |
| seo.openGraph.images[].url | string | Safe HTTPS cover image URL. |
| seo.openGraph.images[].alt | string | Cover description from content.imageAlt. |
| seo.openGraph.images[].width | integer \| null | Cover width in pixels when stored. |
| seo.openGraph.images[].height | integer \| null | Cover height in pixels when stored. |
| seo.openGraph.publishedTime | ISO 8601 date-time \| null | Normalized article publication timestamp. |
| seo.openGraph.modifiedTime | ISO 8601 date-time \| null | Normalized article update timestamp. |
| seo.twitter.card | "summary" \| "summary_large_image" | Uses summary_large_image when a safe cover URL exists; otherwise summary. |
| seo.twitter.title | string | Resolved social card title. |
| seo.twitter.description | string | Resolved social card description. |
| seo.twitter.image | string \| null | Safe cover image URL, or null without an image. |
| seo.twitter.imageAlt | string | Cover description from content.imageAlt. |
| json_ld.@context | string: "https://schema.org" | Vocabulary used by the structured data graph. |
| json_ld.@graph | object[] | BlogPosting plus BreadcrumbList when canonical/site URLs exist, and FAQPage when FAQ entries exist. Optional properties depend on available article and workspace values. |

## Importing articles and pagination

Store imported articles using `(workspace_id, article_id)` as a unique key. Update an existing local article when its export revision changes. Decide how imported updates should interact with edits made on your own website. Follow the exact `pagination.next_cursor` until it is null; do not decode, modify, or manufacture cursors. Keep any filters unchanged across the pages of a scan. Never assume one page includes every article.

## Reliable incremental synchronization

Start with a complete `/sync` scan, then fetch each article using `/articles/{id}`. Keep manifest revisions and full article export revisions in separate fields; they are different tokens. Save each imported article and its processed manifest revision together only after a successful import. Process every cursor page before saving the returned `checkpoint` and `settings_revision` as a pair. If a page or import fails, retain the prior saved pair and retry safely. Use the returned checkpoint rather than your computer's current time.

The feed includes an inclusive five-minute overlap to reduce missed updates around database commits; duplicate IDs are expected. Deduplicate using article ID and manifest revision. A publishing settings change triggers a full scan and can invalidate an in-progress cursor. If the cursor returns 400, restart from the last saved checkpoint and settings revision and allow a full scan when requested by the API.

`/sync` lists published articles and has no deletion or unpublish tombstones. It does not remove copies from your own website. Reconcile removals separately against a completed authoritative published list and your editorial policy. Never delete local articles because a page fetch failed or a partial list was empty. An article can become unavailable between discovering its ID and fetching it; handle 404 deliberately.

## Errors and safe retries

Errors use the following JSON shape. `error` is a readable explanation and `code` is a machine-readable category. The request ID is in the `X-Request-Id` response header, not a property of this error body.

| Error field | Type | Meaning |
| --- | --- | --- |
| error | string | Human-readable English explanation. Do not parse its wording to decide your application behavior. |
| code | string | Stable category: invalid_request, unauthorized, forbidden, not_found, insufficient_credits, conflict, rate_limited, unavailable or internal_error. HTTP 413 currently uses internal_error. |

```json
{
  "error": "This key needs the articles:read permission.",
  "code": "forbidden"
}
```

| Status | Code | Action |
| --- | --- | --- |
| 400 | invalid_request | Correct a malformed parameter or body. A rejected cursor requires restarting that scan. |
| 401 | unauthorized | Check that the key exists, is valid, and was sent in the Authorization header. |
| 402 | insufficient_credits | Review available generation credits before trying again. |
| 403 | forbidden | Check required key scopes and workspace access. |
| 404 | not_found | Check the ID and workspace. A published article may have been removed or unpublished. |
| 409 | conflict | Review the conflicting request or idempotency key; do not blindly retry with changed input. |
| 413 | internal_error | The generation request body exceeds 300,000 bytes. Reduce its size. |
| 429 | rate_limited | Respect Retry-After and retry with a limit. |
| 500 | internal_error | Retry a transient failure with backoff and record the request ID if it persists. |
| 503 | unavailable | The service is temporarily unavailable. Retry with bounded backoff. |

Retry transient failures with a bounded attempt count and backoff; avoid endless retry loops. For generation retries, reuse the original `Idempotency-Key` for the same request. Use a new key for a new generation operation. The supplied TypeScript client attempts up to three HTTP requests for 429, 502, 503, and 504, respecting numeric Retry-After or a short delay capped at 60 seconds. Network exceptions and timeouts require your own retry policy.

## Rendering articles on your website

Give every article a permanent public URL. Render article content in the server response or at build time. Use either `head_html` in a traditional template's head or map the structured `seo` fields and render `json_ld` once in your framework; using both duplicates page metadata. Render `html` in the body, and retain your template's charset and viewport tags. Check article links, images, canonical URL, and robots fields before publishing.

For the publishing and search checklist, read [SEO and AI discovery](https://beulog.com/guides/publishing-seo). Documentation is public and available as HTML, OpenAPI JSON, Markdown, and plain text. These formats help tools retrieve the reference; indexing and search visibility depend on the tools and search engines that read them.
