Use this API resources to CRUD trucking companies.

Supported Formats

json

GET /api/v1/trucking_companies
Returns the list of trucking companies

This API endpoint will allow you to get a list of trucking companies. You can filter by using different query parameters such as name or general_ledger_id.

Each trucking company includes allowed_shipping_lines (Pickup Allowed for Shipping Line entries).

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Not Found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/trucking_companies.json?name=Octopi" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "actions" : {
      "previous" : {
         "url" : "https://app.octopi.co/api/v1/trucking_companies.json?page=1&per=10",
         "method" : "GET"
      },
      "last" : {
         "url" : "https://app.octopi.co/api/v1/trucking_companies.json?page=7&per=10",
         "method" : "GET"
      },
      "next" : {
         "url" : "https://app.octopi.co/api/v1/trucking_companies.json?page=3&per=10",
         "method" : "GET"
      },
      "index" : {
         "url" : "https://app.octopi.co/api/v1/trucking_companies.json",
         "method" : "GET"
      }
   },
   "trucking_companies" : [
      {
         "id" : 353388,
         "name" : "FC UNITED",
         "email" : "joe@example.com",
         "address" : "123 Main St",
         "code" : "SCAC",
         "general_ledger_id" : "SL1231",
         "vat_number" : "223",
         "contact_person" : "Joe Jones",
         "phone" : "786-111-1111",
         "active" : true,
         "allowed_until" : "2027-12-31",
         "allowed_shipping_lines" : [
            {
               "id" : 42,
               "shipping_line_id" : 1,
               "shipping_line_code" : "MAEU",
               "shipping_line_name" : "Maersk Line",
               "allowed_until" : "2027-12-31T23:59:59Z"
            }
         ],
         "created_at" : "2022-05-16T02:44:16Z",
         "updated_at" : "2025-04-09T12:33:57Z"
      }
   ]
}

Params

Param name Description
name
optional

Allows you to filter/search trucking companies by name

Validations:

  • Must be a String

code
optional

Allows you to filter/search trucking companies by codes (e.g. SCAC codes)

Validations:

  • Must be a String

general_ledger_id
optional

Allows you to filter/search trucking companies by general ledger ID

Validations:

  • Must be a String

missing_general_ledger_id
optional

Set to true to return all trucking companies that do not have a general ledger ID

Validations:

  • Must be a String

active
optional

Filter for active trucking companies by setting to true. Or set to false to get all inactive trucking companies. If absent, Octopi will return both active and inactive trucking companies.

Validations:

  • Must be a String

page
optional

Specify which page of results to fetch. This value defaults to 1.

Validations:

  • Must be a Integer

per
optional

The number of items to be displayed. This value defaults to 10 and accepts a maximum of 100.

Validations:

  • Must be a Integer


GET /api/v1/trucking_companies/:id
Returns information about a trucking company

This API endpoint will return the information for the trucking company, including allowed_until (Allowed Until) and allowed_shipping_lines (Pickup Allowed for Shipping Line entries).

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Not Found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/trucking_companies/5.json" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "trucking_company" : {
      "id" : 353388,
      "name" : "FC UNITED",
      "email" : "joe@example.com",
      "address" : "123 Main St",
      "code" : "SCAC",
      "general_ledger_id" : "SL1231",
      "vat_number" : "223",
      "contact_person" : "Joe Jones",
      "phone" : "786-111-1111",
      "active" : true,
      "allowed_until" : "2027-12-31",
      "allowed_shipping_lines" : [
         {
            "id" : 42,
            "shipping_line_id" : 1,
            "shipping_line_code" : "MAEU",
            "shipping_line_name" : "Maersk Line",
            "allowed_until" : "2027-12-31T23:59:59Z"
         }
      ],
      "created_at" : "2022-05-16T02:44:16Z",
      "updated_at" : "2025-04-09T12:33:57Z"
   }
}

Params

Param name Description
id
required

Validations:

  • Must be a Integer


POST /api/v1/trucking_companies
Create a new trucking company

This API endpoint allows you to create a new trucking company.

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Not Found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/trucking_companies.json" -X POST -d '{ "trucking_company": { "name" : "FC UNITED", "general_ledger_id": "SL1231", "contact_person": "Joe Jones", "address": "123 Main St", "email": "joe@example.com", "code": "111", "vat_number": "223", "allowed_until": "2027-12-31", "allowed_shipping_lines": [{ "shipping_line_id": 1, "allowed_until": "2027-12-31T23:59:59Z" }] } }' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "trucking_company" : {
      "id" : 353388,
      "name" : "FC UNITED",
      "email" : "joe@example.com",
      "address" : "123 Main St",
      "code" : "SCAC",
      "general_ledger_id" : "SL1231",
      "vat_number" : "223",
      "contact_person" : "Joe Jones",
      "phone" : "786-111-1111",
      "active" : true,
      "allowed_until" : "2027-12-31",
      "allowed_shipping_lines" : [
         {
            "id" : 42,
            "shipping_line_id" : 1,
            "shipping_line_code" : "MAEU",
            "shipping_line_name" : "Maersk Line",
            "allowed_until" : "2027-12-31T23:59:59Z"
         }
      ],
      "created_at" : "2022-05-16T02:44:16Z",
      "updated_at" : "2025-04-09T12:33:57Z"
   }
}

Params

Param name Description
trucking_company
required

Validations:

  • Must be a Hash

trucking_company[name]
required

Trucking company name (required).

Validations:

  • Must be a String

trucking_company[contact_person]
optional

Validations:

  • Must be a String

trucking_company[phone]
optional

Validations:

  • Must be a String

trucking_company[address]
optional

Validations:

  • Must be a String

trucking_company[email]
optional

Validations:

  • Must be a String

trucking_company[code]
optional

SCAC or other company code (unique per organization when present).

Validations:

  • Must be a String

trucking_company[general_ledger_id]
optional

Validations:

  • Must be a String

trucking_company[vat_number]
optional

Validations:

  • Must be a String

trucking_company[allowed_until]
optional

Allowed Until for the trucking company (date, YYYY-MM-DD).

Validations:

  • Must be a String

trucking_company[allowed_shipping_lines]
optional

Optional. New Pickup Allowed for Shipping Lines

Validations:

  • Must be an Array of nested elements

trucking_company[allowed_shipping_lines][shipping_line_id]
required

Shipping line ID (required for each new entry).

Validations:

  • Must be a Integer

trucking_company[allowed_shipping_lines][allowed_until]
optional

Allowed until for this shipping line (ISO 8601 date-time).

Validations:

  • Must be a String


PUT /api/v1/trucking_companies/:id
Updates a trucking company record

This API endpoint allows you to update a trucking company.

To remove a Pickup Allowed for Shipping Line entry, PUT with the allowed shipping line id from the GET response and destroy set to true in that array element (see the delete curl example below).

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Not Found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/trucking_companies/353388.json" -X PUT -d '{ "trucking_company": { "allowed_until": "2027-12-31", "allowed_shipping_lines": [{ "id": 42, "shipping_line_id": 1, "allowed_until": "2027-12-31T23:59:59Z" }] } }' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
curl "https://app.octopi.co/api/v1/trucking_companies/353388.json" -X PUT -d '{ "trucking_company": { "allowed_shipping_lines": [{ "id": 42, "_destroy": true }] } }' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "trucking_company" : {
      "id" : 353388,
      "name" : "FC UNITED",
      "email" : "joe@example.com",
      "address" : "123 Main St",
      "code" : "SCAC",
      "general_ledger_id" : "SL1231",
      "vat_number" : "223",
      "contact_person" : "Joe Jones",
      "phone" : "786-111-1111",
      "active" : true,
      "allowed_until" : "2027-12-31",
      "allowed_shipping_lines" : [
         {
            "id" : 42,
            "shipping_line_id" : 1,
            "shipping_line_code" : "MAEU",
            "shipping_line_name" : "Maersk Line",
            "allowed_until" : "2027-12-31T23:59:59Z"
         }
      ],
      "created_at" : "2022-05-16T02:44:16Z",
      "updated_at" : "2025-04-09T12:33:57Z"
   }
}

Params

Param name Description
id
required

Trucking company ID.

Validations:

  • Must be a Integer

trucking_company
required

Validations:

  • Must be a Hash

trucking_company[name]
optional

Validations:

  • Must be a String

trucking_company[contact_person]
optional

Validations:

  • Must be a String

trucking_company[phone]
optional

Validations:

  • Must be a String

trucking_company[address]
optional

Validations:

  • Must be a String

trucking_company[email]
optional

Validations:

  • Must be a String

trucking_company[code]
optional

SCAC or other company code (unique per organization when present).

Validations:

  • Must be a String

trucking_company[general_ledger_id]
optional

Validations:

  • Must be a String

trucking_company[vat_number]
optional

Validations:

  • Must be a String

trucking_company[allowed_until]
optional

Allowed Until for the trucking company (date, YYYY-MM-DD).

Validations:

  • Must be a String

trucking_company[allowed_shipping_lines]
optional

Optional. Manage existing Pickup Allowed for Shipping Lines.

Validations:

  • Must be an Array of nested elements

trucking_company[allowed_shipping_lines][id]
optional

ID of the existing allowed shipping line entry.

Validations:

  • Must be a Integer

trucking_company[allowed_shipping_lines][shipping_line_id]
optional

Shipping line ID

Validations:

  • Must be a Integer

trucking_company[allowed_shipping_lines][allowed_until]
optional

Allowed until for this shipping line (ISO 8601 date-time).

Validations:

  • Must be a String

trucking_company[allowed_shipping_lines][_destroy]
optional

PUT only. Set to true to remove an entry.

Validations:

  • Must be one of: true, false.


DELETE /api/v1/trucking_companies/:id
Soft deletes a trucking company record

This API endpoint allows you to soft delete a trucking company. This is a soft delete. It will mark the company as inactive.

Supported Formats

json

Errors

Code Description
400 Bad Request.
404 Not Found.
422 Unprocessable Entity.
500 Internal Server Error.

Examples

curl "https://app.octopi.co/api/v1/trucking_companies/353388.json" -X DELETE -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "trucking_company" : {
      "id" : 353388,
      "name" : "FC UNITED",
      "email" : "joe@example.com",
      "address" : "123 Main St",
      "code" : "SCAC",
      "general_ledger_id" : "SL1231",
      "vat_number" : "223",
      "contact_person" : "Joe Jones",
      "phone" : "786-111-1111",
      "active" : false,
      "allowed_until" : "2027-12-31",
      "allowed_shipping_lines" : [
         {
            "id" : 42,
            "shipping_line_id" : 1,
            "shipping_line_code" : "MAEU",
            "shipping_line_name" : "Maersk Line",
            "allowed_until" : "2027-12-31T23:59:59Z"
         }
      ],
      "created_at" : "2022-05-16T02:44:16Z",
      "updated_at" : "2025-04-09T12:33:57Z"
   }
}

Params

Param name Description
id
required

Trucking company ID.

Validations:

  • Must be a Integer