> For the complete documentation index, see [llms.txt](https://en-api.decisiontele.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en-api.decisiontele.com/esim-api/esims/get-esim-id.md).

# Get eSIM ID

Use the internal `esimId` when an endpoint requires an eSIM identifier. An ICCID and an `esimId` identify the same eSIM in different ways; they are not interchangeable request values.

### Obtain esimId

| Source                                       | Value to store                                                      |
| -------------------------------------------- | ------------------------------------------------------------------- |
| `GET /api/v1/esims`                          | `data[].id`, together with the same item’s `data[].iccid`.          |
| `POST /api/v1/esims/assign-package` response | The assigned eSIM ID and ICCID returned by the assignment response. |

Store the mapping `ICCID -> esimId` when an eSIM is selected or assigned.

```json
{
  "iccid": "<ICCID>",
  "esimId": "f452f335-4845-4a44-bf4d-261943bf4081"
}
```

This is a suggested local storage record, not an API response schema.

### Obtain packageEsimId

Retrieve the eSIM with its assigned packages:

```http
GET /api/v1/esims?scopeBy=package&allocated=true&page=1&perPage=100
Authorization: Bearer <TOKEN>
Accept: application/json
```

Use `packageEsims[].id` as `packageEsimId`. This identifies one package assignment, not the catalog package or the eSIM itself. Store every relevant assignment ID alongside its `esimId` and ICCID.

Pass `packageEsimId` to `POST /api/v1/packages/usage`. If multiple assignments are returned, choose the relevant assignment using `status`, `queuePosition`, and usage fields.
