# 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.distance.tools/tools/api/faq/migration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
