Concepts
Pagination & formats
Lists are paginated with a cursor. Responses are JSON with predictable conventions.
Cursor pagination#
Every endpoint that returns a list accepts two query parameters:
| Parameter | Details |
|---|---|
limit | Items per page, from 1 to 100. Default: see the endpoint in the API Reference. |
cursor | The next_cursor value from the previous page. Omit it for the first page. |
The response always has this shape:
{
"data": [ { "id": "1043", "...": "..." } ],
"next_cursor": "eyJpZCI6IjEwNDMifQ"
}
When next_cursor is null there are no more pages. Cursors are opaque strings: do not build or modify them, and do not store them for a long time.
Reading every page#
curl "https://api.linework.app/open/v1/me/posts?limit=50" \
-H "Authorization: Bearer $LINEWORK_API_KEY"
# next page: pass the next_cursor you received
curl "https://api.linework.app/open/v1/me/posts?limit=50&cursor=eyJpZCI6IjEwNDMifQ" \
-H "Authorization: Bearer $LINEWORK_API_KEY"
async function* all(path) {
let cursor = null;
do {
const url = new URL(`https://api.linework.app/open/v1${path}`);
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.LINEWORK_API_KEY}` },
});
const page = await res.json();
yield* page.data;
cursor = page.next_cursor;
} while (cursor);
}
for await (const post of all("/me/posts")) console.log(post.id);
import os, requests
API = "https://api.linework.app/open/v1"
s = requests.Session()
s.headers["Authorization"] = f"Bearer {os.environ['LINEWORK_API_KEY']}"
def all_items(path):
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["cursor"] = cursor
page = s.get(API + path, params=params, timeout=30).json()
yield from page["data"]
cursor = page.get("next_cursor")
if not cursor:
break
for post in all_items("/me/posts"):
print(post["id"])
JSON conventions#
- Field names are
camelCase(for examplecreatedAt,mediaIds). The only exception isnext_cursorin list responses. - Ids are strings, even when they look like numbers. Do not parse them as numbers.
- Dates are ISO 8601 strings in UTC, for example
2026-10-14T09:30:00.000Z. - Request bodies are JSON (
Content-Type: application/json), exceptPOST /media, which ismultipart/form-data. - Missing optional values are
nullor omitted; treat both the same way. - New fields may be added to responses at any time: ignore fields you do not know.
Versioning#
The version is in the path (/open/v1). Within v1 we only make backward-compatible changes: new endpoints, new optional parameters, new response fields, new error codes. Breaking changes will come as /open/v2, announced in the changelog well in advance.