Update vehicle custom fields
This API updates a vehicle’s custom fields in a single request by agent_id or imei. You can update all fields or just a subset; the number of fields is not limited.
Method
POST
Request address
To get the data, use the address: https://<server_address>/api/api.php
Headers
Content-Type: application/json
Authorization: Basic <your_credentials_b64>
Request parameters
-
cmd=agent_update_custom_fields — API command
-
agent_id — vehicle identifier (use if you don’t send imei)
-
imei — device IMEI (use if you don’t send agent_id)
-
custom_fields — object with key–value pairs for updating custom fields
In custom_fields you can include any number of fields, e.g., extra_field1, extra_field2, … extra_fieldN (as long as these fields exist in the account). Values may be numbers, strings, or booleans.
Example requests
Update multiple fields by agent_id:
curl -X POST 'https://<server_address>/api/api.php'
-H 'Content-Type: application/json'
-H 'Authorization: Basic <your_credentials_b64>'
-d '{
"cmd": "agent_update_custom_fields",
"agent_id": 30547,
"custom_fields": {
"extra_field1": "Waybill #123",
"extra_field2": "2025-11-01",
"extra_field7": "+79000000000"
}
}'
|
Update by imei:
curl -X POST 'https://<server_address>/api/api.php'
-H 'Content-Type: application/json'
-H 'Authorization: Basic <your_credentials_b64>'
-d '{
"cmd": "agent_update_custom_fields",
"imei": "359339099999999",
"custom_fields": {
"extra_field3": "Pass A12345",
"extra_field4": "2025-12-31"
}
}'
|
Example response
{
"code": 1,
"msg": "OK"
}
|
In response to the API request, the following is returned:
-
code — execution code: 1 = success, 0 = error
-
msg — textual result (e.g., "OK" or an error message)