Skip to content
cuppa.

Tutorial

Provision an eSIM with a REST API.

This walkthrough is for a backend service. The samples match the illustrative fulfilment used across the docs. Confirm the schema before you depend on a field.

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.

Keep the key on the server

Read the API base URL and the key from the environment. The service that takes a booking should be the only thing that can create an eSIM for that booking.

Send one fulfilment

Use a stable reference. If the booking is booking_4821, send that every time you need this eSIM, including retries.

Illustrative request
POST /v1/fulfilments
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "product_id": "example_plan",
  "reference": "booking_4821"
}

Store the response

Persist the fulfilment id, status and installation details beside the booking. Return those details to your own client. Do not ask the browser to call Cuppa.

Illustrative response
HTTP/1.1 201 Created

{
  "id": "ful_example",
  "status": "provisioned",
  "product_id": "example_plan",
  "reference": "booking_4821",
  "esim": {
    "iccid": "8900000000000000000",
    "activation_code": "LPA:1$example$CODE"
  }
}