The Document Processing API provides functionality to manage and analyze documents, including retrieving document details, extracting named entities (NER), answering questions based on document content, generating summaries, converting to markdown, and creating dummy documents.
Document Operations
Document Operations enable comprehensive management and analysis of individual documents within the system.
Document Operations - Get Document GET /v1/api/document/{document_id}
Resource URL /v1/api/document/{document_id} Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Retrieve a document's metadata and text by its ID.
Parameter Description Required Type Default Value document_id Path parameter: ID of the document Yes String N/A
curl -X 'GET' \
'https://braegen.ai/v1/api/document/doc123' \
-H 'accept: application/json'
{
"is_error" : false ,
"message" : "Document retrieved successfully",
"results" : {
"document_id" : "doc123",
"meta_data" : {},
"text" : "Sample document content..."
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error
Resource URL /v1/api/document/extract_ner Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Extract named entities (NER) from a document.
Parameter Description Required Type Default Value identifier Identifier of the document or collection Yes String N/A is_document Indicates if the identifier is a document No Boolean false
curl -X 'POST' \
'https://braegen.ai/v1/api/document/extract_ner' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"identifier": "doc123",
"is_document": true
}'
{
"is_error" : false ,
"message" : "NER extraction successful",
"results" : {
"entities" : [
{ "entity" : "John Doe", "type": "PERSON"},
{ "entity" : "New York", "type": "LOCATION"}
]
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error
Document Operations - Answer Questions On Document POST /v1/api/document/answer
Resource URL /v1/api/document/answer Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Answer questions based on the content of specified documents.
Parameter Description Required Type Default Value user User identifier Yes String N/A document_ids List of document IDs to query Yes Array N/A questions List of questions to answer Yes Array N/A
curl -X 'POST' \
'https://braegen.ai/v1/api/document/answer' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"user": "user123",
"document_ids": ["doc123"],
"questions": ["What is the main topic?"]
}'
{
"is_error" : false ,
"message" : "Questions answered successfully",
"results" : {
"answers" : [
{ "question" : "What is the main topic?", "answer": "The document discusses AI advancements."}
]
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error
Document Operations - Document Summary GET /v1/api/document/{document_id}/summary
Resource URL /v1/api/document/{document_id}/summary Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Provide a summary of the specified document.
Parameter Description Required Type Default Value document_id Path parameter: ID of the document Yes String N/A
curl -X 'GET' \
'https://braegen.ai/v1/api/document/doc123/summary' \
-H 'accept: application/json'
{
"is_error" : false ,
"message" : "Summary generated successfully",
"results" : {
"summary" : "This document outlines key features of AI technology."
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error
Document Operations - Document Markdown GET /v1/api/document/{document_id}/markdown
Resource URL /v1/api/document/{document_id}/markdown Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Retrieve the document content in markdown format.
Parameter Description Required Type Default Value document_id Path parameter: ID of the document Yes String N/A start_page Query parameter: Starting page No Integer 1 end_page Query parameter: Ending page No Integer 1
curl -X 'GET' \
'https://braegen.ai/v1/api/document/doc123/markdown?start_page=1&end_page=2' \
-H 'accept: application/json'
{
"is_error" : false ,
"message" : "Markdown generated successfully",
"results" : {
"markdown" : "# Document Title\n\nSample content..."
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error
Document Operations - Create Dummy Document POST /v1/api/document/create-dummy-doc
Resource URL /v1/api/document/create-dummy-doc Response Format JSON Requires Authentication Yes Rate Limited Yes HTTPS Yes
Create a dummy document for testing purposes.
Parameter Description Required Type Default Value document_id Query parameter: ID of the document Yes String N/A collection_id Query parameter: ID of the collection Yes String N/A
curl -X 'POST' \
'https://braegen.ai/v1/api/document/create-dummy-doc?document_id=doc123&collection_id=col456' \
-H 'accept: application/json'
{
"is_error" : false ,
"message" : "Dummy document created successfully",
"results" : {
"document_id" : "doc123",
"collection_id" : "col456"
}
}
HTTP Response
HTTP Code Message 200 Successful Response 422 Validation Error