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.
llm_configobjectNov2 only (POST /v2/jobs). Bring-your-own-key (BYOK) OpenAI-compatible LLM credentials. Flat {api_key, model, base_url} applies to both channels; models picks per-channel model ids on the same endpoint; text / vision objects replace a channel entirely. When omitted, server defaults are used.
llm_config.api_keystringConditionalRequired with base_url plus model and/or models. Provider API key.
llm_config.modelstringConditionalDefault model for both channels (overridden by models.*).
llm_config.base_urlstringConditionalRequired with api_key plus model and/or models. OpenAI-compatible base URL.
llm_config.modelsobjectNoPer-channel model ids sharing root api_key / base_url.
llm_config.models.textstringNoText / planning model id.
llm_config.models.visionstringNoVision / VLM model id.
llm_config.textobjectNoText / planning LLM provider config (replaces root for text).
llm_config.text.api_keystringConditionalRequired when text is present. Provider API key.
llm_config.text.modelstringConditionalRequired when text is present. Model identifier.
llm_config.text.base_urlstringConditionalRequired when text is present. OpenAI-compatible base URL.
llm_config.visionobjectNoVision / VLM provider config (replaces root for vision).
llm_config.vision.api_keystringConditionalRequired when vision is present. Provider API key.
llm_config.vision.modelstringConditionalRequired when vision is present. Model identifier.
llm_config.vision.base_urlstringConditionalRequired when vision is present. OpenAI-compatible base URL.

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
}
}'

With Custom LLM (BYOK)

llm_config is available on POST /v2/jobs only. OpenAI-compatible providers only.

  • Flat {api_key, model, base_url} → both text and vision (multimodal shorthand)
  • {api_key, base_url, models: {text, vision}} → same endpoint, different model ids
  • text / vision objects → fully replace that channel (set both for different endpoints)
  • a channel with no resolved model keeps the server default
curl -X POST https://api.knowhereto.ai/v2/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
},
"llm_config": {
"api_key": "sk-...",
"model": "gpt-4.1",
"base_url": "https://api.openai.com/v1"
}
}'

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