Skip to main content
POST
/
declaration-templates
/
groups
/
{id}
/
apply
Apply template group
curl --request POST \
  --url https://sandbox-api.easecustoms.com/declaration-templates/groups/{id}/apply \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "shipmentId": 123,
  "declarationIds": [
    {}
  ],
  "fieldOnlyIfEmpty": true
}
'
{
  "shipmentId": 99,
  "applied": true,
  "declarationsUpdatedCount": 2,
  "message": "Template group applied successfully"
}
Apply a template group to a shipment and its linked declarations. This overlays the template’s default field values on the target declarations.

Path Parameters

id
number
required
The unique template group ID.

Request Payload

shipmentId
integer
required
The ID of the shipment to apply templates to.
declarationIds
array
Optional array of specific declaration IDs to apply the template group to. If omitted, applies to all declarations linked to the shipment.
fieldOnlyIfEmpty
boolean
default:"true"
If true, only overrides fields that are currently empty/null.
JSON Payload
{
  "shipmentId": 99,
  "declarationIds": [42, 43],
  "fieldOnlyIfEmpty": true,
  "arrayMode": "replace"
}
{
  "shipmentId": 99,
  "applied": true,
  "declarationsUpdatedCount": 2,
  "message": "Template group applied successfully"
}