Skip to main content
POST
/
custom_fields
Create a custom field
curl --request POST \
  --url https://api.terminal49.com/v2/custom_fields \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "type": "custom_field",
    "attributes": {
      "api_slug": "<string>",
      "value": "<string>"
    },
    "relationships": {
      "entity": {
        "data": {
          "type": "shipment",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      }
    }
  }
}
'
{
  "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>"
  }
}
Use this endpoint to create a custom field value on a shipment or container. The field must reference an existing custom field definition.

Request body

ParameterRequiredDescription
entityYesPolymorphic relationship to a Shipment or Container
api_slugYesThe slug of the custom field definition
valueYesThe field value (must match the definition’s data type)

Value formats by data type

Data typeExpected value format
short_textAny string
numberNumeric value
dateDate string (parsed using definition’s default_format or flexible parsing)
datetimeDateTime string
booleantrue or false
enumString matching one of the definition’s option values
enum_multiArray of strings matching the definition’s option values

Validation

  • Values are validated against the definition’s data type
  • Enum values must match one of the definition’s configured options
  • The api_slug must reference a definition belonging to your account or a Terminal49 template

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

Body

application/json
data
object

Response

201 - application/json

Created

data
Custom field · object