Skip to content

Add record

Submits one filled record under code_id + tpl_id.

This page focuses on the request body. To discover fields, field_id / option_id / column / checklist IDs, call Get form template first.

Request example

python
import requests

url = 'https://open.cli.im/api/v2/rpc/record/addRecord'
data = {
    'code_id': 6762875,
    'tpl_id': 122507,
    'fields': [
        { 'field_id': 71399639089153, 'field_type': 'name', 'field_value': '张三' },
        { 'field_id': 71399639089154, 'field_type': 'tel', 'field_value': '13800138000' },
        { 'field_id': 71399639089158, 'field_type': 'sex', 'field_value': { 'option_id': 71399639089192 } },
        { 'field_id': 71399639089161, 'field_type': 'number', 'field_value': { 'value': 30.6 } },
        { 'field_id': 71399639089170, 'field_type': 'checkbox', 'field_value': {
            'values': [
                { 'option_id': 71399639089361 },
                { 'option_id': 71399639089369, 'custom_text': '电线杆子' }
            ]
        } }
    ]
}
headers = {
    'Authorization': 'Bearer <your API Key>',
    'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
print(response.text)
bash
curl -X POST 'https://open.cli.im/api/v2/rpc/record/addRecord' \
  -H 'Authorization: Bearer <your API Key>' \
  -H 'Content-Type: application/json' \
  -d '{"code_id":6762875,"tpl_id":122507,"fields":[{"field_id":71399639089153,"field_type":"name","field_value":"张三"},{"field_id":71399639089158,"field_type":"sex","field_value":{"option_id":71399639089192}}]}'

Request parameters

ParameterTypeRequiredDescription
code_idintegerYesQR code ID
tpl_idintegerYesForm template ID
fieldsarrayYesField values; one entry per component—see fields[] below

fields[] item

FieldTypeRequiredDescription
field_idintegerYesComponent ID from the form template
field_typestringYesComponent type, e.g. name, radio, checkbox, matrix
field_valuestring | object | arrayYesValue; shape depends on field_type

Notes:

  • Structured IDs (field_id, option_id, item_id, column_id, …) must come from Get form template.
  • The public API only needs code_id, tpl_id, and fields.

field_value input shapes

Quick reference

Familyfield_typefield_value shape
Text / timename, tel, recorder, identity, job_number, text, textarea, date, time, customer_name, customer_mobile, customer_number, carnumberstring
Single choicesex, radioobject
Numbernumberobject
Multi choicecheckboxobject
Compositechecklistarray
Compositematrix, dynamic_matrix, chained_selectsobject
Addressaddress, owner_addressobject
OCRocr_*object

Text / time

field_type:

  • name, tel, recorder, identity, job_number, text, textarea, date, time, customer_name, customer_mobile, customer_number, carnumber

field_value is a plain string:

json
{
  "field_id": 71399639089153,
  "field_type": "name",
  "field_value": "张三"
}

Suggested formats:

  • date: 2026-03-09 or 2026-03-09 17:24
  • time: 2026-03-09 17:24

Single choice

field_type: sex, radio

Normal option:

json
{
  "field_id": 71399639089158,
  "field_type": "sex",
  "field_value": {
    "option_id": 71399639089192
  }
}

“Other” option may include custom_text:

json
{
  "field_id": 71399639089168,
  "field_type": "radio",
  "field_value": {
    "option_id": 71399639089337,
    "custom_text": "一点小问题"
  }
}
FieldTypeRequiredDescription
option_idintegerYesOption ID
custom_textstringNoExtra text for “other”

Number

field_type: number

json
{
  "field_id": 71399639089161,
  "field_type": "number",
  "field_value": {
    "value": 30.6
  }
}
FieldTypeRequiredDescription
valuenumberYesNumeric value

Multi choice

field_type: checkbox

json
{
  "field_id": 71399639089170,
  "field_type": "checkbox",
  "field_value": {
    "values": [
      { "option_id": 71399639089361 },
      { "option_id": 71399639089369, "custom_text": "电线杆子" }
    ]
  }
}
FieldTypeRequiredDescription
valuesarrayYesSelected options
values[].option_idintegerYesOption ID
values[].custom_textstringNo“Other” text

Checklist

field_type: checklist

json
{
  "field_id": 71399639089163,
  "field_type": "checklist",
  "field_value": [
    {
      "item_id": 71399639089266,
      "value": { "option_value": "1" }
    },
    {
      "item_id": 71399639089267,
      "value": {
        "option_value": "2",
        "description": "生锈了,需要注意"
      }
    }
  ]
}
FieldTypeRequiredDescription
item_idintegerYesChecklist item ID
value.option_valuestringYesResult value
value.descriptionstringNoNote

Meaning of option_value comes from form config. V2 does not support submitting images or other static assets inside checklist.

Matrix (fixed rows)

field_type: matrix

json
{
  "field_id": 71399639089164,
  "field_type": "matrix",
  "field_value": {
    "columns": [
      {
        "column_id": 71399639089283,
        "column_type": "text",
        "value": { "text": "黄金龙" }
      },
      {
        "column_id": 71399639089285,
        "column_type": "sex",
        "value": {
          "text": "男",
          "option_uuid": "25587b8b-485d-4038-a5ab-9bcd7c4af880"
        }
      }
    ]
  }
}
FieldTypeRequiredDescription
columnsarrayYesColumn values
columns[].column_idintegerYesColumn ID
columns[].column_typestringYesColumn type
columns[].valueobjectYesValue object; shape depends on column type

Address columns may include address_detail, etc.; definitions come from Get form template.

Dynamic matrix

field_type: dynamic_matrix

json
{
  "field_id": 71399639089165,
  "field_type": "dynamic_matrix",
  "field_value": {
    "rows": [
      {
        "columns": [
          {
            "column_id": 71399639089294,
            "column_type": "text",
            "value": { "text": "螺丝" }
          }
        ]
      }
    ]
  }
}
FieldTypeRequiredDescription
rowsarrayYesRows
rows[].columnsarrayYesSame shape as matrix.columns[]

Address

field_type: address, owner_address

Located:

json
{
  "field_id": 71399639089173,
  "field_type": "address",
  "field_value": {
    "address": "浙江省宁波市海曙区启文路157弄",
    "lat": 29.856985405815973,
    "lng": 121.53253689236111
  }
}

Manual:

json
{
  "field_id": 71399639089174,
  "field_type": "owner_address",
  "field_value": {
    "province": "浙江省",
    "city": "宁波市",
    "district": "海曙区",
    "street": "南门街道",
    "detail": "海曙区甬水桥科创中心(启文路157弄北150米)"
  }
}

address:

FieldTypeRequiredDescription
addressstringYesAddress text
latnumberYesLatitude
lngnumberYesLongitude

owner_address:

FieldTypeRequiredDescription
provincestringYesProvince
citystringYesCity
districtstringYesDistrict / county
streetstringNoStreet / township
detailstringNoDetail

Cascaded selects

field_type: chained_selects

json
{
  "field_id": 71399639089177,
  "field_type": "chained_selects",
  "field_value": {
    "values": [
      { "option_id": 71399639089433 },
      { "option_id": 71399639089443 },
      { "option_id": 71399639089447 }
    ]
  }
}
FieldTypeRequiredDescription
valuesarrayYesOptions per level in order
values[].option_idintegerYesOption ID

OCR

field_type: ocr_id_card, ocr_business_license, ocr_electric_meter, other ocr_*

json
{
  "field_id": 71399639089185,
  "field_type": "ocr_electric_meter",
  "field_value": {
    "items": [
      {
        "item_id": 71399639089571,
        "key": "度数",
        "value": "10890.1"
      }
    ]
  }
}
FieldTypeRequiredDescription
itemsarrayYesRecognized items
items[].item_idintegerYesItem ID
items[].keystringNoKey label
items[].valuestringYesRecognized text

OCR should carry recognized text only; V2 does not accept source images or other static uploads with the request.

Not supported in submissions

Static media components

V2 cannot submit content for:

  • image
  • signature
  • audio
  • video
  • file

Even if the form marks these required, API-sourced submissions are not blocked by those required rules; whether empty values are acceptable is a business decision on your side.

Non-value components

Not used for business values:

  • description

Relationship to form “required” settings

OpenAPI addRecord writes are API-sourced; they do not enforce per-component “required” from the form designer.

Notes:

  • is_required from Get form template mainly applies to browser/mobile form UX.
  • You may use is_required locally, but do not assume the API rejects missing fields the way the form UI would.

Visibility rules

Show/hide rules from the form config do not apply to API submissions.

Notes:

  • Visibility is for front-end display only, not server-side field pruning for OpenAPI writes.
  • Whether to send a field is entirely up to the caller.
  • Product help (Chinese): visibility rules.

Excel bulk import

OpenAPI V2 does not provide an official Excel upload or batch-import endpoint.

Suggested flow:

  1. Call Get form template for IDs.
  2. Parse Excel; map each row to fields[].
  3. Call this API once per row.
  4. Aggregate success/failure and retry recoverable errors.

Notes:

  • Multiple single writes are not atomic; partial success is normal.
  • Check for unsupported media fields before bulk import.
  • Handle error_code per row—do not blindly retry parameter or validation errors.

Success response example

json
{
  "code": 0,
  "message": "ok",
  "data": {
    "version": "v1",
    "record_id": 2644408,
    "record_number": "L136",
    "record_code": "r06mEwjF7vqSvXpfTbrF781",
    "record_url": "https://qr46.cn/oEuE2E/r06mEwjF7vqSvXpfTbrF781",
    "submit_at": 1773056540,
    "submit_at_iso": "2026-03-09 19:42:20(UTC+08:00)"
  }
}

Response overview

PathTypeDescription
codeinteger0 success
messagestringMessage
dataobjectResult
data.versionstringv1
data.record_idintegerRecord ID
data.record_numberstringRecord number
data.record_codestringRecord code
data.record_urlstringRecord URL
data.submit_atintegerSubmitted at (Unix seconds)
data.submit_at_isostringFormatted time with timezone

Error response

Failures often look like:

json
{
  "code": 400,
  "error_code": 100300,
  "message": "System error",
  "message_detail": ""
}
FieldTypeDescription
codeintegerHTTP or platform status
error_codeintegerBusiness error code
messagestringSummary
message_detailstringDetail; may be empty

API addRecord does not enforce form is_required; interpret errors from parameters, value shape, and business state.

Full error codes: Error codes.

Integration checklist

  1. Call Get form template for IDs and types.
  2. Build fields[] using the field_typefield_value rules on this page.
  3. Skip unsupported static media; confirm your process allows them empty if the form needs them.
  4. For bulk import, parse locally and call row-by-row—there is no official batch API.
  5. After success, read content via Get a single record or Get records.