Basics

Sendbox API are HTTP based RESTful APIs. API request and response format are in JSON.

  • All request should be issued using HTTP protocol

  • All request requires authentication

  • Content type for responses will always be application/json

API Request

To construct an API request the following components are required.

You are advised to make all test request on the staging API and ensure there are no errors before you deploy to users using the live API

API response

This describes the response format for Sendbox API

Sendbox API calls return HTTP status codes in the response headers. API calls also return JSON response bodies that include information about the resource.

Each REST API request returns a success or error HTTP status code.we will talk about errors latter in the docs but for now, we will focus on success.

Fetching Data

Fetching data means you will like to retrieve data from a resource. Most times, you are required to set header parameters usually the content-type and the authorization key and make a get request to an endpoint. For example, let say we want to get all shipments, we can simply make a get request and a successful request will come back with a 200 status code and return all the shipments in JSON format.

Fetch Data

https://sandbox.staging.sendbox.co/shipping

https://live.sendbox.co/shipping/shipments

In this example, we are making a get request to shipment endpoint to fetch all shipments

Headers

Posting Data

Posting data is a little different from fetching data. here you are required to make a post request to the endpoint and pass in a body of JSON data you would like to post. For example, let's say you want to get delivery quotes for a shipment. You simply make a post request to the delivery quotes endpoint this returns a status code 201 and quotes of that shipments in JSON format.

JSON body sample to make a post request

{
"origin_country":"Nigeria",
"origin_country_code":"NG", 
"origin_state" : "Lagos",
"destination_country":"Nigeria",
"destination_country_code":" ",
"destination_state": "Abuja",
"weight" : 3,
"destination_state_code":"ABV",
"origin_state_code": "LOS"
}

Post Data

https://sandbox.staging.sendbox.co/shipping/shipment_delivery_quote

https://live.sendbox.co/shipping/shipment_delivery_quote

In this example, we are making a post request to the shipment_delivery_quote endpoint.

Headers

Body Parameters

Last updated