How to import orders with the Click & Drop API

The Click & Drop API is an integration that allows you to create orders in Click & Drop via API from your own order management systems. This is suitable for eCommerce companies and websites that do not already have a direct integration with Click & Drop.

Please note that some level of development knowledge is required to import orders into Click & Drop by this method.

For developer documentation, click here: https://api.parcel.royalmail.com/

Contents:

  1. Getting started
  2. Creating an integration
  3. Authentication
  4. Actions
    4a. Create an order
    4b. Retrieve orders
    4c. Change order status
  5. Retrieve labels
  6. Troubleshooting

1. Getting started

If you use your own order management systems, or you use an eCommerce integration that does not currently have a direct integration to Click & Drop, you can use the Click & Drop API to create orders and retrieve the necessary labels and other documentation within your Click & Drop account.

What the Click & Drop API can do: 

  • Create one or more orders in Click & Drop
  • Retrieve order information from Click & Drop
  • Retrieve labels and other documents for OBA accounts after orders have been created
  • Reset orders in Click & Drop
  • Mark orders as 'Despatched'

What the Click & Drop API cannot do:

  • Retrieve labels and other documents for OLP accounts

2. Creating an integration

To begin, log in to your Click & Drop account, and navigate to 'Settings' > 'Integrations'.

IntegrationsBlank.png

From the list that appears, select 'Click & Drop API'.

IntegrationBlank.png

You will be presented with several integration settings:

Default trading name: Select your default trading name from the drop down list. If you only have one trading name, it will be automatically entered. This trading name will determine the return address that is displayed on your labels.

Integration name: Choose the name your integration will be displayed under within Click & Drop.

Use shipping address for billing address: Click & Drop allows you to map both shipping and billing address data. If you select this option, you will only need to map the fields for shipping address data. This option is selected by default.

Create batches for the imported orders: Click this option if you wish for your imported orders to be automatically placed in batches. This occurs per API call, so if your API call contains 5 orders, all five will be placed in a single batch.

Click the 'Update' button when you are ready.

Add_API_Integration.png

A row for your integration will be visible in your 'Integrations' page grid. Click the row to expand the grid. From here you can edit your integration settings, and view your authentication key. 

APiRow.png

Please note that only one Click & Drop API integration can be created per account. Should you wish to import orders with a different trading name or company identity, you will need to specify this information in the call itself, see section 4 below.

3. Authentication

Developers, click here for developer docs: https://api.parcel.royalmail.com/

The Click & Drop API uses API keys to authenticate requests.

From the integration settings page within Click & Drop, click your Click & Drop API integration to expand the row. Your authorisation (auth) key will be displayed here. 

API_Integration_Settings.png

It is important that you keep your API key secret and do not share it publicly.

You will need to pass this auth key in the header of every API call made to Click & Drop. Any API requests made without authorisation will fail.

Example cURL header:
curl --location --request POST 'https://api.parcel.royalmail.com/api/v1/Orders' \

--header 'Authorization: aaaaaa-bbbb-cccc-dddd-eeeeeeee' \

--header 'Content-Type: application/json' \

4. Actions

Developers, click here for developer docs: https://api.parcel.royalmail.com/

4a. Create an order

You can use the API to create orders in your Click & Drop account. When creating an order, items must match the specific format and examples detailed in the developer docs.

Please note, orders created can be either in 'New', or 'Postage applied' statuses. 

In order to generate a label for an order, you must pass a minimum of Order Weight, Service Code, and Packaging Format values, otherwise, the order will be created in 'New' status and will require you to apply postage to the order on the website. 

Many international orders have additional customs data requirements that must be passed.

Multiple items can be sent by nesting multiple sets of item details. 

 

4b. Retrieve orders

By altering the URL, you can retrieve specific information about one or more orders. 

The data returned is detailed in our developer docs.

To retrieve information, edit the URL and add one or more Click & Drop order numbers or order references separated by semicolons. 

Example:

https://api.parcel.royalmail.com/api/v1/Orders/30234;"Reference%3BWith%3BSpecial%3BSymbols!";30235

4c. Change order status

By altering the URL, you can change the status of an order already in Click & Drop to 'New' or 'Despatched' status.

When setting an order to 'New' status, please be aware labels generated on orders which are reset are no longer valid and must be destroyed.

Orders already in 'Manifested' status cannot have their statuses changed. 

5. Retrieve Labels (OBA accounts only)

By altering the URL, you can retrieve a label and associated documents in a single .PDF file for a created order.

Please note, the order must be in 'Postage Applied', 'Label generated', 'Despatched', or 'Manifested' status before you can retrieve a label. To ensure an order is in the right status, you must pass a minimum of Weight, Package Format, and Service when creating your orders.

https://api.parcel.royalmail.com/api/v1/Orders/"ref";1001;"Reference%3BWith%3BSpecial%3BSymbols!";2345/label

6. Troubleshooting

What is the baseURL?

The baseURL for creating orders is https://api.parcel.royalmail.com/api/v1

Please note that this will change as future versions of the API are released.

Explanation of error codes:

400 - Bad Request (Request has missing or invalid parameters and cannot be parsed)

This error usually means some invalid data has been passed. Check the response received for further information about individual fields. 

401 - unauthorized

This error usually means the has been an issue with your auth key. Either the auth code does not match, or was not passed in the header.

403 - Forbidden

This error usually means you are attempting to access an endpoint that is forbidden for your account type.

500 - Internal server error

This error usually means a connection could not be established. Check the health of your connection, and check our status page where any known issues with Click & Drop will be posted. 

Minimum system requirements:

If you are using browsers or software on Windows machines, please ensure that the system, device, or browser you are using supports Transport Layer Security (TLS) version 1.2 or higher.