Get Agents Availability
curl --request GET \
--url https://api.example.com/agents/availabilityimport requests
url = "https://api.example.com/agents/availability"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/agents/availability', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/agents/availability",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/agents/availability"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/agents/availability")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/agents/availability")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": "missing_parameters",
"message": "Required parameters: location_id, service_id, date, start_time",
"data": {
"status": 400
}
}
Agents
Get Agents Availability
Get agents with flexible filtering and optional availability checking
GET
/
agents
/
availability
Get Agents Availability
curl --request GET \
--url https://api.example.com/agents/availabilityimport requests
url = "https://api.example.com/agents/availability"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/agents/availability', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/agents/availability",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/agents/availability"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/agents/availability")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/agents/availability")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": "missing_parameters",
"message": "Required parameters: location_id, service_id, date, start_time",
"data": {
"status": 400
}
}
This endpoint allows you to get a list of agents with flexible filtering options. You can filter by location, service, and optionally check their availability for a specific date and time. All parameters are optional, making it very flexible for different use cases.
Parameters
integer
Filter agents by location ID. If provided, only agents working at this location will be returned
integer
Filter agents by service ID. If provided, only agents who can provide this service will be returned
string
Date to check availability for in Y-m-d format (e.g., “2024-01-15”). Only used if start_time is also provided
string
Start time to check availability for. Can be in HH:MM format (e.g., “14:30”) or minutes since midnight (e.g., “870”). Only used if date is also provided
integer
Duration of the appointment in minutes. If not provided and service_id is given, uses the service’s default duration. Otherwise defaults to 60 minutes
integer
default:"50"
Maximum number of agents to return. Useful for pagination
Response
boolean
Indicates if the request was successful
object
The main response data containing agents information
Show data properties
Show data properties
object
integer
Total number of agents returned (after filtering)
integer
Number of agents that are available at the specified time (only if date and start_time were provided)
array
Array of all agent objects (filtered by location/service if specified)
Show agent properties
Show agent properties
integer
Agent’s unique identifier
string
Agent’s first name
string
Agent’s last name
string
Agent’s display name
string
Agent’s email address
string
Agent’s phone number
string
Agent’s status (active, disabled)
array
Array of services this agent can provide (filtered by location if specified)
array
Array of locations where this agent works (filtered by service if specified)
boolean|null
Whether the agent is available at the specified time (null if no time check was performed)
array
Array of agents that are available at the specified time (only if date and start_time were provided)
Example Requests
1. Get all agents (no filters)
curl -X GET "https://yourdomain.com/wp-json/latepoint-api/v1/agents/availability" \
-H "Authorization: Bearer lp_your_api_key_here"
2. Get agents by location only
curl -X GET "https://yourdomain.com/wp-json/latepoint-api/v1/agents/availability?location_id=1" \
-H "Authorization: Bearer lp_your_api_key_here"
3. Get agents by location and service
curl -X GET "https://yourdomain.com/wp-json/latepoint-api/v1/agents/availability?location_id=1&service_id=2" \
-H "Authorization: Bearer lp_your_api_key_here"
4. Check availability for specific date and time
curl -X GET "https://yourdomain.com/wp-json/latepoint-api/v1/agents/availability?location_id=1&service_id=2&date=2024-01-15&start_time=14:30&duration=60&limit=3" \
-H "Authorization: Bearer lp_your_api_key_here"
Example Response
{
"success": true,
"data": {
"filters": {
"location_id": 1,
"service_id": 2,
"date": "2024-01-15",
"start_time": "14:30",
"duration": 60
},
"total_agents": 3,
"available_agents_count": 2,
"agents": [
{
"id": 3,
"first_name": "John",
"last_name": "Smith",
"display_name": "Dr. John Smith",
"email": "john.smith@example.com",
"phone": "+1234567890",
"status": "active",
"services": [
{
"id": 2,
"name": "Consultation",
"duration": 60
}
],
"locations": [
{
"id": 1,
"name": "Main Office",
"address": "123 Main St, City, State"
}
],
"is_available": true
},
{
"id": 7,
"first_name": "Sarah",
"last_name": "Johnson",
"display_name": "Dr. Sarah Johnson",
"email": "sarah.johnson@example.com",
"phone": "+1234567891",
"status": "active",
"services": [
{
"id": 2,
"name": "Consultation",
"duration": 60
}
],
"locations": [
{
"id": 1,
"name": "Main Office",
"address": "123 Main St, City, State"
}
],
"is_available": true
},
{
"id": 9,
"first_name": "Mike",
"last_name": "Wilson",
"display_name": "Dr. Mike Wilson",
"email": "mike.wilson@example.com",
"phone": "+1234567892",
"status": "active",
"services": [
{
"id": 2,
"name": "Consultation",
"duration": 60
}
],
"locations": [
{
"id": 1,
"name": "Main Office",
"address": "123 Main St, City, State"
}
],
"is_available": false
}
],
"available_agents": [
{
"id": 3,
"first_name": "John",
"last_name": "Smith",
"display_name": "Dr. John Smith",
"email": "john.smith@example.com",
"phone": "+1234567890",
"status": "active",
"services": [...],
"locations": [...],
"is_available": true
},
{
"id": 7,
"first_name": "Sarah",
"last_name": "Johnson",
"display_name": "Dr. Sarah Johnson",
"email": "sarah.johnson@example.com",
"phone": "+1234567891",
"status": "active",
"services": [...],
"locations": [...],
"is_available": true
}
]
}
},
{
"id": 5,
"first_name": "Mike",
"last_name": "Johnson",
"display_name": "Dr. Mike Johnson",
"email": "mike.johnson@example.com",
"status": "active"
}
]
}
}
Use Cases
- Find Multiple Available Agents: When you need to show customers multiple agent options for the same time slot
- Count Available Agents: Check how many agents are available without needing their full details
- Load Balancing: Distribute bookings across available agents
- Capacity Planning: Understand availability patterns for better scheduling
- Group Bookings: Find multiple agents for simultaneous appointments
Error Responses
{
"code": "missing_parameters",
"message": "Required parameters: location_id, service_id, date, start_time",
"data": {
"status": 400
}
}
{
"code": "invalid_date",
"message": "Date must be in Y-m-d format",
"data": {
"status": 400
}
}
{
"code": "invalid_time",
"message": "Start time must be in HH:MM format or minutes",
"data": {
"status": 400
}
}
{
"code": "service_not_found",
"message": "Service not found",
"data": {
"status": 404
}
}
Notes
- The endpoint checks for both existing bookings and agent working hours
- Only active agents are considered for availability
- The
limitparameter is useful for performance when you only need a specific number of agents - Time can be provided in either HH:MM format or as minutes since midnight
- If duration is not provided, the service’s default duration is used
- The endpoint considers both approved and pending bookings as conflicts
