Add file

Prev Next

Available in VPC

Create a document by uploading a file to the indexing system. The system automatically generates and returns a unique document ID.

Request

This section describes the request format. The method and URI are as follows:

Method URI
POST /api/v1/svc/{serviceId}/file

Request headers

For information about the headers common to all RAG APIs, see RAG request headers.

Request path parameters

The following describes the parameters.

Field Type Required Description
serviceId String Required Service's unique identifier

Request query parameters

The following describes the parameters.

Field Type Required Description
background Boolean Optional Whether to process text extraction in the background
  • true | false (default)
    • true: Uploading a file returns an immediate response, while text extraction is asynchronous in the background.
    • false: Response is returned after text extraction is complete (synchronous processing).

Request body

You can include the following data in the body of your request:

Field Type Required Description
file File Required File to upload (up to 1)
  • Supported formats
    • Image: JPG, PNG, TIFF
    • Document: PDF, PPTX, DOCX, HWP, HWPX, TXT
    • Data file: MD, JSON, XML
  • File size: up to 100 MB

Request example

The request example is as follows:

curl --location --request POST 'https://kr-pub-gateway.rag.naverncp.com/api/v1/svc/{serviceId}/file?background=true' \
--header 'Authorization: Bearer {apiKey}' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@"filePath"'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
status Object - API processing result
status.code Integer - API response status code
status.message String - API response status message
result Object - File processing result
result.inserted Array - Created file ID
result.deleted Array - Deleted file ID (always null)
result.updated Array - Edited file ID (always null)

Response status codes

For information about the HTTP status codes common to all RAG APIs, see RAG response status codes.

Response example

The response example is as follows:

{
    "status": {
        "code": 200,
        "message": ""
    },
    "result": {
        "inserted": [
            "{fileId}"
        ],
        "deleted": null,
        "updated": null
    }
}