Authentication
Send API keys as bearer tokens from a server process. The backend contract marks browser execution as disabled.
API docs preview
These docs are rendered from the backend developer contract route. They expose current endpoint contracts, job metadata, idempotency guidance, webhook events, and local launch boundaries without duplicating the API surface in page-local arrays.
Send API keys as bearer tokens from a server process. The backend contract marks browser execution as disabled.
Pass `idempotency-key` on mutation endpoints. Repeated requests with the same key must return the original mutation result instead of duplicating work.
Not Live; local contract evidence only
curl https://api.clearpdf.net/v1/jobs \
-H "authorization: Bearer $CLEARPDF_API_KEY" \
-H "content-type: application/json" \
-H "idempotency-key: example-invoice-001" \
-d '{
"jobType": "extract_invoice",
"processingMode": "api",
"inputFileIds": ["file_example_source"],
"settings": { "confidenceThreshold": 0.85 },
"webhookUrl": "https://example.com/webhooks/clearpdf"
}'Upload and job operations use bearer auth, server-side API keys, scoped permissions, and idempotency for mutation retries. Result URLs are requested separately after a job succeeds.
Jobs start as queued, report progress from 0 to 100, and finish as succeeded, failed, cancelled, deleted, or expired. The job contract includes worker service, operation, pricing key, and quality checks.
{
"id": "job_example_queued",
"jobType": "extract_invoice",
"processingMode": "api",
"status": "queued",
"progress": 0,
"inputFileIds": [
"file_example_source"
],
"apiContract": {
"family": "document_extraction_api",
"endpoint": "jobs.create",
"endpointPricingKey": "document.extract",
"requestSchema": "create_job_request_v1",
"responseSchema": "job_response_v1",
"settingsSchema": "structured_extraction_settings_v1",
"workerService": "api-orchestrator",
"workerOperation": "extract-invoice",
"outputKind": "json",
"outputContainer": "single_file",
"workerContractVersion": "api_orchestrator_contract_v1",
"qualityControls": [
"queue_receipt_contract"
],
"workerAdmission": {
"requiresWorkerHeartbeat": true,
"requiresQueueDispatch": true,
"workerServiceUrlEnvVar": "AI_WORKER_URL",
"requiresCloudObjectStorage": true,
"resultMaterializationVerificationRequiredInProduction": true,
"requiredReadiness": [
"worker_active",
"worker_contract_version",
"worker_lease_fresh",
"operation_ready",
"capacity_available",
"queue_subscription",
"storage_read",
"storage_write",
"malware_admission",
"result_write",
"queue_backend_bullmq",
"worker_service_url",
"cloud_object_storage",
"reserved_output_uri_materialized"
],
"requiredRuntimeBinaries": [],
"requiredOutputProofs": [
"contentType",
"sizeBytes",
"magicBytes",
"reservedOutputUri"
],
"productionLaunchStatus": "not_live"
},
"webhookEvents": [
"job.created",
"job.progress",
"job.succeeded",
"job.failed",
"job.cancelled"
],
"idempotencyKey": "example-invoice-001",
"webhookConfigured": true,
"localContractOnly": true,
"productionLaunchStatus": "not_live"
}
}import os
import requests
response = requests.post(
"https://api.clearpdf.net/v1/jobs",
headers={
"authorization": f"Bearer {os.environ['CLEARPDF_API_KEY']}",
"content-type": "application/json",
"idempotency-key": "example-python-001",
},
json={
"jobType": "ocr_pdf",
"processingMode": "api",
"inputFileIds": ["file_example_source"],
"settings": {"languages": ["eng"], "deskew": True},
},
timeout=30,
)
response.raise_for_status()
print(response.json()["status"])The generated sample uses environment-provided API keys, a non-secret example file ID, explicit idempotency, and HTTP error handling before reading the response.
import { ClearPDF, ClearPdfApiError } from "@clearpdf/sdk-typescript";
const clearpdf = new ClearPDF({ apiKey: process.env.CLEARPDF_API_KEY });
try {
const job = await clearpdf.client.jobs.create({
jobType: "extract_text",
processingMode: "api",
inputFileIds: ["file_example_source"],
settings: { includeLayout: true, includePageCitations: true },
idempotencyKey: "example-extract-text-001"
});
console.log(job.status);
} catch (error) {
if (error instanceof ClearPdfApiError) {
console.error({ status: error.status, code: error.code });
}
throw error;
}import os
from clearpdf import ClearPDF, ClearPdfApiError
client = ClearPDF(api_key=os.environ["CLEARPDF_API_KEY"])
try:
job = client.create_text_extraction_job(
["file_example_source"],
settings={"includeLayout": True, "includePageCitations": True},
idempotency_key="example-extract-text-001",
)
print(job["status"])
except ClearPdfApiError as error:
print({"status": error.status, "code": error.code})
raiseSubscribe to job.created, job.progress, job.succeeded, job.failed, job.cancelled, file.deleted. Consumers should verify timestamp tolerance and HMAC signature before trusting a job status transition.
const rawBody = await request.text();
const timestamp = request.headers.get("x-clearpdf-timestamp");
const signature = request.headers.get("x-clearpdf-signature");
// Verify HMAC-SHA256 over `${timestamp}.${rawBody}` with your webhook secret.
// Reject missing headers and timestamps outside the configured tolerance.apps/api/src/schemas/jobs.ts#createJobSchema, apps/api/src/services/jobs.ts#apiContractForJob, apps/api/src/app.ts#/v1/developer
400 BAD_REQUEST, 401 UNAUTHORIZED, 403 FORBIDDEN, 409 CONFLICT, 429 RATE_LIMITED
Current API documentation is backend-generated local contract evidence. It does not prove production traffic, partner approval, live payment processing, or webhook deliverability SLA.