Skip to main content
POST
/
api
/
app-api
/
sip
/
platform
/
v2
/
category
/
create
Create File Category
curl --request POST \
  --url https://docflow.textin.com/api/app-api/sip/platform/v2/category/create \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-ti-app-id: <api-key>' \
  --header 'x-ti-secret-code: <api-key>' \
  --form workspace_id=1234567890 \
  --form name=Invoice \
  --form 'extract_model=Model 1' \
  --form 'sample_files=<string>' \
  --form 'fields={
  "name": "Invoice Code",
  "description": "Invoice code description",
  "prompt": "<string>",
  "use_prompt": true,
  "alias": [
    "Invoice No.",
    "Bill Number"
  ],
  "identity": "invoice_number",
  "multi_value": true,
  "duplicate_value_distinct": true,
  "transform_settings": {
    "datetime_settings": {
      "format": "yyyy-MM-dd"
    },
    "enumerate_settings": {
      "items": [
        "VAT Special Invoice",
        "VAT General Invoice",
        "Electronic Invoice"
      ]
    },
    "regex_settings": {
      "match": "^(\\d{4})-(\\d{2})-(\\d{2})$",
      "replace": "$1/$2/$3"
    },
    "mismatch_action": {
      "default_value": "N/A"
    }
  }
}' \
  --form 'category_prompt=VAT invoice, including fields such as invoice code, invoice number, etc.' \
  --form 'description=<string>' \
  --form 'tables={
  "name": "Detail Table",
  "prompt": "<string>",
  "collect_from_multi_table": true,
  "fields": [
    {
      "name": "Invoice Code",
      "description": "Invoice code description",
      "prompt": "<string>",
      "use_prompt": true,
      "alias": [
        "Invoice No.",
        "Bill Number"
      ],
      "identity": "invoice_number",
      "multi_value": true,
      "duplicate_value_distinct": true,
      "transform_settings": {
        "datetime_settings": {
          "format": "yyyy-MM-dd"
        },
        "enumerate_settings": {
          "items": [
            "VAT Special Invoice",
            "VAT General Invoice",
            "Electronic Invoice"
          ]
        },
        "regex_settings": {
          "match": "^(\\d{4})-(\\d{2})-(\\d{2})$",
          "replace": "$1/$2/$3"
        },
        "mismatch_action": {
          "default_value": "N/A"
        }
      }
    }
  ]
}' \
  --form with_detail=true \
  --form sample_files.items='@example-file'
{
  "code": 200,
  "msg": "<string>",
  "result": {
    "category_id": "1234567890",
    "name": "<string>",
    "description": "<string>",
    "category_prompt": "<string>",
    "extract_model": "<string>",
    "enabled": 123,
    "fields": [
      {
        "name": "Invoice Code",
        "description": "Invoice code description",
        "prompt": "<string>",
        "use_prompt": true,
        "alias": [
          "Invoice No.",
          "Bill Number"
        ],
        "identity": "invoice_number",
        "multi_value": true,
        "duplicate_value_distinct": true,
        "transform_settings": {
          "datetime_settings": {
            "format": "yyyy-MM-dd"
          },
          "enumerate_settings": {
            "items": [
              "VAT Special Invoice",
              "VAT General Invoice",
              "Electronic Invoice"
            ]
          },
          "regex_settings": {
            "match": "^(\\d{4})-(\\d{2})-(\\d{2})$",
            "replace": "$1/$2/$3"
          },
          "mismatch_action": {
            "default_value": "N/A"
          }
        },
        "id": "1234567890",
        "extract_model": "Model 1"
      }
    ],
    "tables": [
      {
        "id": "1234567890",
        "name": "Table 1",
        "description": "Table description",
        "prompt": "Extract item name, quantity and amount from each row",
        "collect_from_multi_table": true,
        "extract_model": "Model 1",
        "fields": [
          {
            "name": "Invoice Code",
            "description": "Invoice code description",
            "prompt": "<string>",
            "use_prompt": true,
            "alias": [
              "Invoice No.",
              "Bill Number"
            ],
            "identity": "invoice_number",
            "multi_value": true,
            "duplicate_value_distinct": true,
            "transform_settings": {
              "datetime_settings": {
                "format": "yyyy-MM-dd"
              },
              "enumerate_settings": {
                "items": [
                  "VAT Special Invoice",
                  "VAT General Invoice",
                  "Electronic Invoice"
                ]
              },
              "regex_settings": {
                "match": "^(\\d{4})-(\\d{2})-(\\d{2})$",
                "replace": "$1/$2/$3"
              },
              "mismatch_action": {
                "default_value": "N/A"
              }
            },
            "id": "1234567890",
            "extract_model": "Model 1"
          }
        ]
      }
    ],
    "samples": [
      {
        "sample_id": "1234567890",
        "file_name": "invoice_sample.pdf"
      }
    ]
  }
}

Authorizations

x-ti-app-id
string
header
required
x-ti-secret-code
string
header
required

Body

multipart/form-data
workspace_id
string
required

Workspace ID

Example:

"1234567890"

name
string
required

File category name

Maximum string length: 50
Example:

"Invoice"

extract_model
enum<string>
required

Extraction model

  • Model 1: Fast speed with stable extraction results
  • Model 2: Suitable for complex document understanding
  • Model 3: VLM, suitable for simple extraction
Available options:
Model 1,
Model 2,
Model 3
Example:

"Model 1"

sample_files
file[]
required

Sample file list, at least one sample file must be uploaded, a category can have at most 20 sample files

Required array length: 1 - 10 elements
fields
object[]
required

Field configuration list, at least one field must be configured

Minimum array length: 1
category_prompt
string

Prompt for classification

Maximum string length: 150
Example:

"VAT invoice, including fields such as invoice code, invoice number, etc."

description
string

File category description

tables
object[]

Optional, table configuration list (one-stop creation), supports nested fields

with_detail
boolean

Whether to return full details. When true, the response includes complete category info (with fields, tables, samples). When not set or false, only category_id is returned.

Response

200 - application/json

Successfully created file category

code
integer
required

Status code

Example:

200

msg
string
required

Status description

result
object