Docu-Analyzer

The DocuAnalyzer API uploads document files for content analysis and returns various types of results (XML, MD, JSON) as a Zip file.

All API requests require API key authentication.


Authentication

All API requests must include an API key in the HTTP header. The API key follows Bearer token authentication.

Header Value
Authorization Bearer {API_KEY}

Replace {API_KEY} with your actual issued API key in the request.


Endpoint

`POST /analyze`

Uploads a document file and processes the entire asynchronous flow of conversion, status check, and result retrieval in one request, returning the final result (ZIP).

You can select the desired result file format using the outputFormats parameter. The default value is json.

Request Examples

cURL

# Basic usage (default: json)
curl -X POST 'https://foundry.synap.kr/api/v1/docu-analyzer/analyze' \
  -H 'Authorization: Bearer {API_KEY}' \
  -F 'file=@{FILE_PATH}' \
  -o result.zip

# Select specific format (xml)
curl -X POST 'https://foundry.synap.kr/api/v1/docu-analyzer/analyze?outputFormats=xml' \
  -H 'Authorization: Bearer {API_KEY}' \
  -F 'file=@{FILE_PATH}' \
  -o result.zip

# Select multiple formats (xml, json, md)
curl -X POST 'https://foundry.synap.kr/api/v1/docu-analyzer/analyze?outputFormats=xml&outputFormats=json&outputFormats=md' \
  -H 'Authorization: Bearer {API_KEY}' \
  -F 'file=@{FILE_PATH}' \
  -o result.zip

Python

import requests

api_key = "{API_KEY}"
file_path = "/path/to/your/file.ext"
url = "https://foundry.synap.kr/api/v1/docu-analyzer/analyze"

headers = { "Authorization": f"Bearer {api_key}" }
# Optional: Add outputFormats parameter
params = { "outputFormats": ["xml", "json"] }

with open(file_path, "rb") as file:
    files = { "file": file }
    response = requests.post(url, headers=headers, files=files, params=params)

with open("result.zip", "wb") as f:
    f.write(response.content)

Node.js

const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');

const apiKey = "{API_KEY}";
const filePath = "/path/to/your/file.ext";
// Optional: Add outputFormats parameter
const url = 'https://foundry.synap.kr/api/v1/docu-analyzer/analyze?outputFormats=xml&outputFormats=json';

const form = new FormData();
form.append('file', fs.createReadStream(filePath));

const headers = {
  ...form.getHeaders(),
  'Authorization': `Bearer ${apiKey}`,
};

axios.post(url, form, {
    headers: headers,
    responseType: 'stream'
}).then(response => {
    response.data.pipe(fs.createWriteStream('result.zip'));
}).catch(error => {
    console.error('Error:', error.response?.data || error.message);
});

Headers

Parameter Type Description
Authorization string Bearer token for API request authentication. Must be provided in the format Bearer {API_KEY}.

Query Parameters

Parameter Type Required Description
outputFormats string[] No Result file format (multiple selections allowed). Allowed values: xml, json, md. Default is json.

Body

Parameter Type Description
file file The document file to be analyzed.

Success Responses

Status Code Media Type Description
200 OK application/zip When analysis is successful and one or more result files exist, returns a ZIP file.

Error Responses

Status Code Message Description
400 Bad Request The 'file' field is missing in the request body (form-data). Returned when the file field containing file data cannot be found in a multipart/form-data request.
400 Bad Request The format '{format}' you entered is not supported. (Supported formats: xml, md, json) Returned when an invalid format is passed in the outputFormats parameter.
402 Payment Required Insufficient credits to perform document analysis. Returned when the remaining credits in the account are less than required for document analysis.
413 Payload Too Large The uploaded file exceeds the server limit of 100MB. Returned when the size of a single uploaded file exceeds the maximum size (100MB) allowed by the server.
415 Unsupported Media Type Unsupported file format. Returned when the format of the uploaded file is not supported by the server.
500 Internal Server Error Failed to process the request due to an internal server error.
Please try again later. If the problem persists, please contact the administrator.
Returned when request processing fails due to an unexpected internal server issue.