Apply template group
curl --request POST \
--url https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentId": 123,
"declarationIds": [
{}
],
"fieldOnlyIfEmpty": true,
"arrayMode": "<string>"
}
'import requests
url = "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply"
payload = {
"shipmentId": 123,
"declarationIds": [{}],
"fieldOnlyIfEmpty": True,
"arrayMode": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipmentId: 123,
declarationIds: [{}],
fieldOnlyIfEmpty: true,
arrayMode: '<string>'
})
};
fetch('https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentId' => 123,
'declarationIds' => [
[
]
],
'fieldOnlyIfEmpty' => true,
'arrayMode' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply"
payload := strings.NewReader("{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"shipmentId": 1057,
"applied": true,
"declarationsUpdatedCount": 2,
"message": "Template group applied successfully"
}
Declaration Templates
Apply template group
Apply a template group to a shipment or specific declarations.
POST
/
v1
/
declaration-templates
/
groups
/
{id}
/
apply
Apply template group
curl --request POST \
--url https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentId": 123,
"declarationIds": [
{}
],
"fieldOnlyIfEmpty": true,
"arrayMode": "<string>"
}
'import requests
url = "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply"
payload = {
"shipmentId": 123,
"declarationIds": [{}],
"fieldOnlyIfEmpty": True,
"arrayMode": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipmentId: 123,
declarationIds: [{}],
fieldOnlyIfEmpty: true,
arrayMode: '<string>'
})
};
fetch('https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentId' => 123,
'declarationIds' => [
[
]
],
'fieldOnlyIfEmpty' => true,
'arrayMode' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply"
payload := strings.NewReader("{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devapi.eazecustoms.com/staging/v1/declaration-templates/groups/{id}/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentId\": 123,\n \"declarationIds\": [\n {}\n ],\n \"fieldOnlyIfEmpty\": true,\n \"arrayMode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"shipmentId": 1057,
"applied": true,
"declarationsUpdatedCount": 2,
"message": "Template group applied successfully"
}
Apply a template group to a shipment and its linked declarations, or to specific declarations by ID. This overlays the template’s default field values on the target declarations.
Path parameters
number
required
The unique template group ID.
Request payload
integer
The ID of the shipment to apply templates to. Use this when applying to all declarations under a shipment.
array
Array of specific declaration IDs to apply the template group to. Use this when applying to specific declarations instead of a full shipment.
boolean
default:"true"
If
true, only overrides fields that are currently empty/null. If false, overwrites all matching fields.string
default:"ifEmpty"
Controls how array fields (e.g. documents) are applied. Allowed values:
ifEmpty, overwrite, replace.- Apply to shipment
- Apply to declarations
JSON Payload
{
"shipmentId": 1057,
"fieldOnlyIfEmpty": true,
"arrayMode": "ifEmpty"
}
JSON Payload
{
"declarationIds": [3047, 3046],
"fieldOnlyIfEmpty": false,
"arrayMode": "overwrite"
}
{
"shipmentId": 1057,
"applied": true,
"declarationsUpdatedCount": 2,
"message": "Template group applied successfully"
}
⌘I