Headers & Authentication

If you are creating a basket on your backend server, you will need to provide us the IP address of the customer through the Create a Basket endpoint. If you are creating a basket from the user's browser, we will automatically determine the IP from the requesting device.

Authorization

If you’re being asked for authentication; you'll need to use HTTP BASIC with the following details:

Username (Public Token)

Your Public Token (you can get this from https://creator.tebex.io/developers/api-keys)

Password (Private Key)

Your Private Key (you can get this from https://creator.tebex.io/developers/api-keys)

Content Type

All requests use application/json as the Content-Type. Ensure this is set with all requests to our Headless API.

Example of an authenticated create basket request

const url = "https://headless.tebex.io/api/accounts/{token}/baskets";

const headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
headers.append('Content-Type', 'application/json');

const body = {
 "complete_url": "https://example.tebex.io/thank-you",
 "cancel_url": "https://tebex.io/",
 "custom": {
  "foo": "bar"
 },
 "complete_auto_redirect": true,
 "username": "TebexDev"
};

const options = {
 method: 'POST',
 headers: headers,
 body: JSON.stringify(body)
};

const response = await fetch(url, options);

Last updated

Was this helpful?