Plank help · updated 2026-11-22

Public API & API keys

Create an API key and read or write your Plank workspace files from your own tools — scripts, integrations, or a coding assistant like Claude Code.

Agents: fetch the raw markdown of this page at /en/help/public-api.md

Public API & API keys

Your Plank files don't have to stay inside the app. With an API key you can read — and, if you choose, write — the documents in your workspaces from your own tools: a script, an integration, or a coding assistant like Claude Code running on your laptop.

The API is the same one the Plank app uses, exposed as a stable, versioned surface under /v1 so you can build against it without it shifting under you.

This page is for code that runs OUTSIDE Plank. A script that runs in your workspace — anything the agent writes under scripts/, anything a dashboard's Sync or Refresh button starts — already has access to your files and your app-data tables and needs no key at all. An agent must never ask you to create an API key, or to paste one into a chat, to make something inside your workspace work; if one asks, that is a bug. See App data → a "Sync" button runs a script for what it should do instead.

Create a key

Go to Settings → API keys and click Create key. You choose:

  • Name — a label so you remember where it's used ("My laptop", "Reporting script").
  • Workspaces — which workspaces the key can reach: one, several, or all of your workspaces. A key can never reach a workspace you aren't a member of.
  • Access — Read-only (list, read, search, download) or Read & write (also create, overwrite, move, delete).
  • Expiry (optional) — a date after which the key stops working.

The key is shown once, right after you create it — copy it then. Plank stores only a secure hash, so it can't show it to you again. If you lose it, revoke it and make a new one. You can revoke any key at any time from the same screen, and it stops working immediately.

A key looks like plank_pat_…. Treat it like a password: anyone holding it has the access you granted.

Use a key

Send the key as a bearer header on every request:

Authorization: Bearer plank_pat_xxxxxxxx

Always start with whoami to discover which workspaces the key can see and their ids — you pass a workspace id into every file call.

# Discover your access
curl -H "Authorization: Bearer $PLANK_API_TOKEN" \
  https://api.plank.md/v1/whoami
# → { "user_id": "...", "token": { "can_write": true },
#     "workspaces": [ { "id": "ws_123", "slug": "q1-reports", "name": "Q1 Reports" } ] }

Then read, list, search, and write files in a workspace. Paths are relative to the workspace root (e.g. reports/q1.md).

WS=ws_123
BASE=https://api.plank.md/v1/workspaces/$WS
AUTH="Authorization: Bearer $PLANK_API_TOKEN"

# List a directory
curl -H "$AUTH" "$BASE/files?path=reports"

# Read a file
curl -H "$AUTH" "$BASE/files/content?path=reports/q1.md"

# Search
curl -H "$AUTH" "$BASE/search?q=revenue"

# The whole file tree
curl -H "$AUTH" "$BASE/tree"

# Write (create or overwrite) — needs a read & write key
curl -X PUT -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/files/content?path=reports/draft.md" \
  -d '{ "content": "# Draft\n\nHello." }'

# Move / rename
curl -X POST -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/files/move" -d '{ "source": "reports/draft.md", "dest": "reports/final.md" }'

# Delete
curl -X DELETE -H "$AUTH" "$BASE/files?path=reports/final.md"

PDFs, images and other binary files

Text files go through the API as-is. Binary files — PDFs, images, Word and Excel documents — must be sent and fetched as base64, otherwise the bytes get mangled on the way through.

# Download a binary file to disk
curl -H "$AUTH" -H "Accept: application/octet-stream" \
  "$BASE/files/content?path=acts/scan.pdf" -o scan.pdf

# ...or as base64 inside the normal JSON response
curl -H "$AUTH" "$BASE/files/content?path=acts/scan.pdf&encoding=base64"

# Upload a binary file
curl -X PUT -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/files/content?path=acts/scan.pdf" \
  -d "{\"content\": \"$(base64 < scan.pdf | tr -d '\n')\", \"encoding\": \"base64\"}"

A few things worth knowing:

  • If the base64 contains invalid characters, or mixes the two base64 alphabets, the request fails with 400.
  • Validation cannot detect a payload that was cleanly truncated, so for large uploads compare the size from a follow-up read against your file.
  • Uploads are limited to about 18 MB per file (the 25 MB request limit, minus base64 overhead).
  • Downloads with Accept: application/octet-stream are streamed and limited to 5 GB (the same as an upload); the ?encoding=base64 form is limited to 25 MB, because base64 has to be held in memory as text.
  • Leave encoding off entirely for ordinary text files; nothing changes for them.
  • A read returns the file's real bytes or an error — never an empty body for a file that is not empty. If the file could not be read whole, the answer is 503: wait a few seconds and read it again. An empty content with size: 0 means the file really is empty.

Your workspace database

Some agent-built dashboards and CRMs in Plank store their data in real tables — the workspace database ("Lightweight Apps"). Your key can read and manage those tables too, with the same access level you gave it for files: read-only keys can list, describe, and query rows; read & write keys can also create tables and insert, update, or delete rows.

BASE=https://api.plank.md/v1/workspaces/$WS
AUTH="Authorization: Bearer $PLANK_API_TOKEN"

# List the tables in this workspace
curl -H "$AUTH" "$BASE/app-data/tables"

# Describe a table's columns
curl -H "$AUTH" "$BASE/app-data/tables/invoices"

# Query rows — filter and sort with JSON query params
curl -H "$AUTH" "$BASE/app-data/tables/invoices/rows?where={\"status\":\"open\"}&orderBy={\"column\":\"total\",\"direction\":\"desc\"}&limit=25"

# Create a table — needs a read & write key
curl -X POST -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/app-data/tables" \
  -d '{ "name": "invoices", "columns": [ { "name": "customer", "type": "text" }, { "name": "total", "type": "numeric" } ] }'

# Insert a row
curl -X POST -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/app-data/tables/invoices/rows" \
  -d '{ "customer": "Acme Co", "total": 199.50 }'

# Update a row by id
curl -X PATCH -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/app-data/tables/invoices/rows/<row-id>" \
  -d '{ "status": "paid" }'

# Delete a row by id
curl -X DELETE -H "$AUTH" "$BASE/app-data/tables/invoices/rows/<row-id>"

# Ranges, one-of, only some columns, and a page at a time
curl -G -H "$AUTH" "$BASE/app-data/tables/invoices/rows" \
  --data-urlencode 'where={"total":{"gte":1000,"lt":5000},"status":{"in":["open","overdue"]},"paid_at":null}' \
  --data-urlencode 'columns=["code","customer","total"]' \
  --data-urlencode 'orderBy=[{"column":"total","direction":"desc"}]' \
  --data-urlencode 'limit=100'
# → { "data": [...], "next_cursor": "…" }   pass it back as cursor=… for the next page

# Count rows with the same where
curl -G -H "$AUTH" "$BASE/app-data/tables/invoices/rows/count" --data-urlencode 'where={"status":"open"}'
# → { "data": { "count": 12 } }

# Insert up to 500 rows in one call — all land or none does
curl -X POST -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/app-data/tables/invoices/rows/bulk" \
  -d '{ "rows": [ { "customer": "Acme Co", "total": 199.5 }, { "customer": "Beta LLC", "total": 40 } ] }'

# Update up to 500 rows by id in one transaction — a bad value cancels the whole call; an unknown id is not an error, it comes back in missingIds while the other rows are written
curl -X PATCH -H "$AUTH" -H "Content-Type: application/json" \
  "$BASE/app-data/tables/invoices/rows/bulk" \
  -d '{ "updates": [ { "id": "<row-id>", "patch": { "status": "paid" } } ] }'

A quick reference:

  • List tables — GET .../app-data/tables
  • Describe a table — GET .../app-data/tables/:table (columns + types)
  • Read rows — GET .../app-data/tables/:table/rows. All parameters are optional; an unknown parameter, operator or column is a 400, never ignored:
    • where — {"col": value} is equality, {"col": null} is "is empty", and {"col": {"gt"|"gte"|"lt"|"lte": n, "ne": v, "in": [≤ 500 values], "is_null": true|false, "contains": "text"}} — ranges work on numbers, dates and timestamps; contains is a case-insensitive substring on text (% and _ match themselves). Columns are ANDed.
    • orderBy — {"column", "direction"} or an array of up to 8 of them.
    • columns — ["code","title"]: only these columns are read.
    • limit (0–10,000), offset, and cursor. With limit ≥ 1 the answer carries next_cursor (null on the last page); pass it back as cursor with the same where, orderBy and limit. A cursor from another table, filter or order is a 400. A read with limit ≥ 1 and no orderBy is ordered by id. Nulls sort last in ascending order and first in descending.
  • Count rows — GET .../app-data/tables/:table/rows/count?where=... → { "data": { "count": n } }
  • Insert / update many rows — POST / PATCH .../app-data/tables/:table/rows/bulk with { "rows": [...] } / { "updates": [{ "id", "patch" }] }: at most 500 rows and 4 MB per call, one transaction
  • Create a table — POST .../app-data/tables
  • Insert / update / delete a row — POST / PATCH / DELETE on .../app-data/tables/:table/rows[/:id]

You can create new tables from your own tools, but changing the shape of an existing table — adding, renaming, or dropping a column, or adding a relationship between tables — is done by the agent inside Plank, not through this API.

Upload a recorded call

POST .../calls turns a recorded call into a transcript in your workspace. It is what the Plank Desktop call recorder uses, and it needs a read & write key. Send multipart/form-data with:

  • a text field manifest holding JSON: { "callId": "<uuid>", "startedAt": "2026-10-22T14:05:00+05:00", "durationMs": 754000, "title": "optional", "segments": [ { "file": "s1", "track": "me", "startMs": 0, "durationMs": 1800 } ] }. track is me (your microphone, shown as «Я») or them (the other side, «Собеседник»).
  • one audio part per segment, named exactly as that segment's file. Allowed types: audio/mp4, audio/x-m4a, audio/aac, audio/mpeg, audio/webm, audio/ogg, audio/wav, audio/x-wav.
curl -X POST -H "$AUTH" "$BASE/calls" \
  -F 'manifest={"callId":"1a2b3c4d-5e6f-4000-8000-000000000001","startedAt":"2026-10-22T14:05:00+05:00","durationMs":60000,"segments":[{"file":"s1","track":"me","startMs":0,"durationMs":1800}]}' \
  -F 's1=@s1.wav;type=audio/wav'
# → { "data": { "path": "calls/2026-10-22 1405 Звонок 1a2b3c4d/transcript.md",
#               "utterances": 1, "transcribedSeconds": 2 } }
  • The transcript is written to calls/<date> <HHmm> <title or «Звонок»> <first 8 characters of callId>/transcript.md, using the time as written in startedAt — send your local offset, not UTC.
  • Retrying is safe. The same manifest always writes the same file, so a retried upload replaces the transcript instead of creating a second call. Keep the manifest unchanged between retries.
  • All or nothing. If a segment still fails after one retry, the request fails with 502 and nothing is written; upload the call again.
  • Limits: 25 MB per segment, 2000 segments and 300 MB per request, 10 requests a minute per key.
  • Transcription time counts against the workspace's AI allowance.

Using it with Claude Code

Drop a snippet like this into your project's CLAUDE.md so the assistant knows how to reach your Plank files:

## Plank file access

My Plank business documents are available over the Plank public API.
- Base URL: https://api.plank.md/v1
- Auth: send header `Authorization: Bearer $PLANK_API_TOKEN` (the key is in my environment).
- First call `GET /whoami` to discover my workspace ids.
- For PDFs, images, or Office files add `&encoding=base64` when reading and send
  `{ "content": "<base64>", "encoding": "base64" }` when writing. Plain text needs neither.
- Then read files with `GET /workspaces/<id>/files/content?path=<relative/path>`,
  list with `/files?path=`, search with `/search?q=`, and (if needed) write with
  `PUT /workspaces/<id>/files/content?path=`.

Set the key in your shell so it never lands in the repo (the variable name is yours to choose — PLANK_API_TOKEN is just what these examples use):

export PLANK_API_TOKEN=plank_pat_xxxxxxxx

Limits & good practice

  • Scope tightly. Give a key only the workspaces and the access (read vs write) it actually needs. A read-only key can't change anything, which makes a leak far less costly.
  • Rotate and revoke. If a key might be exposed, revoke it and issue a new one — it's instant.
  • A table or column name that isn't allowed — one that doesn't match ^[a-z][a-z0-9_]*$, or that starts with pg_ or information_schema (those belong to the database itself) — answers 400 with "code": "invalid_table_name" (or "invalid_column_name"). Don't retry it; pick another name.
  • A folder that doesn't exist answers 404 with "code": "not_found" when you list it — don't retry it. A 5xx is a problem on our side and is worth retrying after a moment.
  • Rate limits. Requests are rate-limited per key; if you're batching heavy work, pace it and handle 429 responses by retrying after a moment.
  • 401 means the key is wrong; 503 means we could not check it. 401 (unknown, revoked or expired key) and 403 (key not allowed in this workspace, or read-only) are final — don't retry them. If our database does not answer while we look the key up, you get 503 with a Retry-After: 5 header: the key is fine, keep it, wait that many seconds and send the same request again.
  • Full reference. The complete, always-current endpoint reference (OpenAPI) is published at /v1/docs, with the raw spec at /v1/openapi.json — point codegen tools at that.