Skip to main content
Version: v2023.18.0

POST Document

This API allows you to upload a document.

API Description

Endpoint:

POST /documents

Query params:

VariableRequiredDescription
documentIdNoThe reference ID for the document
documentTitleNoThe title of the document
documentUrlNoThe URL of the document
failOnUnsupportedNoIntroduced in 2023.12.0 version. If the value is true or not specified, loading an unsupported document will return an error. If the value is false, loading an unsupported document will not return an error.

Request body:

VariableDescription
inputStreamThe input stream containing the document content

Responses:

TypeDescription
DocumentIdThe ID of the document. A new documentId is generated if not provided in the query parameter

Examples

Upload a Document

The following example uploads a document from a file named "example.pdf" without specifying a document title or URL.

curl -X 'POST' \
'http://localhost:8761/documents' \
-H 'accept: application/json' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@example.pdf'

The following example uploads a document from URL.

curl -X 'POST' \
'http://localhost:8761/documents?documentUrl=https%3A%2F%2Fdemo.arender.io%2Fdocs%2Fdemo%2FPDFReference15_v5.pdf' \
-H 'accept: application/json' \
-H 'Content-Type: application/octet-stream' \
-d ''