API keys and devices
API keys let scripts and writing tools evaluate articles for your readlint.com account. A key has the same evaluation access and allowance as its account. It can read, create and delete that account's reports. It cannot manage keys or approve devices.
Create and store a key
- Sign in and open API keys.
- Choose “Create key”, give it a name you will recognize and choose an expiry. The page offers 7, 30, 90 or 365 days, with 30 selected by default.
- Copy the key while it is shown. Save it in your tool's secret settings or an owner-only file, then choose “I've saved it”. The full secret cannot be retrieved later.
For the curl examples, save one line in readlint-auth.header: Authorization: Bearer followed by your actual key. Use a private directory and set that file's permissions to 600 before entering the secret. Keep it out of source control, logs, terminal history and support messages. The examples read this file so the key does not appear in curl's command arguments. They require curl 7.76 or later.
List saved reports
npx readlint.com list --limit 25 --offset 0 --jsonimport json
from readlint import Readlint
with Readlint() as client:
print(json.dumps(client.list_evaluations(limit=25, offset=0)))import { Readlint } from "readlint.com";
const client = new Readlint();
console.log(JSON.stringify(await client.listEvaluations({ limit: 25, offset: 0 })));curl --silent --show-error --fail-with-body \
--header @readlint-auth.header \
'https://readlint.com/v1/evaluations?limit=25&offset=0'For the SDK and CLI tabs, set READLINT_API_KEY through your secret manager. See the client guides for installation.
A valid key returns HTTP 200 with items and next_offset. An empty account returns items: [] and next_offset: null. Continue with evaluate an article to send a draft. Creating a key does not grant evaluation allowance.
Expiry and revocation
The list shows each key's name, prefix, expiry and active, expired or revoked state. To stop a tool's access, choose “Revoke” for its key and confirm. Future authenticated requests using that key return 401. A model request already sent cannot be recalled.
If you lose a key, revoke it and create another. If creation times out, check the list first: the key may exist even though you never received its secret. Revoke that key before trying again. Signing out of the browser does not revoke issued API keys.
Browser key-management routes
These routes require a browser session. Writes require the Origin and JSON headers described in sign in and sessions. A bearer key is not a substitute for that session.
| Method and path | Behavior |
|---|---|
GET /auth/api-keys | Lists your keys, including expired and revoked ones, newest first. Never returns full secrets. |
POST /auth/api-keys | Accepts name (1–200 characters, with a non-whitespace character) and optional expires_in_days (1–365, default 30). Returns 201 with metadata and the one-time secret. Names are trimmed and need not be unique. This create is not idempotent. |
DELETE /auth/api-keys/{key_id} | Revokes your key and returns 204, including when already revoked. An unknown or other account's ID returns 404 api_key_not_found. |
Device authorization
Device authorization connects a terminal tool without asking you to copy a browser cookie. Protocol implementers can use the two form-encoded routes in the API reference. The public CLI installation guide explains readlint login. The command shows the approval URL and code, polls for your decision and stores the resulting key in an owner-only file. It also accepts READLINT_API_KEY or --api-key. readlint logout removes the local credential; revoke the key here to stop all copies.
- POST
/auth/device/codeasapplication/x-www-form-urlencodedwithclient_id=readlint-cli. Optionalhostname(up to 200 characters) andos(up to 100) identify the requesting tool. The response includes a secretdevice_code, a visibleuser_code,verification_uri,verification_uri_complete,expires_in: 600andinterval: 5. - Open the returned verification URL in a browser. Sign in, check the account, user code, device name and OS, then choose “Approve” or “Deny”. Approve only a request you started. The name and OS are supplied by the requesting tool, so they are not proof of identity.
- Poll POST
/auth/device/tokenwith form fieldsclient_id=readlint-cli,grant_type=urn:ietf:params:oauth:grant-type:device_codeanddevice_code. Wait at least the returned interval before polling, including after approval. - A successful exchange returns
access_token,token_type: "Bearer"andexpires_in. This is an API key valid for 30 days. Save it privately. It appears on the API keys page with a name beginningCLI:and can be revoked there.
The browser page also accepts a user code at Approve a device. It displays pending, approved, denied, used or expired state. A request lasts ten minutes and allows one decision. Repeating a decision returns 409 device_request_not_pending; read its status after an uncertain response.
Token polling returns HTTP 400 with an OAuth error when it cannot issue a key:
| Error | Next step |
|---|---|
authorization_pending | Wait the polling interval and poll again. |
slow_down | Increase the interval by five seconds for this and later polls. |
expired_token | Start a new device request. |
access_denied | Stop. The request was denied, used, or its approving browser session is no longer valid. |
invalid_grant | Stop and check the device code and client ID. |
unsupported_grant_type | Use the exact grant type above. |
The exchange is single-use. If its successful response is lost, the secret cannot be recovered by polling again. Check the API-key list for the new CLI key, revoke it and start again. Signing out of the approving session before exchange invalidates its approval.
The service permits 300 device-code requests per ten minutes across the product. Browser lookups and decisions share 30 attempts per account per ten minutes. Exceeding either limit returns 429 rate_limited without a guaranteed Retry-After header. Wait for the ten-minute window before trying again. A missing or inaccessible code returns 404 device_request_unknown. Keep device codes and access tokens out of URLs, logs and source control; only the visible user code belongs in the verification URL.