Gaining an Api Key

In order to use our client API you will need to be granted access by our team, if you have not done so already, please contact us to gain access to your API key. Once you have been granted access, you can log in to your user dashboard and view your client id and API key on the right of the page. You will need both of these in order to authenticate requests sent from your app.

Authenticating

Before jobs can be posted using the API, you must first be granted an access token. This can be gained by sending a post request to the following url:
https://app.samedaycouriernetwork.com/api/oauth/access_token

The following fields need to be contained within the body of that request:
grant_type: "client_credentials"
client_id: "your_client_id_here"
client_secret: "your_api_key_here"

If authentication is successful you will receive a response containing an access token:

{
	"access_token": "BHKO1noGBsCMgT27FbPmVI2hSnsmq8kqAS0I1krY",
	"token_type": "Bearer",
	"expires_in": 3122064000
}

This access token can then be used to authorise all other requests. The token should be sent as an Authorization Bearer header as follows:

Authorization: Bearer BHKO1noGBsCMgT27FbPmVI2hSnsmq8kqAS0I1krY

Posting a New Job

In order to post a new job, send a post request, which includes the Authorization Bearer header, to the following url:

https://app.samedaycouriernetwork.com/api/client/job

The following is a list of fields that can be included in the post request:

  • pickup_point – required, string (max 255 characters and should contain the city name and postcode of the destination e.g. Shaw OL2 8PJ)
  • pickup_date – required, date (e.g. 2018-07-12 00:00:00)
  • pickup_latitude – required, numeric
  • pickup_longitude – required, numeric
  • destination_point -required, string (max 255 characters and should contain the city name and postcode of the destination e.g. Shaw OL2 8PJ)
  • destination_latitude – required, numeric
  • destination_longitude – required, numeric
  • destination_date – required, date (e.g. 2018-07-12 00:00:00)
  • vehicle_id – required, integer
  • distance – optional, integer (distance between pickup_point and destination_point)
  • accept_phone – optional, boolean (whether or not the customer accepts phone calls)
  • phone – required if accept_phone is true, string (customers phone number)
  • accept_email – optional, boolean (whether or not the customer accepts emails)
  • email – required if accept_email is true, string (customers email address)
  • details – optional, text (details of the job to be posted)
  • expiry_time – optional, date (e.g. 2018-07-12 00:00:00), defaults to 1 day after job is posted

Response Object

Below is a sample response object that you can expect to receive after posting a job along with a 204 response code:


{
   "data":[
      {
         "user_id":1,
         "priority":3,
         "pickup_date":"2018-08-24 14:39:20",
         "destination_date":"2018-08-25 08:00:00",
         "expiry_time":"2018-08-25 14:39:20",
         "additional_options":[
            ""
         ],
         "pickup_postcode_prefix":"NE8",
         "pickup_town":"Gateshead",
         "destination_postcode_prefix":"",
         "destination_town":"York",
         "pickup_point":"Bewick Road, Gateshead",
         "pickup_formatted_address":"Gateshead NE8 4DP",
         "pickup_latitude":54.9565065,
         "pickup_longitude":-1.6012154,
         "destination_point":"York",
         "destination_formatted_address":"York",
         "destination_latitude":53.9599651,
         "destination_longitude":-1.0872979000001,
         "distance":133359,
         "duration":"1 hour 41 mins",
         "vehicle_id":"5",
         "details":"test notes",
         "accept_phone":1,
         "phone":"+44 2000000000",
         "pickup_date_end":"2018-08-24 14:40:00",
         "destination_date_end":"2018-08-24 14:40:00",
         "updated_at":"2018-08-24 14:40:00",
         "created_at":"2018-08-24 14:40:00",
         "id":13052,
         "team_id":3,
         "name_full":"Joe Blogs",
         "contact_email":null,
         "contact_phone":"+44 20 7930 1980",
         "way_points":[

         ],
         "my_bid_id":false,
         "bid":null,
         "bids_count":0,
         "user_info":{

         },
         "distance_in_miles":82.86,
         "vehicle":{
            "id":5,
            "name":"Bike",
            "sort_no":1,
            "size":100
         },
         "bids":[

         ]
      }
   ],
   "properties":[

   ]
}

Field Return Types

  • user_id – int
  • priority – int
  • pickup_date – date-time
  • destination_date – date-time
  • expiry_time – date-time
  • additional_options – string
  • pickup_postcode_prefix – string
  • pickup_town – string
  • destination_postcode_prefix – string
  • destination_town – string
  • pickup_point – string
  • pickup_formatted_address – string
  • pickup_latitude – decimal
  • pickup_longitude – decimal
  • destination_point – string
  • destination_formatted_address – string
  • destination_latitude – decimal
  • destination_longitude – decimal
  • distance – int
  • duration – string
  • vehicle_id – int
  • details – string
  • accept_phone – tinyint
  • phone – string
  • pickup_date_end – date-time
  • destination_date_end – date-time
  • updated_at – date-time
  • created_at – date-time
  • id – int
  • team_id – int
  • name_full – string
  • contact_email – string
  • contact_phone – string
  • way_points – Array of objects [ id (int), job_id (int), way_point (string), stopoff_date (date-time), created_at (date-time), updated_at (date_time) ]
  • my_bid_id – int
  • bid – boolean
  • bids_count – int
  • user_info – object [ id (int), name_first (string), name_last (string), name_full (string), email (string), phone (string), avatar_url (string), score (int) ,ratings_count (int), team_info (object) ]

    • team_info – object [ id (int), company_name (string), company_number (string), vat_number (string), address_line_1 (string), address_line_2 (string), town (string), county (string), postal_code (string), deactivated_at (date-time), score (int), ratings_count (int), invoice_details (object) ]
      • invoice_details – object [ invoice_recipient_id (int), invoice_recipient_name (string), invoice_recipient_email (string), invoice_recipient_phone (string), invoice_footer_text (string), invoice_including_vat (float), invoice_logo (string), invoice_address_line_1 (string), invoice_address_line_2 (string), invoice_town (string), invoice_county (string), invoice_postal_code (string) ]

  • invoice_options – object [ recipient (object), footer_text (string), invoice_logo (string), including_vat (float) ]

    • recipient – object [ name (string), email (string), phone (string) ]
  • distance_in_miles – int
  • vehicle – object [ id (int), name (string), sort_no (int), size (int) ]
  • bids – Array of objects [ id (int), job_id (int), user_id (int), bid_date(date-time), amount(decimal), details (text), created_at (date-time), updated_at (date-time) ]
  • properties – object

Accessing a list of Vehicle Types

A full list of vehicle types along with their id’s can be accessed, via a GET request (access token is required), from the following url:
https://app.samedaycouriernetwork.com/api/client/vehicles
Please see the vehicle field in the return type list above for the data that will be contained within this request.