Assign a container party role
curl --request POST \
--url https://api.terminal49.com/v2/containers/{container_id}/party_roles \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "party_role",
"attributes": {
"role": "pickup_dray_carrier"
},
"relationships": {
"party": {
"data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
}
}
}
}
}
'import requests
url = "https://api.terminal49.com/v2/containers/{container_id}/party_roles"
payload = { "data": {
"type": "party_role",
"attributes": { "role": "pickup_dray_carrier" },
"relationships": { "party": { "data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
} } }
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'party_role',
attributes: {role: 'pickup_dray_carrier'},
relationships: {party: {data: {id: 'ba4cb904-827f-4038-8e31-1e92b3356218', type: 'party'}}}
}
})
};
fetch('https://api.terminal49.com/v2/containers/{container_id}/party_roles', 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://api.terminal49.com/v2/containers/{container_id}/party_roles",
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([
'data' => [
'type' => 'party_role',
'attributes' => [
'role' => 'pickup_dray_carrier'
],
'relationships' => [
'party' => [
'data' => [
'id' => 'ba4cb904-827f-4038-8e31-1e92b3356218',
'type' => 'party'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.terminal49.com/v2/containers/{container_id}/party_roles"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.terminal49.com/v2/containers/{container_id}/party_roles")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.terminal49.com/v2/containers/{container_id}/party_roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1d0f2a0e-5c3b-4c7e-9a52-3b6f8d2e4a11",
"type": "party_role",
"attributes": {
"role": "pickup_dray_carrier",
"roleable_type": "Cargo",
"roleable_id": "8f0c6b1a-2d4e-4f7b-9c3a-5e6d7f8a9b0c",
"created_at": "2026-09-01T14:02:11Z",
"updated_at": "2026-09-01T14:02:11Z"
},
"relationships": {
"party": {
"data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
}
}
}
},
"included": [
{
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party",
"attributes": {
"company_name": "ACME LOGISTICS",
"nickname": "ACME"
}
}
],
"links": {
"self": "/v2/containers/8f0c6b1a-2d4e-4f7b-9c3a-5e6d7f8a9b0c/party_roles"
}
}
Party Roles
Assign a container party role
Assign a party to a container in the Terminal49 API as dray carrier.
POST
/
containers
/
{container_id}
/
party_roles
Assign a container party role
curl --request POST \
--url https://api.terminal49.com/v2/containers/{container_id}/party_roles \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "party_role",
"attributes": {
"role": "pickup_dray_carrier"
},
"relationships": {
"party": {
"data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
}
}
}
}
}
'import requests
url = "https://api.terminal49.com/v2/containers/{container_id}/party_roles"
payload = { "data": {
"type": "party_role",
"attributes": { "role": "pickup_dray_carrier" },
"relationships": { "party": { "data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
} } }
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'party_role',
attributes: {role: 'pickup_dray_carrier'},
relationships: {party: {data: {id: 'ba4cb904-827f-4038-8e31-1e92b3356218', type: 'party'}}}
}
})
};
fetch('https://api.terminal49.com/v2/containers/{container_id}/party_roles', 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://api.terminal49.com/v2/containers/{container_id}/party_roles",
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([
'data' => [
'type' => 'party_role',
'attributes' => [
'role' => 'pickup_dray_carrier'
],
'relationships' => [
'party' => [
'data' => [
'id' => 'ba4cb904-827f-4038-8e31-1e92b3356218',
'type' => 'party'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.terminal49.com/v2/containers/{container_id}/party_roles"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.terminal49.com/v2/containers/{container_id}/party_roles")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.terminal49.com/v2/containers/{container_id}/party_roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"party_role\",\n \"attributes\": {\n \"role\": \"pickup_dray_carrier\"\n },\n \"relationships\": {\n \"party\": {\n \"data\": {\n \"id\": \"ba4cb904-827f-4038-8e31-1e92b3356218\",\n \"type\": \"party\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1d0f2a0e-5c3b-4c7e-9a52-3b6f8d2e4a11",
"type": "party_role",
"attributes": {
"role": "pickup_dray_carrier",
"roleable_type": "Cargo",
"roleable_id": "8f0c6b1a-2d4e-4f7b-9c3a-5e6d7f8a9b0c",
"created_at": "2026-09-01T14:02:11Z",
"updated_at": "2026-09-01T14:02:11Z"
},
"relationships": {
"party": {
"data": {
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party"
}
}
}
},
"included": [
{
"id": "ba4cb904-827f-4038-8e31-1e92b3356218",
"type": "party",
"attributes": {
"company_name": "ACME LOGISTICS",
"nickname": "ACME"
}
}
],
"links": {
"self": "/v2/containers/8f0c6b1a-2d4e-4f7b-9c3a-5e6d7f8a9b0c/party_roles"
}
}
Attaches a party from your account to the container in one role.
Path parameters
| Parameter | Required | Description |
|---|---|---|
container_id | Yes | The ID of the container |
Roles
pickup_dray_carrier only
Behavior
- Roles are additive. Posting a second party with the same role keeps both
- To replace a party, delete its role and create a new one
- Posting the same party and role twice returns
422 - The party must belong to your account, otherwise the request returns
401 - Any other role returns
422
Authorizations
Use a Terminal49 API key in the Authorization header with the Token prefix.
Authorization: Token YOUR_API_KEY
Path Parameters
Container ID
Body
application/json
Show child attributes
Show child attributes
Was this page helpful?