API for developers

Run the same PDF and document tools as the website from your own scripts and servers.

1. Get a key

API keys are free. Sign in, open Account and choose Create new key. The key is shown once; store it like a password. You can revoke it at any time.

2. Call a tool

Send the file as multipart/form-data with the header Authorization: Bearer sk_…. Results are JSON with the file as base64 (pdf_b64).

curl -s https://YOUR-DOMAIN/merge \
  -H "Authorization: Bearer $STARK_KEY" \
  -F [email protected] -F [email protected] \
  | python3 -c "import sys,json,base64; open('merged.pdf','wb').write(base64.b64decode(json.load(sys.stdin)['pdf_b64']))"
import base64, requests
r = requests.post("https://YOUR-DOMAIN/compress",
                  headers={"Authorization": f"Bearer {KEY}"},
                  files={"file": open("big.pdf", "rb")}, timeout=300)
r.raise_for_status()
open("small.pdf", "wb").write(base64.b64decode(r.json()["pdf_b64"]))

The list of tools and their parameters is in the OpenAPI schema.

Limits and errors

Calls count against your monthly API allowance and the same file-size limits as the website (see Free).

HTTPerrorMeaning
401invalid_api_keyMissing, mistyped or revoked key.
403feature_lockedAPI access is not available for this account (feature: "api").
429api_limit_reachedMonthly allowance used. limit and used are in the body.
429rate_limitedToo many requests per minute. Wait Retry-After seconds.
413file_too_largeFile over the size limit.
503server_busyAll workers busy. Retry after Retry-After seconds.

Keep keys out of browser code and public repositories. Account endpoints (/api/auth, /api/keys) cannot be called with a key.