Skip to main content
POST
/
api
/
app-api
/
sip
/
platform
/
v2
/
category
/
fields
/
add
Add Single File Category Field
curl --request POST \
  --url https://docflow.textin.com/api/app-api/sip/platform/v2/category/fields/add \
  --header 'Content-Type: application/json' \
  --header 'x-ti-app-id: <api-key>' \
  --header 'x-ti-secret-code: <api-key>' \
  --data '
{
  "name": "Invoice Code",
  "workspace_id": "1234567890",
  "category_id": "1234567890",
  "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"
    }
  },
  "table_id": "1234567890",
  "extract_model": "Model 1",
  "with_detail": true
}
'
{
  "code": 200,
  "msg": "<string>",
  "result": {
    "field_id": "1234567890",
    "name": "<string>",
    "description": "<string>",
    "prompt": "<string>",
    "use_prompt": true,
    "alias": [
      "<string>"
    ],
    "identity": "<string>",
    "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"
      }
    },
    "extract_model": "<string>",
    "enabled": 123
  }
}

Authorizations

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

Body

application/json
name
string
required

Field name

Example:

"Invoice Code"

workspace_id
string
required

Workspace ID

Example:

"1234567890"

category_id
string
required

File category ID

Example:

"1234567890"

description
string

Field description

Example:

"Invoice code description"

prompt
string

Semantic extraction prompt

use_prompt
boolean

Whether to use semantic prompt

alias
string[]

Field aliases. On update: omit=no change, empty array []=clear aliases, non-empty array=override

Example:
["Invoice No.", "Bill Number"]
identity
string

Export field name. On update: omit=no change, empty string ""=clear, non-empty=override

Example:

"invoice_number"

multi_value
boolean

Whether to enable multi-value extraction

duplicate_value_distinct
boolean

Whether to deduplicate values, only effective when multi_value is true

transform_settings
object

Field output transform configuration. Formats the extraction result before output.

table_id
string

Table ID

  • Not provided or empty: Creates a regular field, result appears in result.fields
  • Provide table ID: Creates a table field under the specified table, result appears in result.tables[].fields
Example:

"1234567890"

extract_model
enum<string>

Optional, field-level extraction model, only supported for regular fields (not table fields), defaults to Model 1

  • 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"

with_detail
boolean

Whether to return full details. When true, the response includes complete field info. When not set or false, only field_id is returned.

Response

200 - application/json

Successfully added file category field

code
integer
required

Status code

Example:

200

msg
string
required

Status description

result
object