Focus API

Bring your library into a research notebook, check when a paper is ready to read, or identify the workspace your integration serves.

Manage API keysOpenAPI contractPython exampleReference

Read your first document title

You need a Focus account and Bash or Zsh with curl 7.76 or later. curl --version shows yours.

  1. Sign in to Developer access, choose Create key, and name your integration. Keep List documents in your library selected.
  2. Choose Create API key and confirm your identity when asked. Choose Copy key and save the one-time secret in your application’s secret store.
  3. Paste the command below into Bash or Zsh. When it prompts, paste your key and press Enter. The prompt hides the key.
(
  printf 'Focus API key (hidden): ' >&2
  IFS= read -rs key || exit 1
  printf '\n' >&2
  printf 'Authorization: Bearer %s\n' "$key" |
    curl --silent --show-error --fail-with-body --header @- \
      'https://couldfocus.com/api/v1/documents?limit=1'
)

A successful request returns HTTP 200, prints one JSON object, and exits with status 0. If you have only the starter papers, you’ll see {"data":[],"next":null}. Add a document to your library to see its title, ID, processing status, and timestamps:

{"data":[{"id":"256e6440-bae3-4ec1-9e93-f2d195f0cbb4","title":"Grid cells in the entorhinal cortex","status":"ready","createdAt":"2026-11-28T16:50:03.216Z","updatedAt":"2026-11-28T16:50:03.216Z"}],"next":"256e6440-bae3-4ec1-9e93-f2d195f0cbb4"}

When more documents remain, next holds a cursor. To read the next page, pass it as after. Stop when next is null. A page holds up to 100 items. See list documents.

If the request fails, curl prints the error body and exits with status 22:

{"code":"invalid_api_key","error":"Use an active Focus API key."}curl: (22) The requested URL returned error: 401

Look up the code under Diagnose a failed request. Send requests to couldfocus.com. Other hosts, including www.couldfocus.com, answer API paths with 404 and no JSON body.

Export your library to a notebook

Download the Python example and run it in the folder where you saved it. It uses Python 3’s standard library and the same documents:list key.

python3 focus-library.py > library.jsonl

Enter the key at the hidden terminal prompt. For an unattended job, supply FOCUS_API_KEY from its secret store. The script reads 100 documents per request and follows next to the last page. Each line is one document’s ID, title, status, and timestamps. The file stays on your machine. An empty library produces an empty file.

{"id": "256e6440-bae3-4ec1-9e93-f2d195f0cbb4", "title": "Grid cells in the entorhinal cortex", "status": "ready", "createdAt": "2026-11-28T16:50:03.216Z", "updatedAt": "2026-11-28T16:50:03.216Z"}

The script makes up to three attempts per page. It retries after a connection failure, or after a 429 or 503 response whose Retry-After is 60 seconds or less, and sends the page’s original Idempotency-Key each time. Any other error stops it with the status and code, for example HTTP 401 (invalid_api_key), and a nonzero exit status. The file can then hold a partial library, so import it only after the command exits successfully.

In a Python notebook, count papers by processing status.

import json
from collections import Counter

with open("library.jsonl", encoding="utf-8") as library:
    counts = Counter(json.loads(line)["status"] for line in library)
print(counts)

The output looks like Counter({'ready': 1, 'failed': 1, 'processing': 1}).

Check when a paper is ready

Use a key with Read the details of one document (documents:read). A key can hold only the permissions its application allows. To add this permission to an existing key, choose Edit application and select it, then choose Edit on the key and select it there.

Copy the document ID from the id field of a list response. When the paper is open in Focus, the ID also follows #doc= in the reader’s address. With the key in FOCUS_API_KEY, read the document:

printf 'Authorization: Bearer %s\n' "$FOCUS_API_KEY" |
  curl --silent --show-error --fail-with-body --header @- \
    'https://couldfocus.com/api/v1/documents/f8fdec9a-2a99-40ef-80d3-9fa3d298a800'
{"data":{"id":"f8fdec9a-2a99-40ef-80d3-9fa3d298a800","title":"Place cells revisited","status":"processing","createdAt":"2026-11-28T16:50:03.217Z","updatedAt":"2026-11-28T16:50:03.217Z"}}
processing
Focus is preparing the document.
ready
The document opens in the reader.
failed
Preparation stopped. The document returns to processing if Focus prepares it again.

Focus can add status values within v1. Treat a value you don’t recognize as not ready.

Focus sends no notifications, so check about once a minute. Each check is a new request: it uses one unit and counts toward the account rate. This script waits until the paper is ready or failed, waits through 429 and 503 responses that carry Retry-After, and stops on any other error.

import json, os, time, urllib.error, urllib.request

DOCUMENT = "f8fdec9a-2a99-40ef-80d3-9fa3d298a800"
request = urllib.request.Request(
    "https://couldfocus.com/api/v1/documents/" + DOCUMENT,
    headers={"Authorization": "Bearer " + os.environ["FOCUS_API_KEY"]})
status = "processing"
while status not in ("ready", "failed"):
    try:
        with urllib.request.urlopen(request, timeout=20) as response:
            status = json.load(response)["data"]["status"]
    except urllib.error.HTTPError as error:
        retry = error.headers.get("Retry-After")
        if error.code not in (429, 503) or not retry:
            code = json.load(error)["code"]
            raise SystemExit(f"HTTP {error.code} ({code})")
    if status not in ("ready", "failed"):
        time.sleep(60)
print(status)

A 404 document_not_found means the library has no document with that ID, for example after it was deleted.

Confirm a workspace integration’s target

A workspace key reads one workspace’s ID, name, and organization ID. Use it to confirm which workspace an integration serves before it acts.

  1. Only the organization’s owner can authorize a workspace. The owner manages organizations and their workspaces in Profile and security.
  2. In Developer access, choose New application. Under Resource owner, choose the workspace, keep Read the name and organization of the authorized workspace selected, choose Create application, and confirm with a passkey.
  3. On the new application, choose Add key, then Create API key and Copy key.
  4. With the key in FOCUS_API_KEY, read the workspace:
printf 'Authorization: Bearer %s\n' "$FOCUS_API_KEY" |
  curl --silent --show-error --fail-with-body --header @- \
    'https://couldfocus.com/api/v1/workspace'
{"data":{"id":"d50b28ed-0939-4f24-b559-711001931c3a","name":"Methods","organizationId":"0d1ca340-b444-49e6-8bf7-c24dc3482ddc"}}

Store the returned IDs with the integration’s configuration and compare them on each start. When the organization gets a new owner or is deleted, the grant ends and its keys return 401. Transferring ownership back does not restore it, so the owner creates a new application. Workspace keys cannot read a library, and personal keys cannot read a workspace: both return 403 insufficient_scope.

Replace a key

Keys expire after 90 days by default. Set a different expiry under Key settings when you create or edit a key. An expired key cannot be renewed, so create a replacement.

To rotate without downtime, choose Rotate on the key, select Keep the previous secret working for one hour, and choose Rotate key. Copy the new secret, deploy it, and confirm a request succeeds. Developer access shows when the previous secret stops. Without the overlap, it stops immediately. The overlap never extends past the key’s expiry.

Revoke a compromised key immediately. Revocation invalidates both secrets. Keep secrets in a server-side secret manager and send them only in the Authorization header over HTTPS. You can suspend or revoke access even when your subscription has lapsed.

Diagnose a failed request

Errors contain a machine-readable code and a short error message. Branch on the HTTP status, then on the code. Focus can add codes within v1, so handle an unfamiliar code by its status. Retry only the responses listed under retries. Correct the request or key for the others.

To report a problem, email info@world-wide.org, the contact on the Imprint. Include the response’s X-Request-Id.

400 · invalid_request
The message names the problem: a page size outside 1 to 100, an unknown or repeated query parameter, an after cursor that is not a UUID, an Idempotency-Key that is not one UUID, or a key in the URL.
401 · invalid_api_key
The key is missing, mistyped, expired, suspended, or revoked, or its application is suspended or retired. A workspace key also stops when its grant ends. After a rotation, the previous secret stops when its overlap ends. Check the key and its application in Developer access.
401 · sign_in_required
A Focus API key was sent outside /api/v1. Other Focus routes require a signed-in browser.
402 · api_access_unavailable
The developer plan does not include this operation, or its payment is pending. Check Plan and usage in Developer access.
403 · insufficient_scope
The key or its application lacks the permission, or the key’s application cannot reach this resource.
404 · route_not_found
The path is not an API operation. Check for a trailing slash or a document ID that is not a UUID.
404 · document_not_found
The key owner’s library has no document with this ID.
405 · method_not_allowed
Use GET, as the Allow header states.
409 · idempotency_conflict
Your account already used this Idempotency-Key with another key, operation, or parameters. Repeat the original request, or use a new UUID.
409 · result_changed
The data changed after the original request. Read again with a new UUID.
429 · rate_limit_exceeded
The account rate for this UTC minute is used up. Wait the seconds in Retry-After.
429 · credential_rate_limited
The key’s own rate for this UTC minute is used up. Wait the seconds in Retry-After.
429 · authentication_throttled
Too many requests from your network address used invalid keys. Every request from that address waits for Retry-After, including requests with a valid key. Stop the client sending the invalid key first.
429 · request_limit_reached
The account reached its request allowance for this period. The response has no Retry-After. Check the period and personal limit under Plan and usage.
503 · api_busy
Focus is handling too many API requests. Wait at least Retry-After seconds, then retry with backoff and the same Idempotency-Key.
503 · api_unavailable
Focus could not complete the request. Retry the same way.

Reference

The OpenAPI contract describes the same operations for clients and agent tools. Import it into a server-side client or agent tool and keep the bearer key in the tool’s secret configuration. Reading it needs no key and uses no units.

Requests and responses

Base URL
https://couldfocus.com/api/v1
Method
GET with no request body.
Authorization
Bearer fcs_v1_<key ID>.<secret>, as copied from Developer access. Send one Authorization header.
Query
Only the parameters an operation lists, each at most once.
IDs
UUIDs, in either letter case.
Body
JSON in UTF-8. Timestamps are UTC in ISO 8601 with milliseconds. Responses are private and not cacheable.
X-Request-Id
Your Idempotency-Key, or a new UUID when you send none.
Link
Points to this guide and the OpenAPI contract.

GET /documents

Lists metadata for documents in the key owner’s library. Requires documents:list.

limit
Optional integer from 1 to 100, without leading zeros. Default 25.
after
Optional. The next value from the previous page, unchanged.
200
{"data": [Document], "next": string | null}. next is null on the last page.

Pages list documents in ascending ID order, comparing IDs as lowercase hexadecimal strings. This order is part of v1. Focus gives each document a random UUID (version 4), so the order is unrelated to when documents were added. Each page starts after the last document of the previous one, so documents deleted in between don’t shift later pages. A document added during a paginated read appears only if its ID sorts after your cursor. Start again from the first page for a complete list.

GET /documents/{id}

Reads one document’s metadata. Requires documents:read. Takes no query parameters.

id
Required document ID, from a list response or the reader’s address.
200
{"data": Document}
404
document_not_found when the library has no such document. route_not_found when the ID is not a UUID.

GET /workspace

Reads the workspace authorized for the key’s application. Requires workspace:read. Takes no query parameters.

200
{"data": {"id": string, "name": string, "organizationId": string}}. Both IDs are UUIDs.

Document

id
string, UUID.
title
string. Changes when the reader renames the document or Focus finds its title during preparation.
status
processing, ready, or failed, and possibly values added later. See check when a paper is ready.
createdAt
string, date-time. When the document was added.
updatedAt
string, date-time. When Focus last updated the document, which can happen without a change to its title or status.

Permissions

documents:list
Read a page of library metadata.
documents:read
Read one document’s metadata at /api/v1/documents/{id}.
workspace:read
Read the authorized workspace’s ID, name, and organization ID at /api/v1/workspace.

Each key belongs to one application, and the application’s permissions limit every key it owns. A personal application can hold documents:list and documents:read. A workspace application can hold workspace:read. PDFs, annotations, and reader answers stay in Focus.

A key can create its own personal application. To set permissions first, choose New application, select its resource and permissions, then choose Add key. Multiple keys can belong to one application. You can narrow its permissions, suspend all its keys, or retire it. Narrowing removes the permission from its keys. Widening the application later does not restore it: edit each key to add it again. Personal documents always belong to the reader who added them.

Rate limits and usage

Account rate
120 requests per UTC minute across all keys and applications. Every authenticated request counts, including retries and refusals such as 403, 404, and 409. The count resets when the minute ends.
Key rate
Optional. Set a lower Requests per minute under Key settings.
Rate headers
Responses to authenticated requests include X-RateLimit-Limit (the key rate when set, otherwise 120), X-RateLimit-Remaining, and X-RateLimit-Reset (Unix time in seconds when the minute ends).
Invalid keys
After 30 requests with invalid keys in a minute from one network address, requests from that address return 429 authentication_throttled until Retry-After passes.
Concurrency
Send requests one at a time or a few at once. Focus returns 503 api_busy when it is handling too many API requests.
Units
One new successful request uses one unit, including an empty page. Retries of a successful request and failed requests use none.
Allowance
Plan and usage in Developer access shows the period, units used, any charges, and your optional Personal request limit per period. On free access, the period is the UTC calendar month. The account shares its rate and allowance across all keys.

Choose Refresh usage and activity in Developer access to see the account total, usage by key, and each application’s share. Request outcomes update in batches.

Retries and idempotency

Generate a UUID before sending a request that may need to be retried. Send it in Idempotency-Key on the first call and every retry, with the same key, URL, and parameters.

Versioning

The version is part of the URL. Within v1, Focus can add response fields, document status values, and error codes. Ignore fields you don’t use, treat an unfamiliar status as not ready, and handle an unfamiliar error code by its HTTP status. Pages keep their ID order. Any other change is breaking: it comes with a new API version, announced under API changes before it ships.

API changes

Focus posts a notice here before any breaking change, with the date it takes effect and how to migrate. The OpenAPI contract links here.

No breaking change has been announced.