> 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 a bucketed outcome time series

GET https://staging.cail.health/v1/analytics/time-series

Returns a bucketed time series of outcomes over the reporting window. When `granularity` is omitted, the server picks `day` for short windows, `week` for medium, and `month` for long windows. Use to render trend charts in the operator UI.

Reference: https://docs.cail.health/api-references/api-reference/monitor-performance/time-series

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: cail-api
  version: 1.0.0
paths:
  /v1/analytics/time-series:
    get:
      operationId: time-series
      summary: Get a bucketed outcome time series
      description: >-
        Returns a bucketed time series of outcomes over the reporting window.
        When `granularity` is omitted, the server picks `day` for short windows,
        `week` for medium, and `month` for long windows. Use to render trend
        charts in the operator UI.
      tags:
        - subpackage_monitorPerformance
      parameters:
        - name: periodStart
          in: query
          description: >-
            ISO 8601 date or datetime for the inclusive lower bound. Bare
            YYYY-MM-DD is treated as start-of-day UTC. Defaults to 12 months
            ago.
          required: false
          schema:
            type: string
        - name: periodEnd
          in: query
          description: >-
            ISO 8601 date or datetime for the inclusive upper bound. Bare
            YYYY-MM-DD is treated as end-of-day inclusive. Defaults to now.
          required: false
          schema:
            type: string
        - name: granularity
          in: query
          description: >-
            Bucket size for the series. When omitted, the server picks one based
            on the resolved range.
          required: false
          schema:
            $ref: '#/components/schemas/V1AnalyticsTimeSeriesGetParametersGranularity'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsTimeSeriesResponse'
servers:
  - url: https://staging.cail.health
    description: https://staging.cail.health
components:
  schemas:
    V1AnalyticsTimeSeriesGetParametersGranularity:
      type: string
      enum:
        - day
        - week
        - month
      title: V1AnalyticsTimeSeriesGetParametersGranularity
    AnalyticsTimeSeriesResponseGranularity:
      type: string
      enum:
        - day
        - week
        - month
      description: Granularity actually applied by the server.
      title: AnalyticsTimeSeriesResponseGranularity
    AnalyticsTimeSeriesPoint:
      type: object
      properties:
        bucketStart:
          type: string
          description: ISO 8601 bucket start.
        values:
          type: object
          additionalProperties:
            description: Any type
          description: Per-bucket aggregated values keyed by metric identifier.
      required:
        - bucketStart
        - values
      title: AnalyticsTimeSeriesPoint
    AnalyticsTimeSeriesResponse:
      type: object
      properties:
        granularity:
          $ref: '#/components/schemas/AnalyticsTimeSeriesResponseGranularity'
          description: Granularity actually applied by the server.
        data:
          type: array
          items:
            $ref: '#/components/schemas/AnalyticsTimeSeriesPoint'
          description: Bucketed time series points, ordered by bucketStart.
      required:
        - granularity
        - data
      title: AnalyticsTimeSeriesResponse
  securitySchemes:
    auth0Bearer:
      type: http
      scheme: bearer

```

## Examples



**Response**

```json
{
  "granularity": "week",
  "data": [
    {
      "bucketStart": "2026-04-01",
      "values": {
        "completed": 42,
        "abandoned": 4
      }
    },
    {
      "bucketStart": "2026-04-08",
      "values": {
        "completed": 51,
        "abandoned": 3
      }
    },
    {
      "bucketStart": "2026-04-15",
      "values": {
        "completed": 47,
        "abandoned": 5
      }
    },
    {
      "bucketStart": "2026-04-22",
      "values": {
        "completed": 44,
        "abandoned": 4
      }
    }
  ]
}
```

**SDK Code**

```python Four weekly buckets of completed and abandoned sessions
import requests

url = "https://staging.cail.health/v1/analytics/time-series"

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

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

print(response.json())
```

```javascript Four weekly buckets of completed and abandoned sessions
const url = 'https://staging.cail.health/v1/analytics/time-series';
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 Four weekly buckets of completed and abandoned sessions
package main

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

func main() {

	url := "https://staging.cail.health/v1/analytics/time-series"

	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 Four weekly buckets of completed and abandoned sessions
require 'uri'
require 'net/http'

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

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 Four weekly buckets of completed and abandoned sessions
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Four weekly buckets of completed and abandoned sessions
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Four weekly buckets of completed and abandoned sessions
using RestSharp;

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

```swift Four weekly buckets of completed and abandoned sessions
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://staging.cail.health/v1/analytics/time-series")! 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()
```