Authentication
Authenticate with the Bitparse API using API keys.
Every request to the Bitparse API must include a valid API key. Keys are scoped to your account and track credit usage.
API Key Format
All keys use the prefix bp_ followed by a random string:
bp_k7G2mXpLw9...The full key is shown only once at creation time. Store it in a secure location such as an environment variable or secrets manager.
Sending the Key
Pass the key in the X-API-Key header on every request:
curl -X POST https://api.bitparse.ai/parse \
-H "X-API-Key: bp_YOUR_API_KEY" \
-F "file=@document.pdf"Do not send the key as a query parameter or in the request body — these methods are not supported.
Creating a Key
- Sign in to the Bitparse Dashboard.
- Navigate to Settings > API Keys.
- Click Create Key and give it an optional label (e.g., "Production", "CI").
- Copy the key immediately. You will not be able to view it again.
Revoking a Key
To revoke a key, open Settings > API Keys in the dashboard and click the delete icon next to the key you want to remove. Revoked keys return 401 Unauthorized immediately.
Best Practices
| Practice | Why |
|---|---|
| Store keys in environment variables | Keeps them out of source control |
| Use separate keys per environment | Easier to rotate and audit |
| Rotate keys periodically | Limits exposure if a key leaks |
| Never commit keys to git | Prevents accidental public exposure |
Example: Using an Environment Variable
export BITPARSE_API_KEY="bp_YOUR_API_KEY"
curl -X POST https://api.bitparse.ai/parse \
-H "X-API-Key: $BITPARSE_API_KEY" \
-F "file=@document.pdf"import os, requests
resp = requests.post(
"https://api.bitparse.ai/parse",
headers={"X-API-Key": os.environ["BITPARSE_API_KEY"]},
files={"file": open("document.pdf", "rb")},
)Error Responses
| Status | Meaning |
|---|---|
401 Unauthorized | Missing or invalid API key |
402 Payment Required | Valid key but insufficient credits |