Skip to content

Last updated at: 2025-10-20

Update Table Data

This interface allows you to update the values of specific records in the Agent data table.

-The total JSON request body size for updates is limited to 5MB.
-Each request can update a maximum of 100 records.

Request Method

POST

Request URL

https://altatech.ai/v2/database/update/record

Authentication

For details, refer to the API Overview for authentication methods.

Request

Request Example

curl -X POST 'https://altatech.ai/v2/database/update/record' \ 
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
      "table_id": "673af861ed69656ac0895b07",
      "is_create": true,
      "update_data":[
        {
          "record_id":"123456",
          "updated_fields": {
          "name": "andy",
          "age": "30"
        },
        {  
          "filter": {
          "id": "789"
          },
          "updated_fields": {
          "name": "mop",
          "age": "32"
        }
      ]
    }'

Request Headers

Field Type Description
Authorization Bearer {token} Use Authorization: Bearer {token} for authentication. Obtain the token from the API key page.
Content-Type application/json Data type, set to application/json.

Request Body

Field Type Required Description
table_id string Yes Table ID.
is_create bool No Whether to create a new record when the target record does not exist.
update_data list Yes The collection of data to update.
record_id string No Either record_id or filter must be provided. record_id is recommended.
filter map No User-defined filter condition (e.g., custom unique primary key).
updated_fields list Yes Set of data to be updated.

-Either record_id or filter must be provided, with record_id being the recommended option. When both are provided, record_id takes precedence.
-The default value of is_create is false. When is_create is not provided, new records will not be automatically created.

Response

Response Example

{
    "totalCount": 4,
    "success_count": 2,
    "fail_count": 2,
    "fail_detail": [
        {
            "upsert_data": {
                "record_id": "123456",
                "value": {
                    "name": "test user",
                    "email": "invalid_email"
                }
            },
            "fail_reason": "Invalid email format"
        },
        {
            "upsert_data": {
                "filter": {
                    "id": "789"
                },
                "value": {
                    "name": "test user",
                    "email": "invalid_email"
                }
            },
            "fail_reason": "Invalid email format"
        }
    ]
}

Success Response

Field Type Description
totalCount int Total number of records in this update operation
success_count string Number of successfully updated records
fail_count string Number of failed update operations
fail_detail array Detailed information about failed updates
upsert_data array The requested data for updating this row
fail_reason array The reason for the failure to update this row

Failure Response

Field Type Description
code int Error code.
message string Error details.

Error Codes

Code Message
40000 Parameter error
50000 Internal system error
403106 Table not found
403131 No access to the data table