General intro
Users of the HIVED API can create shipments for delivery to be made in the postcodes covered by HIVED and retrieve the corresponding shipping label.We are continuously working on providing more features and functionalities to our APIs. If you have any feedback or suggestions how we could make our APIs more useful for you, please don’t hesitate to let us know at tech@hived.space.
Technical intro
The API closely follows REST semantics, uses JSON to encode objects, and relies on standard HTTP codes to signal operation outcomes.
(An older version of the API is available here)
https://test.api.hived.space
1. Authentication
In order to access our label generation API you will need to generate a JSON Web Token (JWT) for authentication. Send a GET request using Basic Auth with the credentials provided to you to the endpoint /user/login. In response, you will receive your unique JWT that will expire after 60 days. Use this token in the headers for your request to the label generation endpoint.
Example request (cURL)
Response
Valid request: JWT successfully generated. Returns JWT.
Unauthorised request: credentials invalid.
Valid request: JWT successfully generated. Returns JWT.
Unauthorised request: credentials invalid.
Example Response
2. Create shipment
In order to create a new shipment, issue a POST request to the /shipment endpoint. Your request body should include a JSON object (= shipment) with a number of mandatory fields that contain the desired shipment properties (e.g. recipient name, recipient address). The request returns the generated label as an application/pdf and generates a shipment in the HIVED database.
The API also checks whether the postcode sent is within the HIVED coverage area (see also our Service Overview). If all mandatory fields are provided and the postcode is valid, the request will reply with code 200 as well as the shipping label PDF. If the postcode sent is in invalid format or outside of our coverage area, a validation error and code 401 will be returned.
The shipment endpoint is limited to 5 requests per second. If that limit is met, code 429 is returned.
Request
The fields below show all types of shipment-related information you can provide.
string (max. 55 characters)
string (max. 55 characters)
string (max. 55 characters)
string (a full valid UK postcode)
string (a valid email address)
string (a valid phone number)
string (a full valid UK postcode)
string (either of exactly: "Same-Day", "Next-Day", "2-Days")> if no option is selected, the default will be "Next-Day")
number with 1 decimal; e.g. “1.5”
integer without any decimals; e.g. “20”
integer without any decimals; e.g. “20”
integer without any decimals; e.g. “20”
Boolean (either "true" for fragile or "false" for not fragile)> if no option is selected, the default will be "false")
number with 2 decimals, e.g. "119.90"
age_verification_required
Boolean (either "true" when required or "false" when not required)> the default is "false", please don't specify this field unless agreed beforehand)
collection_address_line_1
collection_address_line_2
collection_address_line_3
string (a valid UK postcode)
string (a valid phone number)
sender_chosen_collection_date
date (in the format "YYYY-MM-DD" > this is only required if the collection date is not supposed to be asap)
sender_chosen_delivery_date
date (in the format "YYYY-MM-DD" > this is only required if the collection date is not supposed to be asap)
integer (provided by HIVED)
string (max. 55 characters)
string (max. 55 characters)
string (max. 55 characters)
string (a full valid UK postcode)
string (a valid email address)
string (a valid phone number)
string (a full valid UK postcode)
string (either of exactly: "Same-Day", "Next-Day", "2-Days")> if no option is selected, the default will be "Next-Day")
number with 1 decimal; e.g. “1.5”
integer without any decimals; e.g. “20”
integer without any decimals; e.g. “20”
integer without any decimals; e.g. “20”
Boolean (either "true" for fragile or "false" for not fragile)> if no option is selected, the default will be "false")
number with 2 decimals, e.g. "119.90"
age_verification_required
Boolean (either "true" when required or "false" when not required)> the default is "false", please don't specify this field unless agreed beforehand)
collection_address_line_1
collection_address_line_2
collection_address_line_3
string (a valid UK postcode)
string (a valid phone number)
sender_chosen_collection_date
date (in the format "YYYY-MM-DD" > this is only required if the collection date is not supposed to be asap)
sender_chosen_delivery_date
date (in the format "YYYY-MM-DD" > this is only required if the collection date is not supposed to be asap)
integer (provided by HIVED)
Example Response
Response
Valid request: postcode and shipment information accepted. Creates shipment record in HIVED database and returns HIVED shipping label.
One or more validation errors: postcode invalid and/ or insufficient shipment information received.
Unauthorised request: token missing or invalid.
Valid request: postcode and shipment information accepted. Creates shipment record in HIVED database and returns HIVED shipping label.
One or more validation errors: postcode invalid and/ or insufficient shipment information received.
Unauthorised request: token missing or invalid.
Example Response (200, application/pdf)
Response format (400 - 503, application/ json)