GET
# OpenTable Nearby Availability Slots API

Return the bookable reservation times OpenTable offers around a preferred time for one restaurant, date, and party size.

## Overview

Use this endpoint when an exact time is unavailable or when you want to present nearby choices. The supplied `preferred_time` anchors OpenTable's availability window; the response does not represent every slot for the full calendar day. StayAPI removes OpenTable's internal slot metadata and returns only normalized `HH:MM` values.

### Endpoint URL

GET https://api.stayapi.com/v1/opentable/restaurants/{restaurant\_id}/availability/slots 

## Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| restaurant\_id | path | integer | Required | Positive OpenTable restaurant ID returned by restaurant search or URL-to-ID resolution. |
| date | query | string | Required | Reservation date in `YYYY-MM-DD` format. It cannot be in the past. |
| preferred\_time | query | string | Required | Preferred reservation time in 24-hour `HH:MM` format. OpenTable returns nearby options around it. |
| party\_size | query | integer | Required | Number of diners, from 1 to 30. |

#### Why preferred\_time is required

OpenTable returns a nearby reservation window rather than full-day inventory. `preferred_time` tells it where to center that window.

## Response Format

### Success (200 OK)

```
{
  "success": true,
  "slots": ["18:30", "18:45", "19:00", "19:15", "19:30"]
}
```

### Response Data

| Field | Type | Description |
| --- | --- | --- |
| success | boolean | Always `true` on a 2xx response. |
| slots | array\<string\> | Distinct nearby bookable times, sorted chronologically and formatted as 24-hour `HH:MM`. |

#### Empty slots are not an error

An empty `slots` array is a successful 200 response meaning OpenTable returned no nearby availability for that restaurant, date, preferred time, and party size.

## Error Responses

Endpoint errors use RFC 7807 Problem Details with `provider: "opentable"` and `product: "availability"`.

### 400 Bad Request

Invalid date or preferred-time format, or a date in the past. Error codes include `INVALID_DATE_FORMAT`, `INVALID_TIME_FORMAT`, and `PAST_DATE`.

### 422 Unprocessable Entity

A required parameter is missing, `restaurant_id` is not positive, or `party_size` is outside 1-30.

### 502 Bad Gateway

OpenTable did not return usable availability. The error code is `UPSTREAM_ERROR`.

```
{
  "type": "https://api.stayapi.com/errors/invalid-time-format",
  "title": "Invalid Time Format",
  "status": 400,
  "detail": "preferred_time must be in HH:MM 24-hour format",
  "instance": "/v1/opentable/restaurants/404046/availability/slots",
  "provider": "opentable",
  "product": "availability",
  "error_code": "INVALID_TIME_FORMAT",
  "correlation_id": "req_abc123"
}
```

## Usage Tips

- Use the diner's intended time as `preferred_time`, then present the returned alternatives in order.
- Do not treat this response as full-day inventory; call again with a different preferred time to inspect another part of the day.
- Use the Exact Availability endpoint when your UI only needs a yes or no answer for one time.

#### Rate Limiting

Each nearby-slot lookup counts as one API call and is subject to your plan's rate limits.

## Related Endpoints

### Exact Availability

Return a simple yes or no for one exact reservation time.

[View Documentation →](/docs/endpoints/opentable/availability)

### Restaurant Search

Find restaurants and collect the restaurant IDs used by this endpoint.

[View Documentation →](/docs/endpoints/opentable/search)

Request

```curl
curl -X GET "https://api.stayapi.com/v1/opentable/restaurants/404046/availability/slots?date=2026-07-15&preferred_time=19:00&party_size=2" \
  -H "X-API-Key: YOUR_API_KEY"
```

Response

```json
{
  "success": true,
  "slots": ["18:30", "18:45", "19:00", "19:15", "19:30"]
}
```

```
{
  "success": true,
  "slots": []
}
```

```json
{
  "type": "https://api.stayapi.com/errors/invalid-time-format",
  "title": "Invalid Time Format",
  "status": 400,
  "detail": "preferred_time must be in HH:MM 24-hour format",
  "instance": "/v1/opentable/restaurants/404046/availability/slots",
  "provider": "opentable",
  "product": "availability",
  "error_code": "INVALID_TIME_FORMAT",
  "correlation_id": "req_abc123"
}
```
