eSIM API authentication
eSIM API authentication.
Requests use a bearer token. Create the key in the dashboard, store it as a secret, and send it on each call from your server.
Code and responses on this page are illustrative. They show the shape of an integration. Confirm the production schema in your Cuppa account before you ship.
The header
The illustrative requests on this site send Authorization: Bearer and the key. Use your real key only in server-side code. Rotating a key means issuing a new one in the dashboard and updating the secret your application reads.
const res = await fetch(`${CUPPA_API_URL}/v1/fulfilments`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CUPPA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
product_id: "example_plan",
reference: "booking_4821",
}),
});
const fulfilment = await res.json();Where the key must not go
Do not put it in a mobile app binary, a public repository, or the browser. If a partner builds a storefront, their server holds the key and their page talks to that server.