> ## 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.

# Get Booking

> Retrieves detailed information for a specific booking

## Description

This endpoint returns all available information for a specific booking, including customer details, agent, service, location, and payment status.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your LatePoint API Key with read permissions
</ParamField>

## Path Parameters

<ParamField path="id" type="integer" required>
  Unique ID of the booking to retrieve
</ParamField>

## Response

### Successful Response (200 OK)

<ResponseField name="status" type="string">
  Response status ("success")
</ResponseField>

<ResponseField name="data" type="object">
  Complete booking object

  <Expandable title="Complete 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

      **Possible values:**

      * `pending` - Pending
      * `approved` - Approved
      * `cancelled` - Cancelled
      * `completed` - Completed
      * `no_show` - No show
    </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">
      Complete customer information

      <Expandable title="Complete 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="full_name" type="string">
          Customer full name
        </ResponseField>

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

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

        <ResponseField name="created_at" type="string">
          Customer registration date
        </ResponseField>
      </Expandable>
    </ResponseField>

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

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

        <ResponseField name="display_name" type="string">
          Agent display name
        </ResponseField>

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

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

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

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

    <ResponseField name="service" type="object">
      Complete service information

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

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

        <ResponseField name="short_description" type="string">
          Service short description
        </ResponseField>

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

        <ResponseField name="price" type="string">
          Service price
        </ResponseField>

        <ResponseField name="category_id" type="integer">
          Service category ID
        </ResponseField>

        <ResponseField name="category_name" type="string">
          Category name
        </ResponseField>
      </Expandable>
    </ResponseField>

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

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

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

        <ResponseField name="full_address" type="string">
          Complete address
        </ResponseField>

        <ResponseField name="address" type="string">
          Address
        </ResponseField>

        <ResponseField name="city" type="string">
          City
        </ResponseField>

        <ResponseField name="state" type="string">
          State/Province
        </ResponseField>

        <ResponseField name="zipcode" type="string">
          Postal code
        </ResponseField>

        <ResponseField name="country" type="string">
          Country
        </ResponseField>

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

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

    <ResponseField name="payment_status" type="string">
      Payment status

      **Possible values:**

      * `not_paid` - Not paid
      * `partially_paid` - Partially paid
      * `paid` - Paid
      * `refunded` - Refunded
    </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>

## Examples

### Basic Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/16" \
    -H "X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ" \
    -H "Content-Type: application/json"
  ```

  ````javascript JavaScript theme={null}
  const bookingId = 123;
  ```javascript JavaScript
  const response = await fetch('http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/16', {
    headers: {
      'X-API-Key': 'lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
      'Content-Type': 'application/json'
    }
  });

  const data = await response.json();
  console.log(data);
  ````

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

  response = requests.get(
      'http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/16',
      headers={
          'X-API-Key': 'lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
          'Content-Type': 'application/json'
      }
  )

  data = response.json()
  print(data)
  ```

  ```php PHP theme={null}
  <?php
  $booking_id = 123;

  $curl = curl_init();

  curl_setopt_array($curl, [
      CURLOPT_URL => "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/{$booking_id}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
          'Content-Type: application/json'
      ]
  ]);

  $response = curl_exec($curl);
  $data = json_decode($response, true);

  curl_close($curl);
  print_r($data);
  ?>
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "18",
    "booking_code": "EUHJVNH",
    "start_datetime": "2025-11-17T16:00:00-03:00",
    "end_datetime": "2025-11-17T17:00:00-03:00",
    "service_name": "test 1",
    "duration": "60",
    "customer_comment": null,
    "status": "pending",
    "start_date": "11/17/2025",
    "start_time": "16:00",
    "timezone": "America/Montevideo",
    "agent": {
      "id": "1",
      "full_name": "Pao Campo",
      "email": "pao@pao.com",
      "phone": ""
    },
    "created_datetime": "2025-08-21T07:41:32+00:00",
    "manage_booking_for_agent": "http://latepoint-dev.local/wp-admin/admin-post.php?action=latepoint_route_call&route_name=manage_booking_by_key__show&key=3d09aa7219f4c883f6a3f78e7662c977a5dd",
    "manage_booking_for_customer": "http://latepoint-dev.local/wp-admin/admin-post.php?action=latepoint_route_call&route_name=manage_booking_by_key__show&key=2009d8e53283cca27ccf1345b53ffa38d881",
    "customer": {
      "id": "7",
      "first_name": "Ana",
      "last_name": "Lopez",
      "full_name": "Ana Lopez",
      "email": "ana.lopez@email.com",
      "phone": "+525559876543"
    },
    "transactions": [],
    "order": {
      "id": "34",
      "confirmation_code": "SCLRA23J",
      "customer_comment": null,
      "status": "open",
      "fulfillment_status": "not_fulfilled",
      "payment_status": "not_paid",
      "source_id": null,
      "source_url": "",
      "total": "$0",
      "subtotal": "$0",
      "created_datetime": "2025-08-21T07:41:32+00:00"
    },
    "location": {
      "id": "1",
      "name": "Main Location",
      "full_address": "",
      "category": []
    },
    "service_extras": []
  }
}
```

## Error Codes

<ResponseExample>
  ```json Error 404 - Booking Not Found theme={null}
  {
    "status": "error",
    "error": {
      "code": "booking_not_found",
      "message": "Booking with ID 123 was not found"
    }
  }
  ```

  ```json Error 401 - Invalid API Key theme={null}
  {
    "status": "error",
    "error": {
      "code": "unauthorized",
      "message": "Invalid or missing API Key"
    }
  }
  ```

  ```json Error 403 - Insufficient Permissions theme={null}
  {
    "status": "error",
    "error": {
      "code": "forbidden",
      "message": "You don't have permission to access this booking"
    }
  }
  ```

  ```json Error 400 - Invalid ID theme={null}
  {
    "status": "error",
    "error": {
      "code": "invalid_request",
      "message": "Invalid booking ID",
      "details": {
        "id": "Must be a positive integer"
      }
    }
  }
  ```
</ResponseExample>

## Common Use Cases

### 1. Display Booking Details

```javascript theme={null}
// To display complete details on a booking page
async function showBookingDetails(bookingId) {
  try {
    const response = await fetch(`/wp-json/latepoint-api/v1/bookings/${bookingId}`, {
      headers: {
        'X-API-Key': 'your_api_key',
        'Content-Type': 'application/json'
      }
    });
    
    if (response.ok) {
      const result = await response.json();
      const booking = result.data;
      
      // Display information in the UI
      document.getElementById('booking-code').textContent = booking.booking_code;
      document.getElementById('customer-name').textContent = booking.customer.full_name;
      document.getElementById('service-name').textContent = booking.service.name;
      document.getElementById('appointment-date').textContent = 
        `${booking.start_date} ${booking.start_time}`;
    }
  } catch (error) {
    console.error('Error fetching booking:', error);
  }
}
```

### 2. Check Booking Status

```javascript theme={null}
// To verify the current status of a booking
async function checkBookingStatus(bookingId) {
  const response = await fetch(`/wp-json/latepoint-api/v1/bookings/${bookingId}`);
  const result = await response.json();
  
  if (result.status === 'success') {
    const status = result.data.status;
    const paymentStatus = result.data.payment_status;
    
    return {
      booking_status: status,
      payment_status: paymentStatus,
      is_approved: status === 'approved',
      is_paid: paymentStatus === 'paid'
    };
  }
  
  return null;
}
```

### 3. Get Information for Confirmation Email

````javascript theme={null}
// To generate personalized confirmation emails
async function getBookingForEmail(bookingId) {
  const response = await fetch(`/wp-json/latepoint-api/v1/bookings/${bookingId}`);
  const result = await response.json();
  
  if (result.status === 'success') {
    const booking = result.data;
    
    return {
      customer_name: booking.customer.full_name,
      customer_email: booking.customer.email,
      service_name: booking.service.name,
      agent_name: booking.agent.display_name,
      appointment_datetime: `${booking.start_date} ${booking.start_time}`,
      location_name: booking.location.name,
      location_address: booking.location.full_address,
      booking_code: booking.booking_code
    };
  }
  
  return null;
}```

## Important Notes

<Note>
  **Complete Information**: This endpoint returns all available booking information, including related customer, agent, service, and location data.
</Note>

<Warning>
  **Permissions**: Make sure your API Key has permissions to access bookings. Some configurations may restrict access to specific bookings.
</Warning>

<Tip>
  **Caching**: Consider implementing client-side caching for bookings that don't change frequently, especially for displaying details in user interfaces.
</Tip>

## Additional Information

The booking response includes all essential information needed for managing appointments, including customer details, agent information, service details, and location data.

## Integration with Other Endpoints

This endpoint complements perfectly with other API endpoints:

- **Update booking**: Use `PUT /bookings/{id}` after getting current data
- **Check availability**: Use `GET /availability` for schedule changes
- **Get customer**: Use `GET /customers/{id}` for additional customer information
- **List bookings**: Use `GET /bookings` for context of other customer bookings
````
