How to use ZeroDrift
The public ZeroDrift API is a short workflow: obtain a bearer token, upload a zip archive, create an audit session from that upload, poll status, and read findings. The public API does not expose GitHub repository selection; use direct zip uploads for external integrations.
Base URL
https://zerodrift.xyz/api
Send the same bearer token on every protected request:
Authorization: Bearer <token>
Run an audit
A normal integration moves through four steps. Keep the ids returned at each stage because the next request depends on them.
- Get a token. Generate or copy a bearer token from your ZeroDrift account.
- Upload source. Send a zip archive to
POST /api/audit/upload; the response returnsupload_id. - Create the session. Call
POST /api/audit/sessionswith{ "uploadId": "..." }. - Read results. Poll
GET /api/audit/sessions/:sessionId/status, then fetchGET /api/audit/sessions/:sessionId/findings.
Upload uses normal multipart form data.
export TOKEN="<token>"
export ZIP="/path/to/protocol.zip"
# 1. Upload a zip
curl -X POST "https://zerodrift.xyz/api/audit/upload" \
-H "Authorization: Bearer $TOKEN" \
-F "file=@$ZIP"
# 2. Create an audit session from the upload id
curl -X POST "https://zerodrift.xyz/api/audit/sessions" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"uploadId":"upl_123"}'
# 3. Poll status, then read findings
curl "https://zerodrift.xyz/api/audit/sessions/$SESSION_ID/status" \
-H "Authorization: Bearer $TOKEN"
curl "https://zerodrift.xyz/api/audit/sessions/$SESSION_ID/findings" \
-H "Authorization: Bearer $TOKEN"
The upload response uses upload_id, while the session creation request uses uploadId.
Errors and access
Most integration problems surface as standard HTTP status codes.
| Code | Meaning |
|---|---|
400 | The request body was missing file or uploadId. |
401 | The bearer token was missing, malformed, expired, or revoked. |
402 | The audit balance was too low to create a session. Top up and retry the same uploadId. |
5xx | The audit backend is temporarily unavailable. Sessions that were already created can still be polled. |
Session-level endpoints enforce ownership checks before returning data, so a token can only read sessions it created.