> For the complete documentation index, see [llms.txt](https://docs.distance.tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.distance.tools/tools/api/faq/migration-guide.md).

# Migration guide

## Migration Guide: Moving from RapidAPI to new Platform

### Overview

This guide outlines the necessary steps to migrate from **RapidAPI** to our new **API platform**. The migration primarily involves changes to the request URL and authentication headers. The response payload format remains unchanged, ensuring a seamless transition with no required modifications to response handling.

{% hint style="success" %}
Migrating from **RapidAPI** to the new platform requires some changes on how you request endpoints. However, the **response payload remains unchanged**, so no modifications to response handling are necessary.
{% endhint %}

## Changes

### What Has Changed?

#### API Base URL Update

#### **Old Base URL:**

```
https://distance.p.rapidapi.com/
```

**New Base URL:**

```
https://api.distance.tools/api/v2/
```

#### Authentication Header Change

**Old Header:**

```
X-RapidAPI-Key: <your old RapidAPI API key>
```

**New Header:**

```
X-Billing-Token: <your new API key>
```

#### Host Header Removal

RapidAPI required the `X-RapidAPI-Host` header, but our new platform does not require this header. Simply remove it from your requests.

### Migration Steps

#### Updating Your Requests

**Old Request Format**

```sh
curl -L \
  --request POST \
  --url 'https://distanceto.p.rapidapi.com/distance/route' \
  --header 'X-RapidAPI-Host: distanceto.p.rapidapi.com' \
  --header 'X-RapidAPI-Key: <your old RapidAPI API key>' \
  --header 'Content-Type: application/json' \
  --data '{"route": [{"name": "Berlin","country": "DEU"}, {"name": "Hamburg","country": "DEU"}]}'
```

**New Request Format**

```sh
curl -L \
  --request POST \
  --url 'https://api.distance.tools/api/v2/distance/route' \
  --header 'X-Billing-Token: <your new API key>' \
  --header 'Content-Type: application/json' \
  --data '{"route": [{"name": "Berlin","country": "DEU"}, {"name": "Hamburg","country": "DEU"}]}'
```

### Additional Considerations

* **Rate Limits:** Ensure that your new API key has the appropriate rate limits for your usage.
* **Testing:** Before fully switching, test your integration using the new API key to confirm that requests function as expected.
* **Deprecation Timeline:** If RapidAPI access is being phased out, check the deprecation schedule and transition before the cutoff date to avoid service disruptions.

### Need Help?

If you have any issues during migration, refer to our [API documentation](/tools/api.md) or [get in touch](/get-in-contact.md).
