API Documentation

Complete API reference for Docify OpenAPI integration

Last Updated: February 26, 2026

Docify OpenAPI API Documentation

Overview

Docify OpenAPI provides a comprehensive set of RESTful API interfaces for managing and executing AI scenario tasks. All interfaces require authentication via an API Key.

Base URL: https://console.docify.jp/docify

Authentication Method: Bearer Token (API Key)

Important Note: Each API Key is bound to a specific scenario, and the system automatically identifies the corresponding scenario information based on the API Key.

API List

1. Query Scenario Details

Endpoint: GET /v1/scenario/info

Description: Retrieves detailed information about the current scenario, including parameter configurations.

Request Parameters: None

Response Parameters:

{
"scenarioId": "string", // Scenario ID
"scenarioCode": "string", // Scenario Code
"scenarioName": "string", // Scenario Name
"description": "string", // Scenario Description
"parameters": [ // List of Parameters
{
"type": "FILE", // Parameter Type: FILE, FILELIST, TEXT, SELECT, TEXTAREA
"label": "string", // Parameter Label
"variable": "string", // Parameter Variable Name
"required": boolean, // Is Required
"maxLength": integer, // Maximum Length
"description": "string" // Parameter Description
}
]
}

Response Example:

{
  "scenarioId": "1001",
  "productId": "123456",
  "scenarioCode": "OCR_INVOICE",
  "scenarioName": "Invoice Recognition",
  "description": "Intelligent recognition of invoice content",
  "parameters": [
    {
      "type": "FILE",
      "label": "Invoice Image",
      "variable": "invoice_image",
      "required": true,
      "maxLength": 0,
      "description": "Please upload an invoice image file"
    }
  ]
}

2. Execute Scenario Task

Endpoint: POST /v1/scenario/run

Description: Executes the AI task for the current scenario.

Request Parameters: No path parameters

Request Parameters:

{
  "user": "string", // User Identifier (Optional)
  "additionalInfo": "{}", // Additional Information (JSON structure, Optional)
  "inputs": {
    // Input Parameters
    "{parameter_name}": {
      "text": "string", // Text Content
      "files": [
        // List of Files
        {
          "url": "string", // File URL (Either this or uploadFileOid)
          "uploadFileOid": "string", // Uploaded File ID (Either this or url)
          "fileType": "DOCUMENT" // File Type: DOCUMENT, IMAGE
        }
      ]
    }
  }
}

Response Parameters:

{
"runId": "string", // Run ID
"scenarioId": "string", // Scenario ID
"jsonResult": "string", // Result in JSON format
"result": "string", // Result in text format
"createAt": integer, // Creation Timestamp (milliseconds)
"finishedAt": integer, // Completion Timestamp (milliseconds)
"elapsedTime": integer, // Elapsed Time (milliseconds)
"isSuccess": boolean, // Is Success
"errorMessage": "string", // Error Message
"costPoints": number, // Points Consumed
"files": [ // List of Attachments
{
"fileUrl": "string", // File Download Link
"fileName": "string", // File Name
"fileSize": integer // File Size (bytes)
}
]
}

Request Example:

{
  "user": "user123",
  "inputs": {
    "invoice_image": {
      "files": [
        {
          "uploadFileOid": "file-uuid-123",
          "fileType": "IMAGE"
        }
      ]
    }
  }
}

Response Example:

{
"runId": "run-123456",
"scenarioId": "1001",
"jsonResult": "{\\\"invoice_number\\\":\\\"INV-2024-001\\\",\\\"amount\\\":1000.00}\",
"result": "Invoice Number: INV-2024-001, Amount: 1000.00 CNY",
"createAt": 1640995200000,
"finishedAt": 1640995205000,
"elapsedTime": 5000,
"isSuccess": true,
"errorMessage": null,
"costPoints": 10.5,
"files": [
{
"fileUrl": "https://dev.docify.jp/docify/download/processed_invoice.pdf",
"fileName": "processed_invoice.pdf",
"fileSize": 2048000
}
]
}

3. Stream Scenario Task Execution

Endpoint: POST /v1/scenario/run/streaming

Description: Executes the AI task for the current scenario in a streaming fashion, returning execution progress and results in real-time via Server-Sent Events (SSE) (based on the scenario bound to the API Key).

Request Parameters: No path parameters (Scenario ID is automatically identified via API Key)

Request Parameters:

{
  "user": "string", // User Identifier (Optional)
  "additionalInfo": "{}", // Additional Information (JSON structure, Optional)
  "inputs": {
    // Input Parameters
    "{parameter_name}": {
      "text": "string", // Text Content
      "files": [
        // List of Files
        {
          "url": "string", // File URL (Either this or uploadFileOid)
          "uploadFileOid": "string", // Uploaded File ID (Either this or url)
          "fileType": "DOCUMENT" // File Type: DOCUMENT, IMAGE
        }
      ]
    }
  }
}

Response Format: Server-Sent Events (SSE) Stream

Content-Type: text/event-stream

SSE Event Types:

1. start Event

Sent when the task begins execution.

{
  "type": "START",
  "sessionId": "session-uuid",
  "content": null,
  "response": null,
  "error": null,
  "chunkId": "chunk-uuid",
  "timestamp": 1640995200000
}

2. prepare_start Event

Preparation phase begins.

{
  "type": "PREPARE_START",
  "sessionId": "session-uuid",
  "content": "Preparing to execute task...",
  "response": null,
  "error": null,
  "chunkId": "chunk-uuid",
  "timestamp": 1640995201000
}

3. prepare_end Event

Preparation phase ends. event: prepare_end

{
  "type": "PREPARE_END",
  "sessionId": "session-uuid",
  "content": "Preparation complete",
  "response": null,
  "error": null,
  "chunkId": "chunk-uuid",
  "timestamp": 1640995202000
}

4. text Event

Text output during processing.

{
  "type": "TEXT",
  "sessionId": "session-uuid",
  "content": "Recognizing invoice content...",
  "response": null,
  "error": null,
  "chunkId": "chunk-uuid",
  "timestamp": 1640995204000
}

5. complete Event

Task completed or cancelled, including final results and attachments.

{
"type": "COMPLETE",
"sessionId": "session-uuid",
"content": null,
"response": {
"runId": "run-123456",
"scenarioId": "1001",
"jsonResult": "{\\\"invoice_number\\\":\\\"INV-2024-001\\\",\\\"amount\\\":1000.00}\",
"result": "Invoice Number: INV-2024-001, Amount: 1000.00 CNY",
"createAt": 1640995200000,
"finishedAt": 1640995205000,
"elapsedTime": 5000,
"isSuccess": true,
"errorMessage": null,
"costPoints": 10.5,
"files": [
{
"fileUrl": "https://dev.docify.jp/docify/download/processed_invoice.pdf",
"fileName": "processed_invoice.pdf",
"fileSize": 2048000
}
]
},
"error": null,
"chunkId": "chunk-uuid",
"timestamp": 1640995205000
}

6. error Event

Sent when a task execution error occurs.

{
  "type": "ERROR",
  "sessionId": "session-uuid",
  "content": null,
  "response": null,
  "error": "File format not supported",
  "chunkId": "chunk-uuid",
  "timestamp": 1640995205000
}

4. File Upload

Endpoint: POST /v1/file/upload

Description: Uploads a file to obtain a file ID for subsequent scenario execution.

Request Parameters:

  • file (multipart/form-data, required): The file to be uploaded
  • user (string, required): User identifier

Response Parameters:

{
"uploadFileOid": "uuid", // Unique File Identifier
"fileName": "string", // File Name
"fileSize": integer, // File Size (bytes)
"fileType": "enum" // File Type: DOCUMENT, IMAGE
}

Response Example:

{
  "uploadFileOid": "550e8400-e29b-41d4-a716-446655440000",
  "fileName": "invoice.jpg",
  "fileSize": 1024000,
  "fileType": "IMAGE"
}

Error Code Reference

HTTP Status CodeError Description
200Request successful
400Invalid request parameters
401Unauthorized, API Key invalid
403Forbidden, insufficient permissions
404Resource not found
500Internal server error

Usage Examples

Complete Document Processing Flow

  1. Upload File
curl -X POST "/v1/file/upload" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@invoice.jpg" \
-F "user=user123"
  1. Query Scenario Details
curl -X GET "/v1/scenario/info" \
-H "Authorization: Bearer YOUR_API_KEY"
  1. Execute Scenario Task
curl -X POST "/v1/scenario/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user": "user123",
"inputs": {
"invoice_image": {
"files": [{
"uploadFileOid": "550e8400-e29b-41d4-a716-446655440000",
"fileType": "IMAGE"
}]
}
}
}'

Important Notes

  1. All API interfaces require a valid API Key in the request header.
  2. The file upload interface supports file types including: images (JPG, PNG, etc.) and documents (PDF, DOC, etc.).
  3. Single file size limits
  • Images: 10M
  • Documents: 50M