# Affiliate API - Get Affiliate Links

> Once onboarded, you will be assigned an dedicated API endpoint to fetch your affiliate links.

Canonical: https://docs.getroamify.com/affiliate/affiliate-links/

## Get Affiliate Links
Once onboarded, you will be assigned an dedicated API endpoint to fetch your affiliate links.

You need to send a `GET` request to the `/api/esim/{unique name}/packages` endpoint.

This endpoint will return a list of all available eSIM packages with referral links for each package.

The referral link will include your unique identifier, which will be used to track the sales you make.

#### Usage - how to get eSIM packages
Here is an example of how you can get a list of eSIM packages using Roamify eSIM API.

**curl**

```bash
curl --request GET \
--url 'https://api-dev.getroamify.com/api/esim/esimradar/packages' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'
```

**javascript**

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

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

## Sample Response

> **Warning:** The response included will be in a
>     - `packages`: the response data will contain an array of packages for each country.
>     - `countryName`: the name of the country.
>     - `packages`: for each country object, there will be an array of packages available for the destination.
>     - `link`: the referral link for each package, which includes your unique identifier.

```json
{
	"status": "success",
	"data": {
		"packages": [
			{
				"id": "c21a8a20-5646-4b26-8df3-f5d37147790f",
				"countryName": "Afghanistan",
				"countryCode": "AF",
				"region": "local",
				"packages": [
					{
						"id": "515e279d-0c78-4d65-a45b-e7c12ca2ebea",
						"name": "1 GB - 7 Days",
						"price": 5.5,
						"validity": 7,
						"plan": "data-only",
						"dataAmount": 1024,
						"dataUnit": "MB",
						"data": "1 GB",
						"isUnlimited": false,
						"isActivated": true,
						"withKyc": false,
						"withTopUp": true,
						"withSMS": false,
						"withCall": false,
						"withHotspot": true,
						"smsUnit": "",
						"callUnit": "",
						"smsLabel": "",
						"callLabel": "",
						"smsAmount": -1,
						"callAmount": -1,
						"coverages": [
							"Afghanistan"
						],
						"networks": [
							"3G",
							"4G"
						],
						"signals": [
							{
								"code": "AF",
								"name": "Afghanistan",
								"networks": [
									"3G",
									"4G"
								],
								"carriers": [
									"Roshan"
								]
							}
						],
						"link": "https://www.getroamify.com/esim/afghanistan/?referrer=5Spg1dU0XRhHeUJGx6JFak4zccH2"
					},
					{
						"id": "92014f96-e231-4ea8-afbc-f5434dd78eee",
						"name": "3 GB - 15 Days",
						"price": 14.5,
						"validity": 15,
						"plan": "data-only",
						"dataAmount": 3072,
						"dataUnit": "MB",
						"data": "3 GB",
						"isUnlimited": false,
						"isActivated": true,
						"withKyc": false,
						"withTopUp": true,
						"withSMS": false,
						"withCall": false,
						"withHotspot": true,
						"smsUnit": "",
						"callUnit": "",
						"smsLabel": "",
						"callLabel": "",
						"smsAmount": -1,
						"callAmount": -1,
						"coverages": [
							"Afghanistan"
						],
						"networks": [
							"3G",
							"4G"
						],
						"signals": [
							{
								"code": "AF",
								"name": "Afghanistan",
								"networks": [
									"3G",
									"4G"
								],
								"carriers": [
									"Roshan"
								]
							}
						],
						"link": "https://www.getroamify.com/esim/afghanistan/?referrer=5Spg1dU0XRhHeUJGx6JFak4zccH2"
					},
					{
						"id": "b20dbf4f-415a-4545-9109-3ba9739f873b",
						"name": "3 GB - 30 Days",
						"price": 15.5,
						"validity": 30,
						"plan": "data-only",
						"dataAmount": 3072,
						"dataUnit": "MB",
						"data": "3 GB",
						"isUnlimited": false,
						"isActivated": true,
						"withKyc": false,
						"withTopUp": true,
						"withSMS": false,
						"withCall": false,
						"withHotspot": true,
						"smsUnit": "",
						"callUnit": "",
						"smsLabel": "",
						"callLabel": "",
						"smsAmount": -1,
						"callAmount": -1,
						"coverages": [
							"Afghanistan"
						],
						"networks": [
							"3G",
							"4G"
						],
						"signals": [
							{
								"code": "AF",
								"name": "Afghanistan",
								"networks": [
									"3G",
									"4G"
								],
								"carriers": [
									"Roshan"
								]
							}
						],
						"link": "https://www.getroamify.com/esim/afghanistan/?referrer=5Spg1dU0XRhHeUJGx6JFak4zccH2"
					}
                ]
            }
        ]
    }
}
```

### The End
That's it! You have successfully integrated Roamify Affiliate API into your application. If you have any questions or need help, feel free to contact us at [support@getroamify.com](mailto:support@getroamify.com).
