Appearance
Authentication
The Merchrocket API offers authentication through API-Keys. These keys provide basic access to the API for your account with its products and orders.
Creating API-Keys
The first step is to create an account for your company. You can then create any number of API-Keys.
During development and testing, it is important to use the staging environment. Read more about the staging environment in our guide. Once your integration is ready for real transactions, you can switch to the production environment.
It is important that you keep your API-Keys safe and never share them. If a key is compromised, you can always generate a new one. Remember to update your code with the new key to ensure your integration continues to work properly.
Authenticating an API call
API calls are authenticated by including the API-Key in the Authorisation header of the HTTP request using the Bearer method.
In the following example, we use a test API-Key for the GET method of the order resource. This method is used to retrieve an order - in this case, the order with the fictional order ID 018ee630-51dd-7615-a721-d648407ceb4c.
console
curl -X 'GET' \
'https://app.merchrocket.shop/api/orders/018ee630-51dd-7615-a721-d648407ceb4c' \
-H 'accept: application/ld+json' \
-H 'Authorization: Bearer mrp_ad9e9d714d602e133b93ce1f5504ae2b'
The response will be ld+json
json
{
"@context": "/api/contexts/Order",
"@id": "/api/orders/018ee630-51dd-7615-a721-d648407ceb4c",
"@type": "Order",
"id": "018ee630-51dd-7615-a721-d648407ceb4c",
"externalId": "externalId",
"shipping": "STANDARD",
"status": "fulfilled",
"createdAt": "2024-04-16T09:15:10+00:00",
"updatedAt": "2024-04-16T09:15:10+00:00",
"recipient": {
"name": "Flo",
"company": "Bartoletti, Mosciski and Pagac",
"address1": "525 O'Kon Drive",
"address2": "",
"city": "city",
"stateCode": "",
"stateName": "",
"countryCode": "BN",
"countryName": "Micronesia",
"zip": "36205",
"phone": "(575) 463-0497",
"email": "kamren52@hotmail.com",
"taxNumber": "ZXQIVFG4JI9"
},
"orderItems": [
{
"@id": "/api/orders/018ee630-51dd-7615-a721-d648407ceb4c/order_item/018ee630-51dd-7615-a721-d64840c80de1",
"@type": "OrderItem",
"id": "018ee630-51dd-7615-a721-d64840c80de1",
"externalId": "KB-00004-RE",
"quantity": 12,
"name": "Mug",
"retailPrice": "10.9",
"variantId": "74a4dc41-de4a-46ff-bea8-8f6416bc3b3c",
"placements": [
{
"@type": "Placement",
"@id": "/api/.well-known/genid/eae77a2b1d5d9b1a822c",
"type": null,
"technique": null,
"layers": [],
"placementOptions": []
}
]
}
]
}