GET
# Accor URL to Hotel ID API

Convert an Accor hotel URL into the id used by every property endpoint.

## Overview

Pass an `accor.com` or `*.accor.com` hotel URL. StayAPI validates the host, extracts the property id locally, and returns a normalized URL without calling Accor upstream.

### Endpoint URL

GET https://api.stayapi.com/v1/accor/hotel/url-to-id

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| url | string | Required | An HTTP(S) Accor hotel URL, for example `https://all.accor.com/hotel/2179/index.en.shtml`. |

#### URL-encode the value

Pass the hotel URL through your HTTP client's params/query option. It will safely encode slashes and any tracking parameters for the outer request.

## Response

- **success** : Always true on a 2xx response
- **url** : Normalized Accor URL
- **hotel\_id** : Numeric or alphanumeric property id to use with Details, Amenities, Reviews, Rooms, Photos, and Price Calendar

## Errors

### 400 INVALID\_URL

The value is malformed, does not use HTTP(S), or is not on accor.com or an Accor subdomain.

### 400 HOTEL\_ID\_NOT\_FOUND

The URL is on an allowed Accor host but does not contain a recognizable hotel id.

## Next steps

### Hotel Details

Fetch the complete property content record.

[View Documentation →](/docs/endpoints/accor/details)

### Hotel Reviews

Fetch guest feedback and hotel responses.

[View Documentation →](/docs/endpoints/accor/reviews)

Request

```curl
curl -G "https://api.stayapi.com/v1/accor/hotel/url-to-id" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "url=https://all.accor.com/hotel/2179/index.en.shtml"
```

Response

```json
{
  "success": true,
  "url": "https://all.accor.com/hotel/2179/index.en.shtml",
  "hotel_id": "2179"
}
```

```json
{
  "type": "https://api.stayapi.com/errors/invalid-url",
  "title": "Invalid URL",
  "status": 400,
  "provider": "accor",
  "product": "url-to-id",
  "error_code": "INVALID_URL"
}
```
