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.
Assign roles when creating the tracking request
Pass each party as a relationship named after its role. One party per role. Endpoint: POST - https://api.terminal49.com/v2/tracking_requestsRequest
422 and a pointer to the relationship.
Assign roles to an existing shipment
Use this to add roles later, or to add a second party in the same role. 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.