Skip to main content
Use this guide to assign parties to your shipments from code instead of the dashboard bulk update.

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:
If the party does not exist, create it:
Request
Keep the returned 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_requests
Request
The roles are copied to the shipment when it is created. The tracking request response does not list them; read them on the shipment as shown below. A party from another account fails the whole request with 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_roles
Request
Response
Send one request per role. Repeat with "role": "consignee" and "role": "freight_forwarder".

Read the roles on the shipment

Request the shipment with flag[parties]=true and include the parties:
The shipment carries a 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:
  1. List the roles and find the party_role with "role": "consignee".
  2. DELETE https://api.terminal49.com/v2/shipments/SHIPMENT_ID/party_roles/PARTY_ROLE_ID. Returns 204.
  3. 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.

Errors