Authentication
The Rich Returns API uses API keys to authenticate requests. You can view and manage your API keys in the Rich Returns Dashboard. Make sure that your current plan allows for API access.
For this navigate to Account / API keys in your Rich Returns dashboard. After creation write the key down in a secure place. You will not be able to access it later in full.
Your API keys carry many privileges, so make sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.
  • Provide a key "Authorization" in the header of your request
    • Set its value to "RichReturnsToken xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
    • xxxxx-xxxxx-xxxxx-xxxxx-xxxxx represents your token
    • pay attention to the whitespace between RichReturnsToken and your token
  • Set the "Content-Type" in the header to application/json
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
Below is a screenshot of how a request with authentication looks in the popular Postman App:
cURL
Node.js
1
curl https://api.richcommerce.co/v1/endpoint \
2
-H "Authorization: RichReturnsToken <API_TOKEN>" \
3
-H "Content-Type: application/json" \
4
-d '{...}'
Copied!
1
// using popular library axios (https://github.com/axios/axios)
2
3
4
// token is stored in an ENV file in this case, your implementation might be different
5
const token = process.env.RICH_RETURNS_API_TOKEN;
6
7
try {
8
9
// axios sets the content-type to json automatically in the header
10
const returns = await axios.get("https://api.richcommerce.co/2020-05-25/returns",
11
{
12
headers: {
13
"Authorization": "RichReturnsToken " + token,
14
}
15
});
16
17
// logic to use returns-data in your system
18
19
} catch(err) {
20
// error handling
21
}
Copied!
Last modified 8mo ago
Copy link