NAV

Introduction

Welcome to the Sendle API!

You can use our Application Programming Interface (API) to book Sendle parcels, manage shipping, and oversee past and present orders any way you like!

example of a Sendle API call using Curl:

  curl 'https://api.sendle.com/api/quote?pickup_suburb=Wonglepong&pickup_postcode=4275&delivery_suburb=Foul%20Bay&delivery_postcode=5577&kilogram_weight=2.0&cubic_metre_volume=0.01'
  -H 'Content-Type: application/json'

Sendle API uses JSON. You can view code examples in the rightmost column.

For all examples in this guide, we will be using cURL from the command line, but you are encouraged to make requests in whichever method you are most comfortable with.

API Endpoints

The Sendle API services different tasks which can be accessed through GET, POST, or DELETE requests through specific urls.

endpoint request task
/api/ping GET Connection Test
/api/quote GET Quoting
/api/orders POST Booking Orders
/api/orders/{id} GET View Order {id}
/api/{label_url} GET View a Label
/api/tracking/{ref} GET Track a Parcel
/dashboard/prepare_form - Prepare Form URL

Getting Started

Requests should be made with the following headers:

  Content-Type: application/json
  Accept: application/json

cURL authorization looks like:

 -U "sendleAPI:42RRTjYz5Z4hZrm8XY3t4Vxt"

Before anything else, you will need to have a Sendle Account

From the Sendle Dashboard visit the Settings tab from the sidebar. Visit your API tab to get your Sendle ID and your api key.

API Settings

Be sure to use Sendle’s sandbox environment for testing first!

Requests to the API require the use of HTTP Basic Authentication using your account’s Sendle ID as the user name and your API key as the password.

Sandbox Server

Sendle provides access to a sandbox server at https://sandbox.sendle.com. You will need to create a new account for the sandbox server – just like you did for Sendle and set up a sandbox credit card.

Any orders created on the sandbox server will be created in the test mode, they will not result in actual consignments that can be used to send a parcel. Using a valid credit card in Sandbox will not work, so please review Stripe’s test credit card numbers (below).

Set Up Payments

Response Without Payment Details

  {
    "error":"payment_required",
    "error_description":"The account associated with this API key has no method of payment. Please go to your Account Settings in your Sendle Dashboard and add a payment method."
  }

To use the Sendle API, during the beta period you need to attach a credit card to your Sendle account for invoicing.

Set Up Account

Response Without Dangerous Goods Terms Accepted

  {
    "error":"precondition_failed",
    "error_description":"The account associated with this API key has not accepted the dangerous goods terms. Please visit your Account Settings in https://www.sendle.com/dashboard/ to view and accept these terms."
  }

To create orders with the Sendle API you must accept the dangerous goods terms in your Pickup Settings

Ping Server

GET /api/ping

[ GET /api/ping ]

All API interactions will require your Sendle ID and your API Key as username and password for HTTP Basic Authentication (Make sure to replace sendleID and APIKey with your Sendle ID & API key.)

  curl 'https://api.sendle.com/api/ping'
  -u sendleID:APIKey
  -H "Content-Type: application/json"
  -H "Accept: application/json"

Sendle uses your Sendle ID together with your own API Key to grant access to the server. Together this allows you to access the API so that you may book and follow up with orders, as well as view past orders you have sent or received.

For this initial example, we’ll simply ping the server.

You must include your credentials in every request, or you will be denied. If you only you include your Sendle ID, you will be prompted to enter your API key (password).

OK Response

Status 200:

  {
    "ping":"pong"
  }

When the api receives a request with a Sendle ID and an API Key the server responds with a JSON string containing the relevant details.

Without Credentials

No Sendle ID AND No API Key

  curl 'https://api.sendle.com/api/ping'

Response:

  HTTP Basic: Access denied.

Response With incorrect Credentials:

  {
    "error":"unauthorised",
    "error_description":"The authorisation details are not valid. Either the Sendle ID or API key are incorrect."
  }

Getting Quotes

GET /api/quote

[ GET /api/quote ]

The quoting API operates in two modes:

  1. (Recommended) Requesting a quote with your Sendle ID and API key will return the quote for the relevant account’s plan only.
  2. Requesting a quote without providing your Sendle ID and API key will return all quotes for all publicly available plans.

Either way, be sure to include all the relevant fields when you make a request.

[GET /api/quote]

  curl 'https://api.sendle.com/api/quote?pickup_suburb=Wonglepong&pickup_postcode=4275&delivery_suburb=Foul%20Bay&delivery_postcode=5577&kilogram_weight=2.0&cubic_metre_volume=0.01' -H 'Content-Type: application/json' -H 'Accept: application/json'

200 Response

  [
    {
      "quote":{
        "gross":{
          "amount":14.75,
          "currency":"AUD"
        },
        "net":{
          "amount":13.41,
          "currency":"AUD"
        },
        "tax":{
          "amount":1.34,
          "currency":"AUD"
        }
      },
      "plan_name":"Easy"
    },
    {
      "quote":{
        "gross":{
          "amount":13.75,
          "currency":"AUD"
        },
        "net":{
          "amount":12.5,
          "currency":"AUD"
        },
        "tax":{
          "amount":1.25,
          "currency":"AUD"
        }
      },
      "plan_name":"Premium"
    },
    {
      "quote":{
        "gross":{
          "amount":13.74,
          "currency":"AUD"
        },
        "net":{
          "amount":12.49,
          "currency":"AUD"
        },
        "tax":{
          "amount":1.25,
          "currency":"AUD"
        }
      },
      "plan_name":"Pro"
    }
  ]

Empty Request

curl 'https://api.sendle.com/api/quote'

Response

  {
    "messages":{
      "pickup_suburb":["can't be blank"],
      "pickup_postcode":["can't be blank"],
      "delivery_suburb":["can't be blank"],
      "delivery_postcode":["can't be blank"],
      "kilogram_weight":["is not a number"]
    },
    "error":"unprocessable_entity",
    "error_description":"The data you supplied is invalid. Error messages are in the messages section. Please fix those fields and try again."
  }

Query Basics

The ? after the quote endpoint initiates the query. Be sure to separate terms using <name>=<value> pairs in your request and use percent-encoding for all spaces or special characters in your query string like the example (right). If you need more information on GET & POST requests, the Treehouse blog has a nice summary.

Parcel Quote Requirements

name Attributes
pickup_suburb Suburb must be real and match pickup postcode.
pickup_postcode Four-digit post code for the pickup address.
delivery_suburb Suburb must be real and match delivery postcode.
delivery_postcode Four-digit post code for the delivery address.
kilogram_weight Must be a decimal-value above 0 and less than weight limits. Max weight is 25 kilograms.
cubic_metre_volume
optional
Must be decimal-value between 0 and 1. To determine this measurement multiply length x width x depth of the parcel in metres.
plan_name Without authenticating, the API will give quotes for all publicly available plans by default. If plan_name is specified, the API will respond with a quote for just the given plan. Current available plans are Easy, Premium, and Pro. For authenticated requests, the API always returns the quote for the account’s current plan and ignores plan_name.

For specific information about weight limits and parcel sizing, visit the Weights and Dimensions section.

Request with plan_name

  curl 'https://api.sendle.com/api/quote?pickup_suburb=Wonglepong&pickup_postcode=4275&delivery_suburb=Foul%20Bay&delivery_postcode=5577&kilogram_weight=2.0&cubic_metre_volume=0.01&plan_name=Premium'
  -H 'Content-Type: application/json'

200 Response

  [
    {
      "quote":{
        "gross":{
          "amount":13.75,
          "currency":"AUD"
        },
        "net":{
          "amount":12.5,
          "currency":"AUD"
        },
        "tax":{
          "amount":1.25,
          "currency":"AUD"
        }
      },
      "plan_name":"Premium"
    }
  ]

Request with authentication

  curl 'https://api.sendle.com/api/quote?pickup_suburb=Wonglepong&pickup_postcode=4275&delivery_suburb=Foul%20Bay&delivery_postcode=5577&kilogram_weight=2.0&cubic_metre_volume=0.01'
  -u "sendleID:APIKey"
  -H 'Content-Type: application/json'

200 Response

  [
    {
      "quote":{
        "gross":{
          "amount":13.75,
          "currency":"AUD"
        },
        "net":{
          "amount":12.5,
          "currency":"AUD"
        },
        "tax":{
          "amount":1.25,
          "currency":"AUD"
        }
      },
      "plan_name":"Premium"
    }
  ]

Creating Orders

POST /api/orders

[ POST /api/orders ]

To create an order, submit order data via POST command. The order will be rejected if the data fails validation and the API will respond with an error.

Example Booking JSON

Example Booking

  curl "https://api.sendle.com/api/orders"
  -X POST
  -u "sendleID:APIKey"
  -H "Content-Type: application/json"
  -H "Accept: application/json"
  -d '{
    "pickup_date": "2015-11-24",
    "description": "Kryptonite",
    "kilogram_weight": 1,
    "cubic_metre_volume": 0.01,
    "customer_reference": "SupBdayPressie",
    "metadata": {
      "your_data": "XYZ123"
    },
    "sender": {
      "contact": {
        "name": "Lex Luthor",
        "phone": "0412 345 678"
      },
      "address": {
        "address_line1": "123 Gotham Ln",
        "suburb": "Sydney",
        "state_name": "NSW",
        "postcode": "2000",
        "country": "Australia"
      },
      "instructions": "Knock loudly"
    },
    "receiver": {
      "contact": {
        "name": "Clark Kent",
        "email": "clarkissuper@dailyplanet.xyz"
      },
      "address": {
        "address_line1": "80 Wentworth Park Road",
        "suburb": "Glebe",
        "state_name": "NSW",
        "postcode": "2037",
        "country": "Australia"
      },
      "instructions": "Give directly to Clark"
    }
  }'

Each collection within the example booking JSON is described in detail in the sections below.

Section Attributes
Parcel details Pickup date, a parcel description, weight, volume, and a customer reference for the shipment
Sender details Sender contact details, origin address, and pickup instructions
Sender address Origin Address Details
Receiver details Recipient contact details, destination address, and delivery instructions
Receiver address Destination Address Details
API response JSON object returned with a valid booking
Labels Getting Shipping Labels

Parcel Details

  {
    "pickup_date": "2015-11-24",
    "description": "Kryptonite",
    "kilogram_weight": 1,
    "cubic_metre_volume": 0.01,
    "customer_reference": "SupBdayPressie",
    "metadata": {
      "your_data": "XYZ123"
    }
  }
Data Field Attributes
pickup_date
“yyyy-mm-dd”
If provided the date must be at least one non-holiday, business day in the future. If pickup date is omitted it will be set to the first available pickup date option and returned in the order payload on subsequent requests.
description
optional
Description is used by the customer to track the parcel on Sendle Dashboard. It does not show up on a label. It must be under 255 characters in length.
kilogram_weight Must be a decimal value greater than 0 and less than the maximum allowed weight of 25kg.
cubic_metre_volume
optional
Must be a decimal value between 0 and 1. When included, value will be length x width x depth of parcel in metres.
customer_reference
optional
Reference will appear on the label for parcel identification. It must be under 255 characters in length.
metadata
optional
Up to 1MB of JSON key/value pairs which will be stored for this order. These are included when Viewing an Order and in some bulk reports available from the system.

Sender Details

  {
    "sender":{
      "instructions":"Pick up with reception",
      "contact":{
        "name":"Lex Luthor",
        "phone":"0412 345 678",
        "email":"me@lexluthor.com"
      }
    }
  }
sender
object
A collection of parcel origin details.
instructions
optional
Short message used as pickup instructions for courier. It must be under 255 chars, but is recommended to be under 40 chars due to label-size limitations.
contact
object
A collection of sender contact details.
name It must be under 255 characters in length.
email Leave this empty - it will be populated with your email based on your account.
phone Used to coordinate pickup if the courier is outside attempting delivery. It must be a valid Australian phone number (including area code), or fully qualified international number. Examples: (02) 1234 1234, +1 519 123 1234, +61 (0)4 1234 1234.

Sender Address

  {
    "address":{
      "address_line1":"123 Gotham Ln",
      "address_line2":null,
      "suburb":"Sydney",
      "state_name":"NSW",
      "postcode":"2000",
      "country":"Australia"
    }
  }
address
object
A collection of origin address details.
address_line1 The street address where the parcel will be picked up. Addresses can be split over two lines using address_line1 and address_line2. Only address_line1 is mandatory. line2 will be displayed below line1 on the parcel label. Do not include postcode, state, or suburb in this field It must be under 255 char in length, but best practice to keep under 40 chars due to label-size limitations.
address_line2
optional
Second line of the street address for the pickup location.
suburb Suburb or town where the parcel is to be picked up. If Sendle cannot service this location, response will be a validation error stating that the suburb is not serviceable. Postcode and suburb must match. If they do not match, Sendle will return a set of alternates to choose from. If receiving an unserviceable error, you may want to check if the location is also listed under a different suburb name.
postcode Postcode of pickup location. It must be a four digit string for a valid location. If the area cannot be picked up from, response will be a validation error stating the location is unserviceable.
state_name Must be the pickup location’s state or territory. Valid options include: ACT, NSW, NT, QLD, SA, TAS, VIC, WA. Long-form (i.e. “Northern Territory”) is also accepted.
country
optional
Sendle only works within Australia. If absent, Sendle assumes orders are in Australia. String value under 255 characters in length. If included, must read “Australia”

Receiver Details

  {
    "receiver": {
      "instructions": "Give directly to Clark",
      "contact": {
        "name": "Clark Kent",
        "email": "clarkissuper@dailyplanet.xyz",
        "phone": "0287654321"
      }
    }
  }
receiver
object
A collection of parcel recipient details.
instructions Short message used as delivery instructions for courier. It must be under 255 chars, but is recommended to be under 40 chars due to label-size limitations.
contact
object
A collection of receiver details.
name It must be under 255 characters in length.
email
optional
Recipient email allows Sendle to send parcel updates to the recipient.
phone
optional
Used to coordinate pickup if the courier is outside attempting delivery. It must be a valid Australian phone number (including area code), or fully qualified international number. Examples: (02) 1234 1234, +1 519 123 1234, +61 (0)4 1234 1234.

Receiver Address

  {
    "address": {
      "address_line1": "80 Wentworth Park Road",
      "suburb": "Glebe",
      "state_name": "NSW",
      "postcode": "2037",
      "country": "Australia"
    }
  }
address
object
A collection of destination address details.
address_line1 The street address where the parcel will be delivered. Addresses can be split over two lines using address_line1 and address_line2. Only address_line1 is mandatory. line2 will be displayed below line1 on the parcel label. Do not include postcode, state, or suburb in this field. It must be under 255 char in length, but best practice to keep under 40 chars due to label-size limitations.
address_line2
optional
Second line of the street address for the pickup location.
suburb Suburb or town where the parcel is to be delivered. If Sendle cannot service this location, response will be a validation error stating that the suburb is not serviceable. Postcode and suburb must match. If they do not match, Sendle will return a set of alternates to choose from.
postcode Postcode of destination location. It must be a four digit string for a valid location. If the area is cannot be delivered to, response will be a validation error stating the location is unserviceable.
state_name Must be the destination location’s state or territory. Valid options include: ACT, NSW, NT, QLD, SA, TAS, VIC, WA. Long-form (i.e. “Northern Territory”) is also accepted.
country
optional
Sendle only works within Australia. If absent, Sendle assumes orders are in Australia. String value under 255 characters in length. If included, must read “Australia”

API Response

201 Response

  {
    "order_id":"f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "state":"Payment",
    "order_url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "sendle_reference": "S3ND73",
    "tracking_url":"https://track.sendle.com/tracking?ref=S3ND73",
    "labels":null,
    "scheduling":{
      "is_cancellable":true,
      "pickup_date":"2015-10-24"
    },
    "description":"Kryptonite",
    "kilogram_weight":"1.0",
    "cubic_metre_volume":"0.01",
    "customer_reference":"SupBdayPressie",
    "metadata": {
      "your_data": "XYZ123"
    },
    "sender":{
      "contact":{
        "name":"Lex Luthor",
        "phone":"0412 345 678",
        "email":"me@lexluthor.com"
      },
      "address":{
        "address_line1":"123 Gotham Ln",
        "address_line2":null,
        "suburb":"Sydney",
        "state_name":"NSW",
        "postcode":"2000",
        "country":"Australia"
      },
      "instructions":"Knock loudly"
    },
    "receiver":{
      "contact":{
        "name":"Clark Kent",
        "phone":null,
        "email":"clarkissuper@dailyplanet.xyz"
      },
      "address":{
        "address_line1":"80 Wentworth Park Road",
        "address_line2":null,
        "suburb":"Glebe",
        "state_name":"NSW",
        "postcode":"2037",
        "country":"Australia"
      },
      "instructions":"Give directly to Clark"
    }
  }

A successful response will be a full version of an Order object. Many of the fields sent in a booking response are confirmation of the details sent in a booking request and are covered in detail in the View an Order section. In addition to the booking details, information about the current State of the order, URLs for order details, and scheduling information is included.

Field Description
order_id The order’s individual identification in Sendle’s system.
state Identifies the current state of the order. Visit Check for Status Updates for more information.
order_url Specific url for order queries. After booking, this url becomes the point to check for updated information (state changes), labels and any other information related to the order.
sendle_reference Reference ID for a Sendle Order. References begin with an “S” and are an alphanumeric string six or more characters in length.
tracking_url The order’s public tracking page. Tracking page updates as the parcel progresses from sender to receiver. The url can be shared and viewed without a Sendle Account and contains no personal information about either party.
labels Covered in detail in the label section, however this field will return null at the initial order booking. After the booking is processed, label details will be included within the label object.
scheduling Information regarding the order’s pickup date and whether an order can be cancelled

Weights and Dimensions

A satchel

{
  "kilogram_weight":"0.4",
  "cubic_metre_volume":"0.001"
}

A shoebox

{
  "kilogram_weight":"1.0",
  "cubic_metre_volume":"0.01"
}

A Carry-on

{
  "kilogram_weight":"5.2",
  "cubic_metre_volume":"0.05"
}

Note that the kilogram_weight (5.2) has bumped the parcel to the carry-on size despite the relatively small cubic_metre_volume.

Sendle Sizes

Sendle uses five standard sizes for parcel delivery:

Size Weight – Kg (Max) Volume – m3 (Max)
Satchel 0.5kg 0.002
Shoebox 2kg 0.008
Briefcase 5kg 0.02
Carry-on 10kg 0.04
Luggage 25kg 0.1

Sendle uses weight (kilogram weight) and volume (cubic metre volume) together to determine the size of your parcel.

Sendle will choose the parcel size that can accommodate the weight and volume of your request. If either unit is over, Sendle will select the next size for your parcel.

Satchel Specifics

Satchels cannot have delivery_instructions

{
  "receiver": {
    "delivery_instructions": "Give directly to Clark."
  }
}

Returns error message:

{
  "messages":{
    "receiver":[
      "No delivery instructions are allowed when booking at satchel rates - all satchels are 'Authority to Leave'"
    ]
  },
  "error":"unprocessable_entity",
  "error_description":"The data you supplied is invalid. Error messages are in the messages section. Please fix those fields and try again."
}

Satchels are special pouch-only mailers. Delivery instructions cannot be included for satchel sizes as delivery defaults to Authority To Leave (ATL)

Requirements:

Size Calculator

Size Calculator

If you are ever unsure about your parcel size, the Dashboard Size Calculator will convert your parcel’s length, width, and height measurements together with the weight to display the litre volume and select the correct parcel size.

View an Order

GET /api/orders/{id}

[ GET /api/orders/{id} ]

  curl "https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6"
    -u "sendleID:APIKey"
    -H "Content-Type: application/json"

200 Response

  {
    "order_id":"f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "state":"Pickup",
    "order_url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "sendle_reference": "S3ND73",
    "tracking_url":"https://track.sendle.com/tracking?ref=S3ND73",
    "labels":[
      {
        "format":"pdf",
        "size":"a4",
        "url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6/labels/a4.pdf"
      },
      {
        "format":"pdf",
        "size":"cropped",
        "url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6/labels/cropped.pdf"
      }
    ],
    "scheduling":{
      "is_cancellable":true,
      "pickup_date":"2015-10-24",
      "picked_up_on":null,
      "delivered_on":null,
      "estimated_delivery_date_minimum":"2015-10-26",
      "estimated_delivery_date_maximum":"2015-10-27"
    },
    "description":"Kryptonite",
    "confirmed_not_dangerous":true,
    "kilogram_weight":"1.0",
    "cubic_metre_volume":"0.01",
    "customer_reference":"SupBdayPressie",
    "metadata": {
      "your_data": "XYZ123"
    },
    "sender":{
      "contact":{
        "name":"Lex Luthor",
        "phone":"0412 345 678",
        "email":null
      },
      "address":{
        "address_line1":"123 Gotham Ln",
        "address_line2":null,
        "suburb":"Sydney",
        "state_name":"NSW",
        "postcode":"2000",
        "country":"Australia"
      },
      "instructions":"Knock loudly"
    },
    "receiver":{
      "contact":{
        "name":"Clark Kent",
        "phone":null,
        "email":"clarkissuper@dailyplanet.xyz"
      },
      "address":{
        "address_line1":"80 Wentworth Park Road",
        "address_line2":null,
        "suburb":"Glebe",
        "state_name":"NSW",
        "postcode":"2037",
        "country":"Australia"
      },
      "instructions":"Give directly to Clark"
    }
  }

Viewing an order will give you all the details associated with an existing Sendle Booking. Important details in an order include:

Field Description
order_id The order’s individual identification in Sendle’s system.
state Identifies the current state of the order. Visit Check for Status Updates for more information.
order_url Specific url for order queries. After booking, this url becomes the point to check for updated information (state changes), labels and any other information related to the order.
sendle_reference Reference ID for a Sendle Order. References begin with an “S” and are an alphanumeric string six or more characters in length.
tracking_url The order’s public tracking page. Tracking page updates as the parcel progresses from sender to receiver. The url can be shared and viewed without a Sendle Account and contains no personal information about either party.
labels Covered in detail in the label section. This field returns null at the initial order booking. After the booking is processed, label details will be included here.
scheduling Information regarding the order’s delivery status and whether an order can be cancelled. Some fields return null depending on the state of the order.
pickup_date is the date the courier has been requested to pick up the parcel. picked_up_on is the date the parcel was actually picked up.
estimated_delivery_date_minimum and estimated_delivery_date_maximum can change depending on courier conditions.

Getting Labels

GET {label_url}

[ GET {label_url} ]

  curl "https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6/labels/a4.pdf"
  -u "sendleID:APIKey"
  -o "label.pdf"
  -L

label data within order response

  {
    "labels":[
      {
        "format":"pdf",
        "size":"a4",
        "url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6/labels/a4.pdf"
      },
      {
        "format":"pdf",
        "size":"cropped",
        "url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6/labels/cropped.pdf"
      }
    ]
  }

Sendle currently has two labels to choose from:

Both labels are formatted as PDFs. Labels are stored within the order hash as an array (see example on right). Each label is a hash with a format, size, and url.

Using our order response, we can download the label by using cURL and our preferred label’s url. The label url will redirect you to a private PDF, do not cache this redirect URL as the access permissions expire after 1 minute.

Because of the redirect, special handling is needed. Adding the -L flag will follow the redirect to the label from within Sendle. If you are using cURL you can add the -O (Open) option to save the label with the remote file name, or -o <filename> to specify a file name locally.

This option is only valid once an order has been booked with a courier.

Label PDF

Example Shipping Label

Track a Parcel

GET /api/tracking/{ref}

[ GET /api/tracking/{ref} ]

  curl "https://api.sendle.com/api/tracking/S3ND73"

200 Response

  {
    "tracking_events":
      [
        {
          "event_type":"Pickup",
          "scan_time":"2015-11-17T20:31:00Z",
          "description":"Parcel picked up"
        },
        {
          "event_type":"Info",
          "scan_time":"2015-11-18T01:04:00Z",
          "description":"In transit between locations"
        },
        {
          "event_type":"In Transit",
          "scan_time":"2015-11-18T01:14:00Z",
          "description":"In transit",
          "origin_location":"Sydney",
          "destination_location":"Brisbane"
        },
        {
          "event_type":"Info",
          "scan_time":"2015-11-18T19:46:00Z",
          "description":"Arrived at the depot for processing"
        },
        {
          "event_type":"Info",
          "scan_time":"2015-11-18T23:00:00Z",
          "description":"Parcel is loaded for delivery"
        },
        {
          "event_type":"Delivered",
          "scan_time":"2015-11-18T23:46:00Z",
          "description":"Parcel delivered"
        }
      ]
    }

Order tracking gives the public details associated with a Sendle order based on the order’s Sendle Reference as a search key (as ref above). The API response returns tracking scans from pickup to delivery. Order tracking does not contain personal location information. Important details in tracking include:

Field Description
event_type Type of scan event. Options usually are Pickup, Info, or Delivered, though there are many tracking event types explained on the table below.
scan_time Timestamp marker for a tracking event scan. Scans are set in the UTC time zone.
description A short description for the tracking event.
origin_location Marks the departure location of a parcel from a physical hub within an order’s transit.
destination_location Marks the arrival location of a parcel to a physical hub in the courier network.
Event Type Description
Pickup Parcel successfully picked up.
Info Information received from courier.
In Transit Parcel in transit between courier hub locations.
Delivered Parcel successfully delivered.
Delivery Attempted Parcel delivery attempted, but unsuccessful.
Card Left Parcel delivery attempted, card left for receiver to arrange collection or re-delivery where available.
Left with Agent Parcel left with agent, this will be a parcel connect location, POPStation, or similar.
Delivery Failed Delivery failed.

Cancelling Orders

DELETE /api/orders/{id}

[ DELETE /api/orders/{id} ]

  curl "https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6"
  -X DELETE
  -u "sendleID:APIKey"
  -H "Content-Type: application/json"
  -H "Accept: application/json"

200 Response

  {
    "order_id":"f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "state":"Cancelled",
    "order_url":"https://api.sendle.com/api/orders/f5233746-71d4-4b05-bf63-56f4abaed5f6",
    "sendle_reference": "S3ND73",
    "tracking_url":"https://track.sendle.com/tracking?ref=S3ND73",
    "customer_reference":"SupBdayPressie",
    "cancelled_at":"2015-10-15 00:56:51 UTC",
    "cancellation_message":"Cancelled by S6LRX64PV8MABbBbzu6DoBHD during picking up"
  }

As long as an order has not been consigned with the courier, an order is cancellable. The value to review is:

is_cancellable If true, the order can be cancelled.

If a booking has already been submitted to the courier for pickup, a failure response (422) will be returned. is_cancellable is found in the scheduling section of the JSON along with delivery estimates. For an example of where is_cancellable can be seen, check the View an Order section.

Check for Status Updates

  {
    "state":"Pickup"
  }

States

Sendle uses a handful of terms to describe an order’s state within the shipment process. These are similar to the states used in Sendle Dashboard, but are not an exact match.

State Description
Pickup Booking has been consigned and Courier is scheduled to pick up the parcel.
Transit Parcel is in transit.
Delivered Parcel has been successfully delivered.
Cancelled A cancelled order.
Lost A lost order.
Unable to Book An order which cannot be booked with a courier.
Return to Sender An order which is being returned to the sender.

Prepare Form URL

https://www.sendle.com/dashboard/prepare_form

[ https://www.sendle.com/dashboard/prepare_form ]

The Prepare Form URL pre-fills a Send Parcel Form with pickup and delivery details.

This service requires a valid Sendle account with a confirmed email address.

Parcel Pickup Details

There are two ways to provide parcel pickup details for the Prepare Form URL.

The recommended approach is to use the customer’s default Sendle pickup details. To do this, make sure that none of the pickup_address_* or sender_* parameters get provided.

The other approach is to provide the full set of pickup_address_* and sender_* fields. In this case, the users’ defaults are ignored. The form get filled with only the parameters provided. This means any missing or blank parameters need to be manually completed by the user. For example, if only sender_name and sender_contact_number are passed in, the user will need to fill in pickup address and instructions on the form before sending.

Therefore, if providing any of these parameters we recommend populating the complete set. This will reduce the manual entry required by the user.

The available sender fields are:

URL Parameters Details

https://www.sendle.com/dashboard/prepare_form?pickup_date=2017%2D04%2D03&customer_reference=Flower+Delivery&kilogram_weight=1&cubic_metre_volume=0.001&receiver_name=Oscar+Wilde&delivery_address_line1=2+Smith+Lane&delivery_address_suburb=Sydney&delivery_address_state=NSW&delivery_address_postcode=2000
Data Field Attributes
PARCEL DETAILS
Details about the parcel.
pickup_date
yyyy-mm-dd
optional
If provided the date must be at least one non-holiday, business day in the future. If pickup date is omitted it will be set to the first available pickup date option.
description
optional
Description is used by the customer to track the parcel on Sendle Dashboard. It does not show up on a label. It must be under 255 characters in length.
kilogram_weight
optional
Must be a decimal value greater than 0 and less than the maximum allowed weight of 25kg.
cubic_metre_volume
optional
Must be a value between 0 and 0.1 (m³). When included, value will be length x width x depth of parcel in metres.
customer_reference
optional
Reference will appear on the label for parcel identification. It must be under 255 characters in length.
RECEIVER DETAILS
Details about the receiver.
delivery_instructions
optional
Short message used as delivery instructions for courier. It must be under 255 chars, but is recommended to be under 40 chars due to label-size limitations.
receiver_name
optional
It must be under 255 characters in length.
receiver_email
optional
Allows Sendle to send parcel updates to the recipient.
receiver_contact_number
optional
Used to coordinate pickup if the courier is outside attempting delivery. It must be a valid Australian phone number (including area code), or fully qualified international number. Examples: (02) 1234 1234, +1 519 123 1234, +61 (0)4 1234 1234.
delivery_address_line1
optional
The street address where the parcel will be delivered. Addresses can be split over two lines using delivery_address_line1 and delivery_address_line2. delivery_address_line2 will be displayed below delivery_address_line1 on the parcel label. Do not include postcode, state, or suburb in this field. It must be under 255 char in length, but best practice to keep under 40 chars due to label-size limitations.
delivery_address_line2
optional
Second line of the street address for the delivery location.
delivery_address_suburb
optional
Suburb or town where the parcel is to be delivered.
delivery_address_postcode
optional
Postcode of destination location. It must be a four digits.
delivery_address_state
optional
Must be the destination location’s state or territory. Valid options include: ACT, NSW, NT, QLD, SA, TAS, VIC, WA. Long-form (i.e. “Northern Territory”) is also accepted.
SENDER DETAILS
We recommend omitting these. If you provide one, provide all. See Parcel Pickup for details.
sender_name
optional
It must be under 255 characters in length.
sender_email
optional
Allows Sendle to send parcel updates to the sender.
sender_contact_number
optional
Used to coordinate pickup if the courier is outside attempting delivery. It must be a valid Australian phone number (including area code), or fully qualified international number. Examples: (02) 1234 1234, +1 519 123 1234, +61 (0)4 1234 1234.
pickup_instructions
optional
Short message used as pickup instructions for courier. It must be under 255 chars, but is recommended to be under 40 chars due to label-size limitations.
pickup_address_line1
optional
The street address where the parcel will be picked up. Addresses can be split over two lines using pickup_address_line1 and pickup_address_line2. pickup_address_line2 will be displayed below pickup_address_line1 on the parcel label. Do not include postcode, state, or suburb in this field It must be under 255 char in length, but best practice to keep under 40 chars due to label-size limitations.
pickup_address_line2
optional
Second line of the street address for the pickup location.
pickup_address_suburb
optional
Suburb or town where the parcel is to be picked up.
pickup_address_postcode
optional
Postcode of pickup location. It must be a four digits.
pickup_address_state
optional
Must be the pickup location’s state or territory. Valid options include: ACT, NSW, NT, QLD, SA, TAS, VIC, WA. Long-form (i.e. “Northern Territory”) is also accepted.

Errors

Error Codes

The Sendle API uses the following error codes:

Error Code Meaning
400 Bad Request – The data provided by the client (typically in the body) is invalid or incorrectly structured.
401 Unauthorized – The authorisation details are invalid. Either the Sendle ID, the API key (or both) are incorrect and should be fixed.
402 Payment Required – The client does not yet have a payment-method set up on their account, and cannot create orders.
404 Not Found – The requested resource/URI was not found.
422 Unprocessable Entity – The server was unable to complete the request due to the data itself. For example, validations within the data may fail, or an upstream request may not be able to be fulfilled with the data. This is different to 400 Bad Request as 422 Unprocessable Entity suggests that the request sent by the client was structurally valid, and the request was attempted.
500 Internal Error – An unhandled error has occured with the Sendle API. Contact support@sendle.com if the problem persists.
503 Not Available – The server is currently unavailable, due to maintenance or upgrades.

400 Bad request

  curl -i "https://api.sendle.com/api/orders"
  -X POST
  -u "sendleID:APIKey"
  -H "Content-Type: application/json"
  -d ']'

400 Response Header information:

  HTTP/1.1 400 Bad Request
  Content-Type: text/html; charset=utf-8
  Content-Length: 0

Invalid request format

When an invalid request is sent to the API, there is no visible response. This will include mostly formatting errors.

401 Unauthorised

401 Response after request without/incorrect Sendle ID or API Key

  {
    "error":"unauthorised",
    "error_description":"The authorisation details are not valid. Either the Sendle ID or API key are incorrect."
  }

Invalid sendle_id or api_key

If you have entered your Sendle ID or API Key incorrectly, you may want to double check your account details.

402 Payment Required

402 Response after POST valid order

  {
    "error":"payment_required",
    "error_description":"The account associated with this API key has no method of payment. Please go to your Account Settings in your Sendle Dashboard and add a payment method."
  }

Payment details not found

Without a credit card on file, booking orders will respond with a 402 error.

Non-booking queries will continue to work without payment and will not receive an error.

404 Not Found

404 Response when entering incorrect Order ID

  {
    "error":"not_found",
    "error_description":"The resource you requested was not found. Please check the URI and try again."
  }

Incorrect URI

If an Order ID or label url is incorrectly entered, a 404 error will be returned. Double-check the ID or url before continuing.

412 Precondition Failed

412 Response after POST valid order

  {
    "error":"precondition_failed",
    "error_description":"The account associated with this API key has not accepted the dangerous goods terms. Please visit your Account Settings in https://www.sendle.com/dashboard/ to view and accept these terms."
  }

Dangerous goods terms have not been accepted

Without accepting dangerous goods terms, booking orders will respond with a 412 error.

Non-booking queries will continue to work without accepting dangerous goods terms and will not receive an error.

422 Unprocessable Entity

Request with unallowable errors:

  curl "https://api.sendle.com/api/orders"
  -u "sendleID:APIKey"
  -H "Content-Type: application/json"
  -X POST
  -d '{
      "pickup_date": "2012-12-25",
      "description": "Showing 400 Error",
      "confirmed_not_dangerous": false,
      "kilogram_weight": 1,
      "cubic_metre_volume": 1.1,
      "customer_reference": "Four hundred twenty two",
      "sender": {
        "contact": {
          "name": "Sendle API",
          "sendle_id": "sendleAPI",
          "phone": "1300 345 678"
        },
        "address": {
          "address_line1": "123 Test Ave",
          "suburb": "Acton",
          "state_name": "ACT",
          "postcode": "2601",
          "country": "Australia"
        },
        "instructions": "Just a test."
      },
      "receiver": {
        "contact": {
          "name": "Jim",
          "email": "emailaddress.com"
        },
        "address": {
          "address_line1": "80 Wentworth Park Road",
          "suburb": "Glebe",
          "state_name": "NSW",
          "postcode": "2037",
          "country": "Australia"
        },
        "instructions": "Please leave inside the door."
      }
    }'

422 Response

  {
    "messages":{
      "pickup_date":[
        "must be a business day and at least one business day in the future."
      ],
      "confirmed_not_dangerous":[
        "must be accepted"
      ],
      "cubic_metre_volume":[
        "must be less than or equal to 0.5"
      ],
      "sender":[
        {
          "contact":[
            {
              "phone":[
                "must be a valid phone number. 13, 1300, and 1800 numbers are not allowed."
              ]
            }
          ]
        }
      ],
      "receiver":[
        {
          "contact":[
            {
              "email":[
                "must be a valid email address"
              ]
            }
          ]
        }
      ]
    },
    "error":"unprocessable_entity",
    "error_description":"The data you supplied is invalid. Error messages are in the messages section. Please fix those fields and try again."

Data format was correct but contained unprocessable information

422 errors occur most commonly as users become more familiar with the API interface. These errors occur when the server receives your request, it is properly formatted, but the information can not be processed as is.

Be sure to check the error messages as the server response will explain why the request could not be processed and often give suggestions.

503 Not Available

From time to time we might require a short outage to carry out maintenance or upgrades. In most cases the API will return a HTTP 503 error response.

Credits

This example API documentation page was created with Slate.