How parties and roles work
- A party is a company in your account, managed through
/v2/parties. - A party role links one party to one shipment or container in one role.
- Roles are a list, not a field. A shipment can carry two parties as
consignee. To replace a party, remove its role and assign a new one.
You need an API key. See Start here.
Find or create the party
Search your parties by name:Request
data.id. It is the PARTY_ID below.
Get the shipment ID
Roles are assigned on the shipment, so the shipment has to exist. A tracking request has a shipment once itsstatus is created. Read the ID from the tracked_object relationship of GET /v2/tracking_requests/TRACKING_REQUEST_ID, or from the tracking_request.succeeded webhook. See Tracking Request Lifecycle.
The customer is the exception: pass it in relationships.customer when creating the tracking request. See Add a Customer to a Tracking Request.
Assign roles to the shipment
Endpoint: POST - https://api.terminal49.com/v2/shipments/SHIPMENT_ID/party_rolesRequest
Response
"role": "consignee" and "role": "freight_forwarder".
Read the roles on the shipment
Request the shipment withflag[parties]=true and include the parties:
party_roles relationship and the included array holds each party_role and its party. The same flag works on GET /v2/shipments. -g stops curl from treating the brackets in flag[parties] as a range.
To list the roles alone, use GET /v2/shipments/SHIPMENT_ID/party_roles.
Replace a party
To replace the consignee:- List the roles and find the
party_rolewith"role": "consignee". - DELETE https://api.terminal49.com/v2/shipments/SHIPMENT_ID/party_roles/PARTY_ROLE_ID. Returns
204. - POST the new consignee.
Assign a dray carrier to a container
Containers accept one role,pickup_dray_carrier:
Endpoint: POST - https://api.terminal49.com/v2/containers/CONTAINER_ID/party_roles
Read it back with GET /v2/containers/CONTAINER_ID/party_roles.