Why you would want to add a party to a tracking request?

Adding a party to a tracking request allows you to associate customer information with the tracking request. The customer added to the tracking request will be assigned to the shipment when it is created, just like reference numbers and tags. This can help in organizing and managing your shipments more effectively.

How to get the party ID?

You can either find an existing party or create a new one.

Listing all parties

You can list all parties associated with your account through the API.

Endpoint: GET - https://api.terminal49.com/v2/parties

Response
{
  "data": [
    {
      "id": "PARTY_ID_1",
      "type": "party",
      "attributes": {
        "company_name": "COMPANY NAME 1",
      }
    },
    {
      "id": "PARTY_ID_2",
      "type": "party",
      "attributes": {
        "company_name": "COMPANY NAME 2",
      }
    }
  ],
  "links": {
    "last": "<string>",
    "next": "<string>",
    "prev": "<string>",
    "first": "<string>",
    "self": "<string>"
  },
  "meta": {
    "size": 2,
    "total": 2
  }
}

After you get all the parties you would filter the parties by company_name to find the correct ID, either by looking through the list manually or using code to automate the process.

How to add party to tracking request if you have the party ID?

To add a customer to a tracking request, you need to add the party to the tracking request as a customer relationship while being created. Note that a party cannot be added to a tracking request that has already been created.

Endpoint: POST - https://api.terminal49.com/v2/tracking_requests

Request
{
  "data": {
    "type": "tracking_request",
    "attributes": {
      "request_type": "bill_of_lading",
      "request_number": "MEDUFR030802",
      "ref_numbers": [
        "PO12345",
        "HBL12345",
        "CUSREF1234"
      ],
      "shipment_tags": [
        "camembert"
      ],
      "scac": "MSCU"
    },
    "relationships": {
      "customer": {
        "data": {
          "id": "PARTY_ID",
          "type": "party"
        }
      }
    }
  }
}

After you send a POST request to create a tracking request, you will receive a response with the Tracking Request ID and customer relationship. You can use this tracking request ID to track the shipment.

Response
{
  "data": {
    "id": "TRACKING_REQUEST_ID",
    "type": "tracking_request",
    "attributes": {
      "request_type": "bill_of_lading",
      "request_number": "MEDUFR030802",
      "ref_numbers": [
        "PO12345",
        "HBL12345",
        "CUSREF1234"
      ],
      "shipment_tags": [
        "camembert"
      ],
      "scac": "MSCU"
    },
    "relationships": {
      "tracked_object": {
        "data": null
      },
      "customer": {
        "data": {
          "id": "PARTY_ID",
          "type": "party"
        }
      }
    },
    "links": {
      "self": "/v2/tracking_requests/TRACKING_REQUEST_ID"
    }
  }
}

Adding party for a customer

For adding a customer to a tracking request, you need to create a party first. You can create a party through the API.

Endpoint: POST - https://api.terminal49.com/v2/parties

Request
{
  "data": {
    "type": "party",
    "attributes": {
      "company_name": "COMPANY NAME"
    }
  }
}

After you send a POST request to create a party, you will receive a response with the Party ID. You can use this Party ID to add the customer to a tracking request.

Response
{
  "data": {
    "id": "PARTY_ID",
    "type": "party",
    "attributes": {
      "company_name": "COMPANY NAME"
    }
  }
}

Editing a party

You can update existing parties through the API.

Endpoint: PATCH - https://api.terminal49.com/v2/parties/PARTY_ID

Reading a party

You can retrieve the details of an existing party through the API.

Endpoint: GET - https://api.terminal49.com/v2/parties/PARTY_ID