# PUT /api/custom-fields/values/{relatedTo}/{id} > Custom Fields - Set Custom Field values of a record Creates or updates the custom field values of one record. Only the fields sent in the request are touched, the others keep their current value. Send an empty string to clear a value. Multi value fields (multi_select, checkboxes, multiple_choice) accept either a comma separated string or an array of options. The record must exist in the given context, otherwise the request is answered with a 404. Every posted value is validated against its field definition before anything is written: a field marked as required cannot be cleared, and the value of a select, multi_select, multiple_choice or checkboxes field must be one of the options of that field. The whole request runs in one transaction, so either every value is saved or none of them is. - **Endpoint:** `PUT /api/custom-fields/values/{relatedTo}/{id}` - **Group:** Custom Fields - **Since:** v1.0.0 - **Defined in:** `RestApi/Controllers/CustomFieldsController.php` ## Headers | Field | Type | Description | | --- | --- | --- | | `authtoken` | String | Authentication token, generated from admin area | ## Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `relatedTo` | String | yes | Context the record belongs to | | `id` | Number | yes | Unique ID of the record inside that context | | `values` | Object | yes | Mandatory map of custom field id to value. A list of {"custom_field_id": .., "value": ..} objects is accepted as well. | ## Request example ```bash curl -X PUT "https://yoursite.com/index.php/api/custom-fields/values/lead/123" \ -H "authtoken: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "values": "..." }' ``` ## Responses ### Success - Success-Response: ```json HTTP/1.1 200 OK { "status": 200, "messages": { "success": "Record saved" }, "data": [ { "custom_field_id": "3", "title": "Region", "field_type": "select", "value": "North" } ] } ``` ### Error - Unknown-Record: ```json HTTP/1.1 404 Not Found { "status": false, "messages": { "error": "No data were found" } } ``` ### Error - Unknown-Field: ```json HTTP/1.1 400 Bad Request { "status": false, "messages": { "custom_field_9": "Unknown custom field for the clients context." } } ``` ### Error - Invalid-Value: ```json HTTP/1.1 400 Bad Request { "status": false, "messages": { "custom_field_3": "Value not allowed. Allowed options: North, South", "custom_field_4": "This field is required.", "custom_field_5": "The value contains characters or keywords which are not allowed." } } ``` ### Error - Save-Failed: ```json HTTP/1.1 400 Bad Request { "status": false, "messages": { "error": "None of the custom field values were saved, the whole request was rolled back.", "custom_field_3": "Could not be saved." } } ``` --- Part of the [REST API for RISE CRM](https://risecrm.themesic.com/apiguide/) documentation. Full page: https://risecrm.themesic.com/apiguide/custom-fields/update-custom-field-values/