Ana içeriğe geç

Get Document

Endpoint

GET /apiops/projects/{projectName}/knowledge-bases/{kbName}/documents/{documentId}/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
kbNamestringYesKnowledge base name (parent, resolved by name)
documentIdstringYesDocument id (documents are referenced by id, not name)

Query Parameters

None

Response

Success Response (200 OK)

{
"status": "SUCCESS",
"resultList": [
{
"id": "6651b3c4e4b0c3a2d1f0aaaa",
"knowledgeBaseId": "6650a1f2e4b0c3a2d1f09876",
"projectId": "6650a1f2e4b0c3a2d1f01234",
"fileName": "user-guide.pdf",
"contentType": "application/pdf",
"sizeBytes": 248193,
"sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"status": "INDEXED",
"chunkCount": 42,
"uploadedAt": "2026-07-11T10:05:00Z",
"errorMessage": null
}
],
"resultCount": 1
}

Response Fields

FieldTypeDescription
statusstringResponse status: SUCCESS or FAILURE
resultListarraySingle-element list containing the document object
resultCountintegerNumber of documents returned (1)

Document Object Fields

FieldTypeDescription
idstringServer-generated document identifier
knowledgeBaseIdstringInternal id of the parent knowledge base
projectIdstringInternal id of the owning project
fileNamestringOriginal uploaded file name
contentTypestringMIME type detected on upload
sizeBytesintegerFile size in bytes
sha256stringSHA-256 content hash (used for deduplication)
statusstringProcessing status: PENDING, CHUNKED, INDEXED, ERROR
chunkCountintegerNumber of indexed chunks (read-only)
uploadedAtstringISO-8601 upload timestamp
errorMessagestringError detail when status is ERROR; null otherwise

Document Status Values

  • PENDING - Uploaded, not yet processed
  • CHUNKED - Text split into chunks; embedding generation in progress
  • INDEXED - Chunks embedded and upserted to the VectorDB; queryable
  • ERROR - Processing failed at some stage; see errorMessage

EnumStatus

  • SUCCESS - Operation successful
  • FAILURE - Operation failed

Error Response (400 Bad Request)

{
"status": "FAILURE",
"resultMessage": "Document id can not be empty!"
}

or

{
"status": "FAILURE",
"resultMessage": "Knowledge base (name: product-docs) was not found!"
}

Error Response (401 Unauthorized)

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/knowledge-bases/product-docs/documents/6651b3c4e4b0c3a2d1f0aaaa/" \
-H "Authorization: Bearer YOUR_TOKEN"

Notes and Warnings

  • Id-Based (Deliberate Exception): Documents are addressed by documentId, not by name, because filenames are not unique within a knowledge base. The parent knowledge base is still resolved by kbName first.
  • Ownership Enforcement: The document is resolved by documentId AND knowledgeBaseId AND projectId together, so a document id belonging to a different knowledge base or project is unreachable.
  • Internal Storage Reference Hidden: The document's internal storage reference (gridFsFileId) is intentionally excluded.
  • Permissions: Requires AI_DEVELOPMENT + VIEW permission in the project.