Tender documents move through three stages: download, OCR/indexing, and summarization. The Public API lets you add your own documents to a tender, trigger the download of the source files, stream them, and read the processed content once it is ready.
List tender files
GET /tenders/:tenderId/files
{
"data": {
"files": [
{
"id": "uploaded-file-id",
"filename": "specification.pdf",
"extension": "pdf",
"sizeBytes": 1048576,
"mimeType": "application/pdf",
"lifecycle": "active",
"origin": "tender",
"processingStatus": "not_applicable",
"documentStatus": "processed",
"fileId": "processed-document-id"
}
]
},
"error": null
}
A source PDF that has finished OCR looks like the example above: id is the uploaded file, fileId is the processed document. A row that is not processed yet, or whose type is outside the OCR pipeline, has documentStatus: null and fileId: null.
tenderId is a tender (lot) ID. The API resolves the lot's source tender and returns the files uploaded for that notice, plus the documents your company uploaded for it. A 404 means the tender does not exist or has no source tender ID.
| Field | Meaning |
|---|---|
lifecycle |
active for normal files, archived once the original object was removed after the deadline, removed for files deleted after ingestion. Archived files stay listed and their download link resolves to the tender zip. |
origin |
tender files came with the notice from the procurement source. user-upload files were uploaded for this tender by your company, so only your company sees them. |
processingStatus |
Search-store ingestion state of the uploaded file: in_progress while it is being stored, then done or error. It is not OCR progress. Source documents report not_applicable. |
documentStatus |
Readiness of the OCR document built from this file: new while pages and summaries are still being built, processed when it is readable and analysable, error if processing failed. Applies to procurement-source documents and company uploads alike — source documents report processed once their OCR finishes. Null only when no document exists yet, or never will because the file type is outside the OCR pipeline. |
fileId |
The processed OCR document ID. Use it with /documents/:fileId, /pages, and /headers. This is not the row's id: id is the uploaded file used by /files/:id/download, fileId is the extracted document used by /documents/:fileId. If the document is still building, /documents/:fileId reports status: "new" rather than returning 404. |
A file row therefore carries two identifiers with different jobs:
| You want to | Use |
|---|---|
| Stream the original file or page image | the row's id → GET /files/:id/download |
| Read OCR text, page regions, headers, or summaries | fileId → GET /documents/:fileId, /pages, /headers |
Do not swap them. /documents/:fileId accepts only the processed document ID; its 404 means no document exists for that ID, typically because an uploaded id was used instead. A document that is still processing returns 200 with status: "new".
The response can also include an optional zip object when a precomputed archive exists. Zips are precomputed after document ingestion and refreshed when new files arrive.
Upload a document
POST /tenders/:tenderId/files
Send multipart/form-data with the document in the file field; the optional file_name field overrides the display name. tenderId may be a tender (lot) ID or a notice ID — the file is always attached to the notice, so every lot of that notice sees it.
curl -s -X POST "$KOSMOBIDS_BASE_URL/tenders/$TENDER_ID/files" \
-H "x-api-key: $KOSMOBIDS_API_KEY" \
-F "[email protected]"
{
"data": {
"fileId": "uploaded-file-id",
"fileName": "addendum-2.pdf",
"tenderId": "0f8fad5b-d9cb-469f-a165-70867728950e",
"noticeId": "6b1f0c9a-2d3e-4f5a-8b7c-9d0e1f2a3b4c",
"processingStatus": "in_progress"
},
"error": null
}
Uploads are scoped to your company: the file appears in the tender's file list for your team and for your API key, never for another company. OCR processing starts immediately.
Poll documentStatus, not processingStatus. processingStatus only reports that the file reached the search store. Readiness is documentStatus:
new—fileIdmay already be set, but the document is still being built./documents/:fileIdreturns200withstatus: "new", and/pagesreturns200with empty pages, until processing finishes.processed— the document, its pages, and analysis are usable.
documentStatus stays null only for file types the OCR pipeline does not handle (spreadsheets and plain text): those uploads are downloadable and searchable, but they never become documents and cannot be analysed. Source documents are not an exception — they report processed on the same field once their OCR finishes. Every accepted upload that does become a document also unlocks POST /tenders/:tenderId/analyze — including tenders that have no files from the procurement source at all.
| Limit | Value |
|---|---|
| File size | 25 MB |
| Accepted types | PDF, DOCX, XLSX, XLS, RTF, TXT, JPEG, PNG |
A 422 means the multipart form was rejected (missing file, or a declared type outside the list), 400 that the bytes are not a usable document, 404 that the tender or notice is unknown, 429 that the upload rate limit is exhausted (60 per hour), and 500 that storage or processing failed. Uploads are not idempotent: each request creates a file, so a retry after a timeout can duplicate one.
Download a file
GET /files/:fileId/download
The fileId is an uploaded file ID from the file list, or an uploadedFileId from a document page or analysis reference. The response is a binary stream with the file's content type and a Content-Disposition filename header. It is not wrapped in the JSON envelope.
A 404 means the file record or its stored object is missing. A 500 means the storage stream failed.
Download all files as a zip
GET /tenders/:tenderId/files/zip
Streams the tender's precomputed zip when one exists, and falls back to building the archive on demand otherwise. The response is binary with Content-Type: application/zip. Archived tenders only have the precomputed zip, so the endpoint keeps working after original files are removed. A 404 means the tender, its source tender ID, or its files are missing.
Trigger a document download
POST /tenders/:tenderId/documents/download
{
"data": {
"tenderDocumentId": "source-tender-id",
"status": "downloading_auto",
"message": "Download initiated",
"scheduled": true
},
"error": null
}
| Status | HTTP | Meaning |
|---|---|---|
| Scheduled | 202 |
A download workflow was created. scheduled is true. |
| Already running | 200 |
The document is already downloading_auto or processing. scheduled is false. |
| Nothing to download | 200 |
The workflow ran but no downloadable files were found. scheduled is false. |
| Tender not found | 404 |
The tender, its source tender ID, or its document record is missing. |
Poll GET /tenders/:tenderId/files until files appear. Downloads can take minutes to hours, and not every portal yields documents. If a download is already in progress, the endpoint is safe to call again; it returns 200 rather than starting a second workflow.
Read processed document metadata
GET /documents/:fileId
Get fileId from GET /tenders/:tenderId/files once the row's documentStatus is processed, or from an analysis reference (see Document analysis).
{
"data": {
"id": "processed-document-id",
"filename": "specification.pdf",
"sizeBytes": 1048576,
"extension": "pdf",
"status": "processed",
"origin": "tender-document",
"tenderId": "0f8fad5b-d9cb-469f-a165-70867728950e",
"uploadedFileId": "uploaded-file-id",
"pageCount": 120,
"contentSummary": "The tender covers a multi-year cloud migration...",
"sourceLanguage": "en",
"category": "tender",
"tableOfContents": [
{ "title": "Eligibility", "summary": "Mandatory requirements.", "pageRange": [1, 4] }
],
"batchSummaries": [
{
"summary": "Pages 1-4 describe eligibility.",
"pages": [{ "id": "page-id", "number": 1 }]
}
]
},
"error": null
}
| Field | Meaning |
|---|---|
status |
new, error, or processed. Only processed documents have OCR content. |
origin |
tender-document, company-document, or tender-document-user-uploaded. |
pageCount |
Number of pages, when known. |
contentSummary |
A document-level summary, once summarization has finished. |
tableOfContents |
Section titles with a [start, end] page range. |
batchSummaries |
Summaries for page batches, with the pages in each batch. |
tableOfContents and batchSummaries appear only after the summarization stage has completed. Their absence does not mean the document is unreadable; check status and the page endpoint.
Read page text and regions
GET /documents/:fileId/pages?startPage=1&endPage=10
{
"data": {
"pages": [
{
"pageNumber": 1,
"status": "processed",
"content": "1. Introduction\n...",
"pageWidth": 2480,
"pageHeight": 3508,
"uploadedFileId": "page-image-id",
"regions": [
{
"index": 0,
"content": "1. Introduction",
"bbox_2d": [120, 340, 1800, 410]
}
]
}
]
},
"error": null
}
- Supply both
startPageandendPageto filter a range. If either is omitted, all pages are returned. bbox_2dis[x1, y1, x2, y2]in page-image pixels. Normalize by dividing bypageWidthandpageHeightif you render your own viewer.uploadedFileIdidentifies the page image. Stream it withGET /files/:uploadedFileId/download.regions[].indexis the region index used by analysis references.
Read page headers
GET /documents/:fileId/headers
{
"data": {
"headers": [
{ "pageNumber": 3, "title": "2.1 Eligibility", "label": "paragraph_title", "category": "text_block" }
]
},
"error": null
}
Headers are extracted from the OCR layout. label is the layout classifier's label and category is its broader group; both are implementation-provided strings, so treat unknown values as opaque.
Availability and errors
All three document read endpoints require a company-scoped API key and resolve a document by its ID. Only use document IDs your company received from the file list or an analysis reference.
GET /documents/:fileId returns 404 only when no document exists for that ID — for example, when you pass an uploaded file id instead of the processed fileId. A document that exists but has not finished OCR returns 200 with status: "new" (or "error"), and /pages and /headers return 200 with empty arrays until their content is available.