Skip to main content
POST
/
api
/
v2
/
shipments
/
{shipment_id}
/
custom_fields
cURL
curl --request POST \
  --url https://api.example.com/api/v2/shipments/{shipment_id}/custom_fields
Creates or updates a custom field on a shipment. If a custom field with the specified api_slug already exists, it will be updated.

Path parameters

ParameterRequiredDescription
shipment_idYesThe ID of the shipment

Request body

ParameterRequiredDescription
api_slugYesThe slug of the custom field definition
valueYesThe value to set (type depends on the definition’s data type)

Authorization

Requires update permission on the shipment.

Response

Returns 201 Created with the custom field resource on success.

Behavior

  • Uses find_or_initialize_by internally, so it creates if missing or updates if it exists
  • Values are validated against the definition’s data type
  • For enum fields, values are validated against the definition’s options