> ## Documentation Index
> Fetch the complete documentation index at: https://docs-restapi.wplimit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Bookings

> Retrieves a paginated list of all bookings with filtering and search options.

## Description

This endpoint allows you to retrieve a list of all bookings in your LatePoint system. It includes advanced filtering, search, and pagination options to efficiently handle large volumes of data.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your LatePoint API key. You can get it from the admin panel.
</ParamField>

## Query Parameters

### Pagination

<ParamField query="page" type="integer" default="1">
  Page number for pagination
</ParamField>

<ParamField query="per_page" type="integer" default="20">
  Number of bookings per page (max 100)
</ParamField>

### Basic Filters

<ParamField query="status" type="string">
  Filter by booking status (pending, confirmed, cancelled, completed)
</ParamField>

<ParamField query="customer_id" type="integer">
  Filter by customer ID
</ParamField>

<ParamField query="agent_id" type="integer">
  Filter by agent ID
</ParamField>

<ParamField query="service_id" type="integer">
  Filter by service ID
</ParamField>

<ParamField query="location_id" type="integer">
  Filter by location ID
</ParamField>

### Date Filters

<ParamField query="date_from" type="string">
  Filter bookings from this date (YYYY-MM-DD format)
</ParamField>

<ParamField query="date_to" type="string">
  Filter bookings until this date (YYYY-MM-DD format)
</ParamField>

<ParamField query="created_date_from" type="string">
  Filter by creation date from (YYYY-MM-DD format)
</ParamField>

<ParamField query="created_date_to" type="string">
  Filter by creation date until (YYYY-MM-DD format)
</ParamField>

### Dynamic Filters

<ParamField query="booking_code" type="string">
  Filter by booking code (partial match supported)
</ParamField>

<ParamField query="payment_status" type="string">
  Filter by payment status
</ParamField>

<ParamField query="duration_min" type="integer">
  Filter bookings with minimum duration (in minutes)
</ParamField>

<ParamField query="duration_max" type="integer">
  Filter bookings with maximum duration (in minutes)
</ParamField>

<ParamField query="price_min" type="number">
  Filter bookings with minimum price
</ParamField>

<ParamField query="price_max" type="number">
  Filter bookings with maximum price
</ParamField>

<ParamField query="customer_email" type="string">
  Filter by customer email (partial match supported)
</ParamField>

<ParamField query="customer_phone" type="string">
  Filter by customer phone (partial match supported)
</ParamField>

### Metadata Filters

<ParamField query="include_meta" type="boolean" default="false">
  Include booking metadata in response
</ParamField>

<ParamField query="meta_key" type="string">
  Filter by specific metadata key (requires meta\_value)
</ParamField>

<ParamField query="meta_value" type="string">
  Filter by metadata value (requires meta\_key, partial match supported)
</ParamField>

### Search and Sorting

<ParamField query="search" type="string">
  Search in customer name, email, or booking code
</ParamField>

<ParamField query="sort" type="string" default="start_date">
  Sort field (start\_date, created\_at, customer\_name, status, id)
</ParamField>

<ParamField query="order" type="string" default="desc">
  Sort order (asc, desc)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Always `true` on success
</ResponseField>

<ResponseField name="data" type="array">
  Array of booking objects

  <Expandable title="Booking Structure">
    <ResponseField name="id" type="integer">
      Unique booking ID
    </ResponseField>

    <ResponseField name="booking_code" type="string">
      Unique booking code
    </ResponseField>

    <ResponseField name="status" type="string">
      Current booking status
    </ResponseField>

    <ResponseField name="start_date" type="string">
      Start date (YYYY-MM-DD)
    </ResponseField>

    <ResponseField name="start_time" type="string">
      Start time (HH:MM)
    </ResponseField>

    <ResponseField name="end_time" type="string">
      End time (HH:MM)
    </ResponseField>

    <ResponseField name="duration" type="integer">
      Duration in minutes
    </ResponseField>

    <ResponseField name="price" type="string">
      Total booking price
    </ResponseField>

    <ResponseField name="customer" type="object">
      Customer information

      <Expandable title="Customer Data">
        <ResponseField name="id" type="integer">
          Customer ID
        </ResponseField>

        <ResponseField name="first_name" type="string">
          Customer first name
        </ResponseField>

        <ResponseField name="last_name" type="string">
          Customer last name
        </ResponseField>

        <ResponseField name="email" type="string">
          Customer email
        </ResponseField>

        <ResponseField name="phone" type="string">
          Customer phone
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="payment_status" type="string">
      Payment status of the booking
    </ResponseField>

    <ResponseField name="agent" type="object">
      Agent information

      <Expandable title="Agent Data">
        <ResponseField name="id" type="string">
          Agent ID
        </ResponseField>

        <ResponseField name="full_name" type="string">
          Agent full name
        </ResponseField>

        <ResponseField name="email" type="string">
          Agent email
        </ResponseField>

        <ResponseField name="phone" type="string">
          Agent phone
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="service" type="array">
      Service information (empty array if no service assigned)
    </ResponseField>

    <ResponseField name="location" type="object">
      Location information

      <Expandable title="Location Data">
        <ResponseField name="id" type="string">
          Location ID
        </ResponseField>

        <ResponseField name="name" type="string">
          Location name
        </ResponseField>

        <ResponseField name="full_address" type="string">
          Location full address
        </ResponseField>

        <ResponseField name="category" type="array">
          Location category data
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total_attendees" type="integer">
      Total number of attendees for the booking
    </ResponseField>

    <ResponseField name="notes" type="string">
      Additional booking notes
    </ResponseField>

    <ResponseField name="created_at" type="string">
      Creation date and time (ISO 8601)
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      Last update date and time (ISO 8601)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination information

  <Expandable title="Pagination">
    <ResponseField name="page" type="integer">
      Current page
    </ResponseField>

    <ResponseField name="per_page" type="integer">
      Items per page
    </ResponseField>

    <ResponseField name="total" type="integer">
      Total number of bookings
    </ResponseField>

    <ResponseField name="total_pages" type="integer">
      Total number of pages
    </ResponseField>

    <ResponseField name="has_next_page" type="boolean">
      Whether a next page exists
    </ResponseField>

    <ResponseField name="has_previous_page" type="boolean">
      Whether a previous page exists
    </ResponseField>
  </Expandable>
</ResponseField>

## Examples

### Basic Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://your-site.com/wp-json/latepoint-api/v1/bookings" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://your-site.com/wp-json/latepoint-api/v1/bookings', {
    headers: { 'X-API-Key': 'YOUR_API_KEY' }
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://your-site.com/wp-json/latepoint-api/v1/bookings',
      headers={'X-API-Key': 'YOUR_API_KEY'}
  )
  print(response.json())
  ```
</CodeGroup>

### Filter by Status and Date

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://your-site.com/wp-json/latepoint-api/v1/bookings?status=approved&date_from=2024-01-01&date_to=2024-01-31" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    status: 'approved',
    date_from: '2024-01-01',
    date_to: '2024-01-31'
  });
  const response = await fetch(`https://your-site.com/wp-json/latepoint-api/v1/bookings?${params}`, {
    headers: { 'X-API-Key': 'YOUR_API_KEY' }
  });
  const data = await response.json();
  ```
</CodeGroup>

### Search by Customer Name or Code

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://your-site.com/wp-json/latepoint-api/v1/bookings?search=john&sort=start_date&order=asc" \
    -H "X-API-Key: YOUR_API_KEY"
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": 55,
      "booking_code": "M3DELUX",
      "status": "approved",
      "start_date": "2026-04-29",
      "start_time": "13:00",
      "end_time": "14:00",
      "duration": 60,
      "price": "23.00",
      "payment_status": "",
      "customer": {
        "id": 2,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john@example.com",
        "phone": "+11111111111"
      },
      "agent": {
        "id": "1",
        "full_name": "Pao Campo",
        "email": "pao@example.com",
        "phone": ""
      },
      "service": [],
      "location": {
        "id": "1",
        "name": "Main Location",
        "full_address": "",
        "category": []
      },
      "notes": "",
      "created_at": "2026-04-26 06:14:48",
      "updated_at": "2026-04-26 06:14:48",
      "total_attendees": 1
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 20,
    "total": 21,
    "total_pages": 2,
    "has_next_page": true,
    "has_previous_page": false
  }
}
```

## Error Responses

```json Error 401 - Unauthorized theme={null}
{
  "code": "rest_forbidden",
  "message": "Unauthorized",
  "data": { "status": 401 }
}
```

```json Error 503 - LatePoint not available theme={null}
{
  "code": "latepoint_not_available",
  "message": "LatePoint is not available or has not loaded correctly",
  "data": { "status": 503 }
}
```

## Important Notes

<Note>
  **Performance**: For better performance, use specific filters instead of fetching all bookings and filtering on the client side.
</Note>

<Warning>
  **Rate Limiting**: This endpoint is subject to rate limiting. Check response headers to monitor your usage.
</Warning>

<Tip>
  **Pagination**: To get all bookings, use the `has_next_page` field in the response to determine if more pages are available.
</Tip>

## Common Use Cases

### 1. Today's Bookings Dashboard

```javascript theme={null}
// Get today's bookings sorted by start time
const today = new Date().toISOString().split('T')[0];
const response = await fetch(`/wp-json/latepoint-api/v1/bookings?date_from=${today}&date_to=${today}&sort=start_date&order=asc`, {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
if (data.success) console.log(data.data);
```

### 2. Customer History

```javascript theme={null}
// Get all bookings for a specific customer
const response = await fetch(`/wp-json/latepoint-api/v1/bookings?customer_id=45&sort=start_date&order=desc`, {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
if (data.success) console.log(data.data);
```

### 3. Monthly Report

```javascript theme={null}
// Get current month's bookings
const firstDay = new Date(new Date().getFullYear(), new Date().getMonth(), 1).toISOString().split('T')[0];
const lastDay = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toISOString().split('T')[0];
const response = await fetch(`/wp-json/latepoint-api/v1/bookings?date_from=${firstDay}&date_to=${lastDay}&status=approved`, {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
if (data.success) {
  console.log(`Total bookings: ${data.pagination.total}`);
  console.log(data.data);
}
```
