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

> Retrieve a list of all agents with advanced filtering, pagination, and sorting options.

## Query Parameters

<ParamField query="status" type="string">
  Filter by agent status. Available values: `active`, `disabled`
</ParamField>

<ParamField query="search" type="string">
  Search by first name, last name, or email address
</ParamField>

<ParamField query="email" type="string">
  Filter by exact email address
</ParamField>

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

<ParamField query="location_id" type="integer">
  Filter agents by location ID (shows only agents available at this location)
</ParamField>

<ParamField query="service_id" type="integer">
  Filter agents by service ID (shows only agents who provide this service)
</ParamField>

<ParamField query="created_after" type="string">
  Filter agents created after this date (YYYY-MM-DD format)
</ParamField>

<ParamField query="created_before" type="string">
  Filter agents created before this date (YYYY-MM-DD format)
</ParamField>

<ParamField query="include" type="string">
  Include related data. Available values: `services`
</ParamField>

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

<ParamField query="per_page" type="integer" default="10">
  Number of results per page (1-100)
</ParamField>

<ParamField query="order_by" type="string" default="first_name">
  Sort field. Available values: `id`, `first_name`, `last_name`, `email`, `created_at`, `updated_at`, `status`
</ParamField>

<ParamField query="order" type="string" default="asc">
  Sort direction. Available values: `asc`, `desc`
</ParamField>

## Basic Request

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

## Advanced Filtering Examples

### Filter by Status

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?status=active
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Search by Name or Email

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?search=john
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Include Services Data

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?include=services&per_page=5
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Date Range Filter

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?created_after=2024-01-01&created_before=2024-12-31
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Pagination and Sorting

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?page=2&per_page=25&order_by=last_name&order=desc
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Filter by Location

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?location_id=2
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Filter by Service

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?service_id=1
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

### Combined Location and Service Filter

```bash theme={null}
GET /wp-json/latepoint-api/v1/agents?location_id=2&service_id=1&status=active
X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ
```

## Response

Services and locations assigned to each agent are always included in the response.

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": "1",
      "first_name": "Pao",
      "last_name": "Campo",
      "display_name": "Agente Pao",
      "email": "pao@example.com",
      "phone": "",
      "bio": "Agent bio here",
      "features": "[{\"value\":\"\",\"label\":\"\"}]",
      "status": "active",
      "created_at": "2025-08-17 09:21:51",
      "updated_at": "2025-08-18 06:43:39",
      "services": [
        {
          "id": "2",
          "name": "General Consultation",
          "short_description": "Standard medical consultation",
          "duration": "60",
          "price_min": "23.0000",
          "price_max": "23.0000",
          "status": "active"
        }
      ],
      "locations": [
        {
          "id": "1",
          "name": "Main Location",
          "full_address": "",
          "status": "active"
        }
      ]
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 10,
    "total": 2,
    "total_pages": 1,
    "has_next_page": false,
    "has_previous_page": false
  }
}
```
