Skip to main content
POST
/
containers
/
{container_id}
/
custom_fields
Create a container custom field
curl --request POST \
  --url https://api.terminal49.com/v2/containers/{container_id}/custom_fields \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "type": "custom_field",
    "attributes": {
      "api_slug": "<string>",
      "value": "<string>"
    }
  }
}
'
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "type": "custom_field",
    "attributes": {
      "api_slug": "<string>",
      "value": "<string>",
      "display_value": "<string>"
    },
    "relationships": {
      "entity": {
        "data": {
          "type": "shipment",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      },
      "definition": {
        "data": {
          "type": "custom_field_definition",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      }
    }
  },
  "links": {
    "self": "<string>"
  }
}
Creates or updates a custom field on a container. If a custom field with the specified api_slug already exists, it will be updated.

Path parameters

ParameterRequiredDescription
container_idYesThe ID of the container

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 container.

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

Authorizations

Authorization
string
header
required

Token YOUR_API_TOKEN

The APIs require authentication to be done using header-based API Key and Secret Authentication.

API key and secret are sent va the Authorization request header.

You send your API key and secret in the following way:

Authorization: Token YOUR_API_KEY

Path Parameters

container_id
string
required

Container ID

Body

application/json
data
object

Response

201 - application/json

Created

data
Custom field · object