Skip to main content
API Reference

PAK4L Public API

Integrate enterprise-grade document intelligence into your workflow. Analyze contracts, policies, and technical documents programmatically.

Base URLhttps://api.pak4l.ai

Authentication

All API requests require authentication via an API key. Include your key in the Authorization header of every request. API keys are available on Business and Enterprise tiers.

API keys follow the format agr_live_... for production keys. You can create and manage keys from the Developer Dashboard.

HTTP Header
Authorization: Bearer agr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cURL Example
curl https://api.pak4l.ai/api/review/abc-123/status \
  -H "Authorization: Bearer agr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Keep your API keys secure

Never expose API keys in client-side code or public repositories. Use environment variables and server-side calls only. If a key is compromised, regenerate it immediately from the Developer Dashboard.


API Endpoints

Click any endpoint to expand its documentation, including parameters, request body, and response examples.

Submit plain text for analysis. The system will assign expert agents based on the document type, run a full multi-agent review, and return a structured intelligence report. Use the returned review_id to poll for status and retrieve results.

Request Body

ParameterTypeRequiredDescription
document_textstringRequiredThe full text of the document to analyze.
document_titlestringRequiredHuman-readable title for the document.
presetstringOptionalReview preset: "comprehensive", "quick", "legal", "technical", "compliance". Defaults to "comprehensive".
enable_deep_reviewbooleanOptionalEnable deep review mode for more thorough analysis. Uses additional credits. Defaults to false.
output_languagestringOptionalLanguage for the output report: "English", "Italian", "Spanish", etc. Defaults to "English".
webhook_urlstringOptionalURL to receive a POST callback when the review completes.

Request Example

cURL
curl -X POST https://api.pak4l.ai/api/review/text-review \
  -H "Authorization: Bearer agr_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "document_text": "AGREEMENT between Party A and Party B...",
    "document_title": "Service Agreement Q1 2026",
    "preset": "legal",
    "output_language": "English",
    "webhook_url": "https://your-app.com/webhooks/pak4l"
  }'

Response

JSON
{
  "review_id": "rev_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "in_progress",
  "credits_used": 12
}

Download Endpoints

After a review completes, download the results in various formats. All download endpoints are GET requests and return the file directly. Check the status endpoint for available artifacts before downloading.

MethodEndpointDescription
GET/api/review/{id}/download/txtRevised plain text
GET/api/review/{id}/download/mdMarkdown report
GET/api/review/{id}/download/jsonFull structured JSON
GET/api/review/{id}/download/redlineRedline DOCX with tracked changes
GET/api/review/{id}/download/revised-docxFormatted revised DOCX
GET/api/review/{id}/download/pdfAnalytics PDF report
GET/api/review/{id}/download/reportIntelligence Report PDF
GET/api/review/{id}/download/zipAll files as ZIP archive

Example

cURL
# Download the redline DOCX
curl -o redline.docx \
  https://api.pak4l.ai/api/review/rev_a1b2c3d4/download/redline \
  -H "Authorization: Bearer agr_live_xxx"

# Download everything as ZIP
curl -o review_bundle.zip \
  https://api.pak4l.ai/api/review/rev_a1b2c3d4/download/zip \
  -H "Authorization: Bearer agr_live_xxx"

Webhooks

Instead of polling for review status, you can provide a webhook_url when starting a review. PAK4L will send a POST request to your URL when the review completes or fails.

Set the webhook_url parameter in the text-review or upload request body. Your endpoint must return a 2xx status code within 10 seconds.

Webhook Payload

JSON
{
  "event": "review.completed",
  "review_id": "rev_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "completed",
  "credits_used": 12,
  "artifacts": [
    "txt", "md", "json", "redline", "revised-docx", "pdf", "report", "zip"
  ],
  "timestamp": "2026-02-28T10:17:45Z"
}

Retry Policy

Failed deliveries are retried 3 times with exponential backoff: 30 seconds, 5 minutes, 30 minutes.

Event Types

  • review.completed - Review finished successfully
  • review.failed - Review encountered an error

Rate Limits

API rate limits are enforced per account on a monthly basis. When you exceed your limit, requests will receive a 429 status code.

TierMonthly LimitPer Minute
Business1,000 calls/month60 requests/min
EnterpriseUnlimited120 requests/min

Rate Limit Headers

HTTP Response Headers
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 847
X-RateLimit-Reset: 2026-03-01T00:00:00Z

Error Codes

PAK4L uses standard HTTP status codes. Errors include a JSON body with a detail field describing the issue.

CodeStatusDescription
400Bad RequestInvalid or missing parameters in the request body.
401UnauthorizedMissing or invalid API key in the Authorization header.
402Insufficient CreditsYour account does not have enough credits for this operation.
403ForbiddenYour tier does not have access to this feature. Upgrade required.
404Not FoundThe requested review or resource does not exist.
429Rate LimitedMonthly or per-minute rate limit exceeded. Retry after the reset period.
500Server ErrorInternal error. Please retry or contact support if the issue persists.

Error Response Example

JSON
{
  "detail": "Insufficient credits. Required: 12, available: 3. Please top up your account.",
  "error_code": "INSUFFICIENT_CREDITS",
  "status": 402
}

SDKs & Libraries

Py

Python SDK

Coming Soon

pip install pak4l - Typed client with async support, automatic retries, and streaming.

pip install pak4l  # coming soon
JS

Node.js SDK

Coming Soon

npm install @pak4l/sdk - TypeScript-first with full type definitions and webhook helpers.

npm install @pak4l/sdk  # coming soon

In the meantime, use the REST API directly. Need help integrating? Contact us


Ready to build?

Get your API key and start analyzing documents programmatically in minutes.