Trexity v1_0 API (1.0)

Download OpenAPI specification:Download

Introduction

This OpenAPI Specification describes v1_0 of the Trexity API.

Before getting started, please make sure you've acquired Trexity Merchant API Key.

Each endpoint requires an Authorization header with "Bearer <Trexity API Key>" in order to be used.

Below, we describe the available API endpoints in details and provide examples (request/response and curl ones).

Response Envelope

All endpoints will return an object and if there is actual data to be returned, it is going to be named data.

data may be an array or an object.

If there is error field present on the root JSON object, that means something went wrong and that error message is

all we know about it. Additionally, in some cases, you may inspect the HTTP status codes to gather more information.

Please check our payload/response examples in details as well as the curl examples that are a part of each section that documents

an operation.

Example of a successful response: { data: ... }

Example of a response with an error: { error: 'Some error message', data: null }

Posting a Shipment

In order for Trexity to start the process of matching drivers for your shipment, your shipment must be posted.

The most common way of doing this is via our (post shipment)[/#operation/postShipment] endpoint.

In order to schedule posting a shipment in the future, please use 'scheduledPostAt' in our (create shipment)[/#operation/createShipment] endpoint.

Authentication

BearerAuth

The bearer token which is your Trexity API KEY.

Every request against a Trexity API endpoint must be accompanied with an Authorization header.

For instance:

curl -X POST https://trexity.app/api/v1_0/shipment-rates\
-H 'Content-Type: application/json'\
-H 'Authorization: Bearer <Trexity API Key>'\
-d '{
  "pickupAddress": "9 Slack Road, Ottawa, Canada",
  "deliveryAddresses": ["123 Slater Street, Ottawa, Canada"],
  "requirements": {},
  "orderValue": 2500
}'

Please check our curl examples for more examples.

Security Scheme Type HTTP
HTTP Authorization Scheme bearer

Bearer API Key

In order to obtain a Trexity Merchant API key, you need to sign-up as Merchant at https://trexity.com

The API key is a string of 128 characters that you can create after you've logged in as Merchant in Trexity's Merchant Portal (https://merchant.trexity.com/)

Feel free to contact support@trexity.com for any questions you may have.

Shipping Rates

Prior to creating a Shipment, you can calculate the rates based on the pickup address and the number of stops the driver has to do. See our shipment-rates endpoint for more information.

Calculates the rate for a proposed shipment

Returns the distance (in meters), travel duration (in seconds), and fee from a pickup address to the completion of the shipment (takes into account multiple parcel dropoffs, if any). Supports specifying an order value parameter, which will check against API Preferences configured in the merchant portal.

Authorizations:
Request Body schema: application/json

Payload that minimally describes a shipment.

pickupAddress
required
string (AddressOrLatLng) <= 512 characters

Latitutde and longitude values separated by comma or an address to be geocoded into latitude and longitude values.

Examples:

  • 44.339565,-78.666433
  • 308 Rideau St, Ottawa, ON K1N 5Y5
deliveryAddresses
required
Array of strings (AddressOrLatLng) [ 1 .. 19 ] items

One or more latitude and longitude values separated by comma or an address to be geocoded into latitude and longitude values.

Examples:

  • 44.339565,-78.666433
  • 308 Rideau St, Ottawa, ON K1N 5Y5
required
object (ShipmentRequirements)

Object representing the requirements that to be met by a driver in order for them to be considered for delivery.

orderValue
number >= 0

The order value, if any. Specified in cents.

Responses

Request samples

Content type
application/json
{
  • "pickupAddress": "456 Elgin Street, Ottawa, ON",
  • "deliveryAddresses":
    [
    ],
  • "requirements":
    {
    },
  • "orderValue": 2500
}

Response samples

Content type
application/json
Example
{
  • "data":
    [