Skip to main content

Create Job

Submit a document for parsing.

POST /v1/jobs

Request Body

ParameterTypeRequiredDescription
source_typestringYesDocument source type: "url" or "file"
source_urlstringConditionalRequired if source_type is "url". URL of the document.
file_namestringConditionalRequired if source_type is "file". Name of the file including extension.
data_idstringNoYour custom identifier for this document. Included in results for easy mapping. Max 128 chars, alphanumeric with -, _, . allowed.
parsing_paramsobjectNoParsing configuration options.
parsing_params.modelstringNoModel to use: "base" (default) or "advanced". Different credit costs apply.
parsing_params.ocr_enabledbooleanNoEnable OCR for scanned documents or images. Default: false.

Response

For source_type: "url"

Status: 202 Accepted

The job is immediately queued for processing.

{
"job_id": "job_abc123def456",
"status": "pending",
"source_type": "url",
"data_id": "my_document_001",
"created_at": "2025-01-15T10:30:00Z"
}

For source_type: "file"

Status: 200 OK

Returns an upload URL for the file.

{
"job_id": "job_xyz789ghi012",
"status": "waiting-file",
"source_type": "file",
"data_id": "my_document_002",
"upload_url": "https://storage.knowhereto.ai/uploads/job_xyz789ghi012?X-Amz-...",
"upload_headers": {
"Content-Type": "application/pdf"
},
"created_at": "2025-01-15T10:30:00Z"
}

Examples

Parse Document from URL

curl -X POST https://api.knowhereto.ai/v1/jobs \
-H "Authorization: Bearer $KNOWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_type": "url",
"source_url": "https://arxiv.org/pdf/1706.03762.pdf",
"data_id": "attention_paper",
"parsing_params": {
"model": "base",
"ocr_enabled": false
}
}'

Upload Local File

# Step 1: Create job
curl -X POST https://api.knowhereto.ai/v1/jobs \
-H "Authorization: Bearer $KNOWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_type": "file",
"file_name": "quarterly_report.pdf",
"data_id": "q3_2025_report"
}'

# Response:
# {
# "job_id": "job_xyz789",
# "status": "waiting-file",
# "upload_url": "https://storage.knowhereto.ai/...",
# "upload_headers": {"Content-Type": "application/pdf"}
# }

# Step 2: Upload file
curl -X PUT "https://storage.knowhereto.ai/..." \
-H "Content-Type: application/pdf" \
--data-binary @quarterly_report.pdf

With Advanced Options

curl -X POST https://api.knowhereto.ai/v1/jobs \
-H "Authorization: Bearer $KNOWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_type": "url",
"source_url": "https://example.com/scanned_document.pdf",
"data_id": "scanned_001",
"parsing_params": {
"model": "advanced",
"ocr_enabled": true
}
}'

Errors

CodeHTTP StatusDescription
INVALID_ARGUMENT400Missing or invalid parameters
UNAUTHENTICATED401Invalid API key
RESOURCE_EXHAUSTED429Rate limit exceeded

Example Error Response

{
"success": false,
"error": {
"code": "INVALID_ARGUMENT",
"message": "source_url must be a valid HTTP or HTTPS URL",
"request_id": "req_abc123",
"details": {
"field": "source_url",
"reason": "INVALID_URL_FORMAT"
}
}
}

Supported File Formats

FormatExtensionMax Size
PDF.pdf100 MB
Word.docx50 MB
Excel.xlsx50 MB
PowerPoint.pptx100 MB

Next Steps