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

# API Introduction

> Fundamental concepts of LatePoint API Extension

## Welcome to LatePoint API

LatePoint API Extension provides a complete REST interface to interact with your LatePoint booking system. This API allows you to integrate LatePoint with external applications, create custom automations, and build unique user experiences.

## Key Features

<CardGroup cols={2}>
  <Card title="RESTful Design" icon="globe">
    API designed following REST principles with intuitive endpoints and standard HTTP methods
  </Card>

  <Card title="Secure Authentication" icon="shield">
    API Key system with granular permissions and configurable rate limiting
  </Card>

  <Card title="JSON Responses" icon="code">
    All responses in JSON format with consistent structure and HTTP status codes
  </Card>

  <Card title="Complete Documentation" icon="book">
    Code examples in multiple languages and detailed use cases
  </Card>
</CardGroup>

## Base URL

All API requests use the following base URL:

```
https://your-site.com/wp-json/latepoint-api/v1
```

## Authentication

Each request must include your API Key in the header:

```http theme={null}
X-API-Key: your_api_key_here
```

[Learn more about authentication →](/authentication)

## Response Structure

### Successful Responses

All successful responses follow this structure:

```json theme={null}
{
  "status": "success",
  "data": {
    // Requested data
  },
  "meta": {
    "total": 100,
    "page": 1,
    "per_page": 20,
    "total_pages": 5
  }
}
```

### Error Responses

Errors follow this structure:

```json theme={null}
{
  "status": "error",
  "error": {
    "code": "invalid_request",
    "message": "Error description",
    "details": {
      "field": "Additional information"
    }
  }
}
```

## HTTP Status Codes

| Code | Meaning               | Description                   |
| ---- | --------------------- | ----------------------------- |
| 200  | OK                    | Successful request            |
| 201  | Created               | Resource created successfully |
| 400  | Bad Request           | Malformed request             |
| 401  | Unauthorized          | Missing or invalid API Key    |
| 403  | Forbidden             | Insufficient permissions      |
| 404  | Not Found             | Resource not found            |
| 422  | Unprocessable Entity  | Invalid input data            |
| 429  | Too Many Requests     | Rate limit exceeded           |
| 500  | Internal Server Error | Server error                  |

## Pagination

### Pagination Parameters

Endpoints that return lists support pagination:

```http theme={null}
GET /bookings?page=2&per_page=50
```

**Parameters:**

* `page`: Page number (default: 1)
* `per_page`: Items per page (default: 20, maximum: 100)

### Paginated Response

```json theme={null}
{
  "status": "success",
  "data": [...],
  "meta": {
    "total": 150,
    "page": 2,
    "per_page": 50,
    "total_pages": 3,
    "has_next_page": true,
    "has_prev_page": true
  }
}
```

## Filtering and Search

### Common Filters

Most endpoints support filters:

```http theme={null}
GET /bookings?status=confirmed&date_from=2024-01-01&date_to=2024-01-31
```

### Text Search

For free text searches:

```http theme={null}
GET /customers?search=john+doe
```

### Sorting

Specify the order of results:

```http theme={null}
GET /bookings?sort=start_date&order=desc
```

**Parameters:**

* `sort`: Field to sort by
* `order`: `asc` (ascending) or `desc` (descending)

## Available Resources

### Bookings

Complete booking management:

* **GET** `/bookings` - List bookings
* **POST** `/bookings` - Create booking
* **GET** `/bookings/{id}` - Get booking
* **PUT** `/bookings/{id}` - Update booking
* **DELETE** `/bookings/{id}` - Delete booking

[View complete documentation →](/api-reference/bookings/list)

### Customers

Customer administration:

* **GET** `/customers` - List customers
* **POST** `/customers` - Create customer
* **GET** `/customers/{id}` - Get customer
* **PUT** `/customers/{id}` - Update customer

[View complete documentation →](/api-reference/customers/list)

### Agents

Agent and schedule queries:

* **GET** `/agents` - List agents
* **GET** `/agents/{id}` - Get agent

[View complete documentation →](/api-reference/agents/list)

### Services

Available services queries:

* **GET** `/services` - List services
* **GET** `/services/{id}` - Get service

[View complete documentation →](/api-reference/services/list)

### Availability

Availability verification:

* **GET** `/availability` - Check availability

[View complete documentation →](/api-reference/availability/check)

## Date and Time Formats

### ISO 8601 Format

All dates and times use ISO 8601 format:

```json theme={null}
{
  "start_date": "2024-01-15",
  "start_time": "14:30",
  "created_at": "2024-01-15T14:30:00Z"
}
```

### Timezone

Dates are handled in the timezone configured in WordPress. To get the current timezone:

```http theme={null}
GET /status
```

```json theme={null}
{
  "status": "success",
  "data": {
    "timezone": "America/New_York",
    "current_time": "2024-01-15T14:30:00-05:00"
  }
}
```

## Versioning

### Current Version

The current API version is `v1`. All URLs include the version:

```
/wp-json/latepoint-api/v1/
```

### Compatibility

We are committed to maintaining backward compatibility within the same major version. Breaking changes will be introduced in new versions.

## Usage Examples

### Basic Example

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

  ```javascript JavaScript theme={null}
  const response = await fetch('https://your-site.com/wp-json/latepoint-api/v1/services', {
    headers: {
      'X-API-Key': 'lp_live_1234567890abcdef',
      'Content-Type': 'application/json'
    }
  });

  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/services',
      headers={
          'X-API-Key': 'lp_live_1234567890abcdef',
          'Content-Type': 'application/json'
      }
  )

  data = response.json()
  print(data)
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Configure your API Key and permissions
  </Card>

  <Card title="Booking Management" icon="calendar" href="/api-reference/bookings/list">
    Start with the most used endpoint
  </Card>

  <Card title="Error Handling" icon="exclamation-triangle" href="/api-reference/errors">
    Learn to handle errors correctly
  </Card>

  <Card title="Practical Examples" icon="code" href="/quickstart">
    See complete implementation examples
  </Card>
</CardGroup>

## Support

If you need help:

1. **Documentation**: Review the specific documentation for each endpoint
2. **Examples**: Check the code examples in each section
3. **Technical support**: Contact through your LatePoint account
4. **Community**: Participate in LatePoint forums
