API - what is the minimal data to post to generate a label?
I can successfully generate an order using the Click&Drop API. But for the label generation, I think that I need to also specify the shipping method.
However, each time I post a new order with the field postage_details and add a carrierName, then I get a 400 Bad Request.
The downloaded specification does include:
PostageDetailsRequest:
type: object
properties:
serviceCode:
type: string
maxLength: 10
carrierName:
type: string
maxLength: 50
However when I look at the https://api.parcel.royalmail.com/#tag/Orders/operation/CreateOrdersAsync endpoint,
I see no carrierName in the example. That seemed to be a problem when posting.
Could you clarify which information is needed to successfully generate a label?
I think that is:
- Feedback that the API spec does not match the example
- A question on what is required as guidance.
Thank you.
-
amherst
commented
(please excuse formattting, this forum broke the indents - how did you preserve yours in a code block?!)
here is a successful json payload sent to [POST]https://api.parcel.royalmail.com/api/v1/orders, and the response from server.
this request returns an order with label included in response, base64 encoded - note ''label': {'includeLabelInResponse': True},' in the request objectREQUEST:
{'items': [{'billing': {'address': {'addressLine1': 'MY FIRSTLINE',
'addressLine2': '',
'addressLine3': '',
'city': 'MY CITY',
'companyName': 'MY COMPANY NAME',
'countryCode': 'GB',
'county': 'COUNTY',
'fullName': 'MY SENDER NAME',
'postcode': 'me88sp'},
'emailAddress': 'billme@sikdjfsdjbfgjksbdgf.com',
'phoneNumber': '07888888888'},
'label': {'includeLabelInResponse': True},
'orderDate': '2026-03-06T13:33:02.692580',
'packages': [{'packageFormatIdentifier': 'parcel',
'weightInGrams': 10000},
{'packageFormatIdentifier': 'parcel',
'weightInGrams': 10000}],
'postageDetails': {'receiveEmailNotification': True,
'receiveSmsNotification': True,
'sendNotificationsTo': 'recipient',
'serviceCode': 'NDA'},
'recipient': {'address': {'addressLine1': 'addr line1',
'addressLine2': '',
'addressLine3': '',
'city': 'city',
'companyName': 'Recip Comp name',
'countryCode': 'GB',
'county': 'county',
'fullName': 'Testy Testson Recipient',
'postcode': 'da163hu'},
'emailAddress': 'recipient@sdgikhjbsdgijbsdigj.com',
'phoneNumber': '07666666666'},
'shippingCostCharged': 0,
'subtotal': 0,
'total': 0}]}RESPONSE:
```json
{
"successCount": 1,
"errorsCount": 0,
"createdOrders": [
{
"orderIdentifier": 1060,
"createdOn": "2026-03-06T13:36:19.283472Z",
"orderDate": "2026-03-06T13:33:02.692580",
"printedOn": "2026-03-06T13:36:19.734235",
"trackingNumber": "PK007810759GB_CON",
"label": "{aVeryLongBase64String}",
"labelErrors": [],
"generatedDocuments": [
"Label"
]
}
],
"failedOrders": []
}
``` -
Ics19
commented
I have never used 'carrierName' but then again only have one royal mail account so no need to target a specific one - I suspect you can leave this out too. The minimum you need is:
'sendNotificationsTo' => 'recipient'
'serviceCode' => 'MP7' [replace code as required]
'receiveEmailNotification' => 1 [needed for tracked services or set to 0]
You may also need these depending on service:
'IOSSNumber'
'recipientEoriNumber'Hope that helps.