GET
# Airbnb Extract Listing ID API

Parse Airbnb listing URLs to extract listing IDs required for API calls.

## Overview

#### URL Parsing Utility

Extract decimal-string listing IDs and base64 encoded IDs from any Airbnb URL format.

This utility endpoint parses Airbnb URLs to extract the decimal listing ID that can be used with other API endpoints. The `listing_id` response value is a decimal string, preserving long IDs exactly; it also returns the base64 encoded ID format for complete compatibility.

### Endpoint URL

GET https://api.stayapi.com/v1/airbnb/listing/extract-id 

## Query Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| url | string | Required | Any valid Airbnb listing URL to parse |

## Response Structure

### Response Fields

- `listing_id` - Numeric listing ID (e.g., 22120898)
- `url` - Original URL provided for verification
- `encoded_id` - Base64 encoded ID for advanced operations

### ID Format Explanation

The encoded\_id is a base64 encoding of the string format:

`
              "StayListing:22120898" → Base64 → "U3RheUxpc3Rpbmc6MjIxMjA4OTg="
            `

## Supported URL Formats

### All Airbnb URL Patterns

`https://www.airbnb.com/rooms/22120898`→ ID: 22120898

`https://www.airbnb.com/rooms/22120898?guests=2&check_in=2025-01-01`→ ID: 22120898

`https://www.airbnb.co.uk/rooms/22120898`→ ID: 22120898

`https://m.airbnb.com/rooms/22120898`→ ID: 22120898

`https://www.airbnb.com/listing/22120898`→ ID: 22120898

## Common Use Cases

### Browser Extensions

Extract IDs from the current tab URL to fetch reviews or pricing data.

### Bulk Processing

Process lists of Airbnb URLs from spreadsheets or databases.

### URL Validation

Validate user input to ensure proper Airbnb listing URLs.

### API Integration

Convert between URL formats and API identifiers for custom integrations.

## Error Handling

#### Invalid URLs

The endpoint will return a 400 error if the URL is not a valid Airbnb listing URL or if no listing ID can be extracted.

### Common Error Scenarios

- Non-Airbnb URLs (returns 400)
- Airbnb URLs without listing IDs (e.g., search pages)
- Malformed or incomplete URLs
- Experience URLs instead of listing URLs

Request

```curl
curl -X GET "https://api.stayapi.com/v1/airbnb/listing/extract-id?url=https://www.airbnb.com/rooms/22120898" \
  -H "x-api-key: YOUR_API_KEY"
```

Response

```json
{
  "listing_id": "22120898",
  "url": "https://www.airbnb.com/rooms/22120898?check_in=2025-10-31",
  "encoded_id": "U3RheUxpc3Rpbmc6MjIxMjA4OTg="
}
```

```json
{
  "detail": "Could not extract listing ID from URL. Make sure it's a valid Airbnb URL."
}
```
