> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cail.health/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cail.health/_mcp/server.

# Get wait-time analytics for your network

GET https://staging.cail.health/v1/wait-times/analytics

Returns per-location wait-time analytics for the operator’s organisation across the requested reporting window. Each row carries the mean and median wait, the report count backing those aggregates, and the modal hour of day reports were submitted. Defaults to the last 30 days when no window is supplied. Results are sorted by report count descending so the busiest locations appear first.

Reference: https://docs.cail.health/api-references/api-reference/check-availability/get-analytics

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: cail-api
  version: 1.0.0
paths:
  /v1/wait-times/analytics:
    get:
      operationId: get-analytics
      summary: Get wait-time analytics for your network
      description: >-
        Returns per-location wait-time analytics for the operator’s organisation
        across the requested reporting window. Each row carries the mean and
        median wait, the report count backing those aggregates, and the modal
        hour of day reports were submitted. Defaults to the last 30 days when no
        window is supplied. Results are sorted by report count descending so the
        busiest locations appear first.
      tags:
        - subpackage_checkAvailability
      parameters:
        - name: periodStart
          in: query
          description: >-
            Lower bound of the reporting window (ISO 8601 date). Defaults to 30
            days ago.
          required: false
          schema:
            type: string
        - name: periodEnd
          in: query
          description: >-
            Upper bound of the reporting window (ISO 8601 date). Defaults to
            today.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Maximum number of rows to return. Defaults to 20.
          required: false
          schema:
            type: number
            format: double
        - name: offset
          in: query
          description: Zero-based offset into the result set. Defaults to 0.
          required: false
          schema:
            type: number
            format: double
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Paginated wait-time analytics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WaitTimeAnalyticsResponse'
servers:
  - url: https://staging.cail.health
    description: https://staging.cail.health
components:
  schemas:
    LocationWaitTimeAnalyticsPeakHour:
      type: object
      properties: {}
      description: >-
        Hour of the day (0-23, local server time) with the most reports in the
        window. Null when no clear modal hour exists.
      title: LocationWaitTimeAnalyticsPeakHour
    LocationWaitTimeAnalytics:
      type: object
      properties:
        locationId:
          type: string
          description: Stable identifier of the location these analytics describe.
        locationName:
          type: string
          description: Display name of the location pulled from its FHIR resource.
        avgMinutes:
          type: number
          format: double
          description: >-
            Mean wait time across reports in the reporting window, in minutes.
            Rounded to 1 decimal place.
        medianMinutes:
          type: number
          format: double
          description: >-
            Median wait time across reports in the reporting window, in minutes.
            Rounded to 1 decimal place.
        reportCount:
          type: number
          format: double
          description: Total number of reports backing the period aggregates.
        peakHour:
          oneOf:
            - $ref: '#/components/schemas/LocationWaitTimeAnalyticsPeakHour'
            - type: 'null'
          description: >-
            Hour of the day (0-23, local server time) with the most reports in
            the window. Null when no clear modal hour exists.
      required:
        - locationId
        - locationName
        - avgMinutes
        - medianMinutes
        - reportCount
        - peakHour
      title: LocationWaitTimeAnalytics
    OffsetPageInfo:
      type: object
      properties:
        total:
          type: number
          format: double
          description: Total number of items across all pages.
        limit:
          type: number
          format: double
          description: Echoes the requested page size for client convenience.
        offset:
          type: number
          format: double
          description: Echoes the requested zero-based offset.
        hasMore:
          type: boolean
          description: True when more results exist after this page.
      required:
        - total
        - limit
        - offset
        - hasMore
      title: OffsetPageInfo
    WaitTimeAnalyticsPage:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/LocationWaitTimeAnalytics'
          description: Per-location analytics for the reporting window.
        pagination:
          $ref: '#/components/schemas/OffsetPageInfo'
          description: Pagination metadata for stepping forward by offset.
      required:
        - data
        - pagination
      title: WaitTimeAnalyticsPage
    WaitTimeAnalyticsResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/WaitTimeAnalyticsPage'
          description: Paginated wait-time analytics for the operator’s organisation.
      required:
        - data
      title: WaitTimeAnalyticsResponse
  securitySchemes:
    auth0Bearer:
      type: http
      scheme: bearer

```

## Examples



**Response**

```json
{
  "data": {
    "data": [
      {
        "locationId": "b3c8a5d2-1f4e-4d9a-9c8b-7a6e5f4d3c2b",
        "locationName": "Lambeth Walk-In Centre",
        "avgMinutes": 24.7,
        "medianMinutes": 22,
        "reportCount": 184,
        "peakHour": 14
      },
      {
        "locationId": "loc_02HZX9P3Q5R7S9T1V3W5Y7Z9A1",
        "locationName": "Southwark Urgent Treatment Centre",
        "avgMinutes": 31.2,
        "medianMinutes": 28,
        "reportCount": 96,
        "peakHour": 18
      }
    ],
    "pagination": {
      "total": 2,
      "limit": 20,
      "offset": 0,
      "hasMore": false
    }
  }
}
```

**SDK Code**

```python Two locations in the operator’s network
import requests

url = "https://staging.cail.health/v1/wait-times/analytics"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Two locations in the operator’s network
const url = 'https://staging.cail.health/v1/wait-times/analytics';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Two locations in the operator’s network
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://staging.cail.health/v1/wait-times/analytics"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Two locations in the operator’s network
require 'uri'
require 'net/http'

url = URI("https://staging.cail.health/v1/wait-times/analytics")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Two locations in the operator’s network
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://staging.cail.health/v1/wait-times/analytics")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Two locations in the operator’s network
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://staging.cail.health/v1/wait-times/analytics', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Two locations in the operator’s network
using RestSharp;

var client = new RestClient("https://staging.cail.health/v1/wait-times/analytics");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Two locations in the operator’s network
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://staging.cail.health/v1/wait-times/analytics")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```