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).
| HTTP | error | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, mistyped or revoked key. |
| 403 | feature_locked | API access is not available for this account (feature: "api"). |
| 429 | api_limit_reached | Monthly allowance used. limit and used are in the body. |
| 429 | rate_limited | Too many requests per minute. Wait Retry-After seconds. |
| 413 | file_too_large | File over the size limit. |
| 503 | server_busy | All 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.