# eSIMs Link API - New way to distribute/share eSIM with your customers

> After you have created an eSIM profile, you can generate a link to share with your customers. This link will allow them to install the eSIM profile on their devices.

Canonical: https://docs.getroamify.com/esims/esims-link/

## Generate eSIMs Link
After you have created an eSIM profile, you can generate a link to share with your customers. This link will allow them to install the eSIM profile on their devices.

To generate an eSIM link, you will need to send a `POST` request to the `/api/esim/link` endpoint.

The request body should contain the either the following parameters:
- `iccid`: The ICCID of the eSIM. This is a required field of type `string`.
- `esimId`: The ID of the eSIM. This is a required field of type `string`, no need to provide if you included the `iccid`.

### Usage - Generate eSIM Link
Here is an example of how you can generate an eSIM link using `curl` or `javascript`.

- Sample eSIMs Link URL: [eSIMs Link URL](https://dev.esims.link/acme/4OYONUH79IW1)
- Sample Access Code: `5897`
- Sample eSIMs Link WhatsApp Message URL: [WhatsApp Message URL](https://api.whatsapp.com/send?text=Check%20out%20your%20eSIM%3A%20https%3A%2F%2Fdev.esims.link%2Facme%2F4OYONUH79IW1%20with%20access%20code%3A%205897)

**curl**

```bash
curl --request POST \
--url 'https://api-dev.getroamify.com/api/esim/link' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "iccid": "iccid here"
}'
```

**javascript**

```javascript
const axios = require('axios');

axios.post('https://api-dev.getroamify.com/api/esim/link', {
    iccid: 'iccid here'
}, {
    headers: {
        'Authorization': 'Bearer {access token here}',
        'Content-Type': 'application/json'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});
```

### Sample Response with ICCID
```json
{
	"status": "success",
	"data": {
		"iccid": "8935306745498905",
		"esimId": "f72d9b90-52b3-47d9-95f6-2cf61ab176aa",
		"link": "https://dev.esims.link/acme/4OYONUH79IW1",
		"whatsappLink": "https://api.whatsapp.com/send?text=Check%20out%20your%20eSIM%3A%20https%3A%2F%2Fdev.esims.link%2Facme%2F4OYONUH79IW1%20with%20access%20code%3A%205897",
		"key": "4OYONUH79IW1",
		"accessCode": "5897",
		"createdAt": 1767812581,
		"updatedAt": 1767812581
	}
}
```
