> For the complete documentation index, see [llms.txt](https://docs.podplay.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podplay.app/api/use-cases/use-case-create-a-1-hour-open-play-event/step-2-retrieve-available-sessions.md).

# Step 2 — Retrieve Available Sessions

### Starting Point

From Step 1 you already have:

```
podId
tableId
startTime
endTime
```

These define:

* The **pod** where the event will take place
* The **court (table)** selected by the user
* The **desired time window**

Now we must retrieve all sessions available inside that time range.

### Request Sessions

Call the `/sessions` endpoint filtered by:

* podId
* startTime
* endTime
* Expand `availableTables` so we can match the correct court

```
curl -sS -X GET \
  -H "x-api-key: <your_api_key>" \
  "https://sandbox1.podplay.app/apis/v2/sessions?podId=$POD_ID&startTime=$START&endTime=$END&expand=items._links.availableTables"
```

### Example With Real Values

From Step 1, we selected:

```
podId: b066d668-e64f-480a-ad31-110b3433c080
tableId = 61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03             
startTime: 2026-03-04T03:00:00.000Z
endTime: 2026-03-05T03:00:00.000Z
```

Applying those values:

```
curl -sS -X GET \
  -H "x-api-key: <your_api_key>" \
  "https://sandbox1.podplay.app/apis/v2/sessions?podId=b066d668-e64f-480a-ad31-110b3433c080&startTime=2026-03-04T03:00:00.000Z&endTime=2026-03-05T03:00:00.000Z&expand=items._links.availableTables"
```

### Example Response (Trimmed)

Below is an example response for **March 4th, 2026**, returning two consecutive 30-minute sessions:

```
{
  "items": [
    {
      "id": "b066d668-e64f-480a-ad31-110b3433c080@1772643600000",
      "startTime": "2026-03-04T17:00:00.000Z",
      "endTime": "2026-03-04T17:30:00.000Z",
      "availableTables": {
        "items": [
          {
            "id": "b066d668-e64f-480a-ad31-110b3433c080@61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03@1772643600000",
            "type": "FIXED_TABLE",
            "table": {
              "id": "61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03",
              "displayName": "Court 1",
              "displayNameShort": "C1"
            }
          }
        ]
      }
    },
    {
      "id": "b066d668-e64f-480a-ad31-110b3433c080@1772645400000",
      "startTime": "2026-03-04T17:30:00.000Z",
      "endTime": "2026-03-04T18:00:00.000Z",
      "availableTables": {
        "items": [
          {
            "id": "b066d668-e64f-480a-ad31-110b3433c080@61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03@1772645400000",
            "type": "FIXED_TABLE",
            "table": {
              "id": "61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03",
              "displayName": "Court 1",
              "displayNameShort": "C1"
            }
          }
        ]
      }
    }
  ]
}
```

#### Understanding the Response Structure

Each object inside `items[]` represents a **bookable session**.

Each session contains:

* `id` → **sessionId**
* `startTime`
* `endTime`
* `availableTables.items[]`

Each entry inside `availableTables.items[]` contains:

* `id` → **sessionTableId** (required for booking)
* `table.id` → the actual `tableId`
* `displayName` → human-readable court name

### Selecting the Correct SessionTable

To book a specific court:

1. Iterate through `items[]`
2. Inside each session, iterate through `availableTables.items[]`
3. Find the entry where:

```
table.id == your selected tableId
```

4. Store:

```
session.id
sessionTable.id
```

#### Selecting Sessions for a 1-Hour Event

Sessions are **30 minutes long**.

To create a **1-hour Open Play event**, you must:

* Select **two consecutive sessions**
* Ensure:
  * They are back-to-back
  * They belong to the same `tableId`
  * They fall within your desired time window

From the example above:

**First 30-minute slot**

```
Session ID:
b066d668-e64f-480a-ad31-110b3433c080@1772643600000

SessionTable ID:
b066d668-e64f-480a-ad31-110b3433c080@61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03@1772643600000

Time:
17:00 → 17:30 UTC
```

**Second 30-minute slot**

```
Session ID:
b066d668-e64f-480a-ad31-110b3433c080@1772645400000

SessionTable ID:
b066d668-e64f-480a-ad31-110b3433c080@61e3f1c2-d23b-4eb3-bebb-77c4eeda6d03@1772645400000

Time:
17:30 → 18:00 UTC
```

Together, they form a continuous 1-hour window:

`17:00 → 18:00 UTC`

### Outcome of This Section

You now have:

* Two valid `sessionId` values
* Two matching `sessionTableId` values
* A confirmed 1-hour continuous time slot
* All identifiers required to create a booking

These represent **reserved-ready time slots** for your selected court.

In the next section, we will use these session and sessionTable IDs to create the actual event booking.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.podplay.app/api/use-cases/use-case-create-a-1-hour-open-play-event/step-2-retrieve-available-sessions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
