# Usage

How much audio your workspace transcribed, by day or month and by key, and every job and session.

Two endpoints answer what your workspace did: `GET /v1/usage` adds up the audio, and `GET /v1/activity` lists each batch job and live session. The console's [Usage](https://platform.vatis.tech/usage) and [Activity](https://platform.vatis.tech/activity) pages show the same, for people.

## What counts

- **A batch job**, when it ends: the length of the recording (the transcript's `duration_s`). A two-channel file (`multichannel=true`) counts its length once.
- **A live session**, when it ends: the audio it received (`session.ended`'s `duration_s`). A two-channel session counts its length once.
- **Failed work** is counted as failed, but its audio is not usage: a batch job that ended `failed`, or a session that ended with an error on our side (`transcriber_error`, `internal_error`, `capacity`). A session that ended for the client's own reasons (`idle_timeout`, `session_time_limit`, a refused message or frame) is not a failure, and its audio counts.
- Each counts on the UTC day it ended, for the API key that sent it, as `batch` or `realtime`, with or without speakers (`diarize`).

The audio counted here is what your workspace's credit pays for, by the second. The record is kept apart from the transcripts: retention, `store=false` and deleting a transcript do not change it, and it holds no text.

## Get usage

`GET /v1/usage`

The audio your workspace transcribed, by day or by month: an Admin key the whole workspace, a Member key its own.

| Parameter | Values | Default | Meaning |
|---|---|---|---|
| `from` | a UTC day, `YYYY-MM-DD` | the first day of this month | The first day, included. |
| `to` | a UTC day, `YYYY-MM-DD` | today | The last day, included. |
| `group` | `day`, `month` | `day` | One period per day, or per month. |

```bash
curl -sS -H "Authorization: Bearer $VATIS_KEY" "https://api.eu.vatis.tech/v1/usage?from=2026-11-01&to=2026-11-30"
```

```javascript
// The usage of November, by day: node usage.mjs
const url = new URL("https://api.eu.vatis.tech/v1/usage");
url.search = new URLSearchParams({ from: "2026-11-01", to: "2026-11-30", group: "day" });
const headers = { Authorization: `Bearer ${process.env.VATIS_KEY}` };

const response = await fetch(url, { headers });
const usage = await response.json();
if (!response.ok) { // a bad date or range: the error names the parameter
  console.error(`${response.status} ${usage.error.code}: ${usage.error.message}`);
  process.exit(1);
}

const hours = (seconds) => (seconds / 3600).toFixed(2);
console.log(`batch: ${usage.totals.batch.count} files, ${hours(usage.totals.batch.audio_s)} h`);
console.log(`real-time: ${usage.totals.realtime.count} sessions, ${hours(usage.totals.realtime.audio_s)} h`);
for (const key of usage.keys) { // each key's totals over the range
  console.log(`${key.name}: ${hours(key.batch.audio_s + key.realtime.audio_s)} h`);
}
```

```go
// The usage of November, by day: go run usage.go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"os"
)

// Total is what this program reads of a batch or real-time total.
type Total struct {
	Count  int
	AudioS float64 `json:"audio_s"`
}

func main() {
	params := url.Values{"from": {"2026-11-01"}, "to": {"2026-11-30"}, "group": {"day"}}
	address := "https://api.eu.vatis.tech/v1/usage?" + params.Encode()
	request, err := http.NewRequest("GET", address, nil)
	check(err)
	request.Header.Set("Authorization", "Bearer "+os.Getenv("VATIS_KEY"))

	response, err := http.DefaultClient.Do(request)
	check(err)
	defer response.Body.Close()
	var usage struct {
		Totals struct{ Batch, Realtime Total }
		Keys   []struct {
			Name            string
			Batch, Realtime Total
		}
		Error struct{ Code, Message string }
	}
	check(json.NewDecoder(response.Body).Decode(&usage))
	if response.StatusCode >= 400 { // a bad date or range: the error names the parameter
		check(fmt.Errorf("%d %s: %s", response.StatusCode, usage.Error.Code, usage.Error.Message))
	}

	totals := usage.Totals
	fmt.Printf("batch: %d files, %.2f h\n", totals.Batch.Count, totals.Batch.AudioS/3600)
	fmt.Printf("real-time: %d sessions, %.2f h\n",
		totals.Realtime.Count, totals.Realtime.AudioS/3600)
	for _, key := range usage.Keys { // each key's totals over the range
		fmt.Printf("%s: %.2f h\n", key.Name, (key.Batch.AudioS+key.Realtime.AudioS)/3600)
	}
}

// check stops the program on an error.
func check(err error) {
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
```

```python
"""The usage of November, by day: python3 usage.py"""
import os
import sys

import httpx

url = "https://api.eu.vatis.tech/v1/usage"
headers = {"Authorization": f"Bearer {os.environ['VATIS_KEY']}"}
params = {"from": "2026-11-01", "to": "2026-11-30", "group": "day"}

response = httpx.get(url, headers=headers, params=params, timeout=60)
usage = response.json()
if response.is_error:  # a bad date or range: the error names the parameter
    error = usage["error"]
    sys.exit(f"{response.status_code} {error['code']}: {error['message']}")

totals = usage["totals"]
print(f"batch: {totals['batch']['count']} files, {totals['batch']['audio_s'] / 3600:.2f} h")
print(f"real-time: {totals['realtime']['count']} sessions, {totals['realtime']['audio_s'] / 3600:.2f} h")
for key in usage["keys"]:  # each key's totals over the range
    print(f"{key['name']}: {(key['batch']['audio_s'] + key['realtime']['audio_s']) / 3600:.2f} h")
```

```java
// The usage of November, by day: java Usage.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class Usage {
    public static void main(String[] args) throws Exception {
        String url = "https://api.eu.vatis.tech/v1/usage?from=2026-11-01&to=2026-11-30&group=day";
        HttpRequest request = HttpRequest.newBuilder(URI.create(url))
            .header("Authorization", "Bearer " + System.getenv("VATIS_KEY"))
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        Object usage = Json.parse(response.body());
        if (response.statusCode() >= 400) { // a bad date or range: the error names the parameter
            Object error = get(usage, "error");
            System.err.println(response.statusCode() + " " + get(error, "code") + ": "
                + get(error, "message"));
            System.exit(1);
        }

        Object batch = get(usage, "totals", "batch");
        Object realtime = get(usage, "totals", "realtime");
        System.out.printf(Locale.ROOT, "batch: %.0f files, %.2f h%n",
            get(batch, "count"), (Double) get(batch, "audio_s") / 3600);
        System.out.printf(Locale.ROOT, "real-time: %.0f sessions, %.2f h%n",
            get(realtime, "count"), (Double) get(realtime, "audio_s") / 3600);
        for (Object key : (List<?>) get(usage, "keys")) { // each key's totals over the range
            double seconds = (Double) get(key, "batch", "audio_s")
                + (Double) get(key, "realtime", "audio_s");
            System.out.printf(Locale.ROOT, "%s: %.2f h%n", get(key, "name"), seconds / 3600);
        }
    }

    // The value at a path of names in read JSON, as get(answer, "error", "code").
    static Object get(Object json, String... path) {
        for (String name : path) {
            json = ((Map<?, ?>) json).get(name);
        }
        return json;
    }

    // Reads JSON into maps, lists, strings, doubles, booleans and null: Java
    // has no JSON parser built in, a real program would use a library.
    static class Json {
        final String text;
        int at = 0;

        Json(String text) {
            this.text = text;
        }

        static Object parse(String text) {
            return new Json(text).value();
        }

        // The next character that is not white space.
        char next() {
            while (Character.isWhitespace(text.charAt(at))) {
                at++;
            }
            return text.charAt(at++);
        }

        Object value() {
            char first = next();
            if (first == '{') {
                Map<String, Object> object = new LinkedHashMap<>();
                if (next() != '}') {
                    at--;
                    do {
                        String name = (String) value();
                        next(); // the colon
                        object.put(name, value());
                    } while (next() == ',');
                }
                return object;
            }
            if (first == '[') {
                List<Object> array = new ArrayList<>();
                if (next() != ']') {
                    at--;
                    do {
                        array.add(value());
                    } while (next() == ',');
                }
                return array;
            }
            if (first == '"') {
                StringBuilder string = new StringBuilder();
                for (char c = text.charAt(at++); c != '"'; c = text.charAt(at++)) {
                    if (c == '\\') {
                        c = text.charAt(at++);
                        if (c == 'u') {
                            c = (char) Integer.parseInt(text.substring(at, at + 4), 16);
                            at += 4;
                        } else if ("bfnrt".indexOf(c) >= 0) {
                            c = "\b\f\n\r\t".charAt("bfnrt".indexOf(c));
                        }
                    }
                    string.append(c);
                }
                return string.toString();
            }
            // a number, true, false or null
            int start = at - 1;
            while (at < text.length() && ",:]} \t\r\n".indexOf(text.charAt(at)) < 0) {
                at++;
            }
            String word = text.substring(start, at);
            if (word.equals("null")) {
                return null;
            }
            if (word.equals("true") || word.equals("false")) {
                return Boolean.valueOf(word);
            }
            return Double.valueOf(word);
        }
    }
}
```

```csharp
// The usage of November, by day: dotnet run --project usage
// (first dotnet new console -o usage, then put this in usage/Program.cs)
using System.Globalization;
using System.Net.Http.Headers;
using System.Text.Json;

var url = "https://api.eu.vatis.tech/v1/usage?from=2026-11-01&to=2026-11-30&group=day";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VATIS_KEY"));

using var response = await http.GetAsync(url);
var usage = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
if (!response.IsSuccessStatusCode) // a bad date or range: the error names the parameter
{
    var error = usage.GetProperty("error");
    var message = error.GetProperty("message");
    Console.Error.WriteLine($"{(int)response.StatusCode} {error.GetProperty("code")}: {message}");
    return 1;
}

// the hours with a dot whatever the computer's language, as the other languages print them
string Hours(double seconds) => (seconds / 3600).ToString("F2", CultureInfo.InvariantCulture);
var batch = usage.GetProperty("totals").GetProperty("batch");
var realtime = usage.GetProperty("totals").GetProperty("realtime");
var batchS = batch.GetProperty("audio_s").GetDouble();
var realtimeS = realtime.GetProperty("audio_s").GetDouble();
Console.WriteLine($"batch: {batch.GetProperty("count")} files, {Hours(batchS)} h");
Console.WriteLine($"real-time: {realtime.GetProperty("count")} sessions, {Hours(realtimeS)} h");
foreach (var key in usage.GetProperty("keys").EnumerateArray()) // each key's totals over the range
{
    var seconds = key.GetProperty("batch").GetProperty("audio_s").GetDouble()
        + key.GetProperty("realtime").GetProperty("audio_s").GetDouble();
    Console.WriteLine($"{key.GetProperty("name")}: {Hours(seconds)} h");
}
return 0;
```

**Expected result** (curl, here on several lines):

```json
{"from": "2026-11-01", "to": "2026-11-30", "group": "day", "scope": "all",
 "totals": {"batch": {"count": 3, "failed": 0, "audio_s": 512.3, "speakers_audio_s": 120.0},
            "realtime": {"count": 12, "failed": 1, "audio_s": 3605.1, "speakers_audio_s": 0.0},
            "peak_realtime_sessions": 3},
 "periods": [{"period": "2026-11-12", "batch": {"count": 3, "failed": 0, "audio_s": 512.3, "speakers_audio_s": 120.0},
              "realtime": {"count": 12, "failed": 1, "audio_s": 3605.1, "speakers_audio_s": 0.0},
              "peak_realtime_sessions": 3}],
 "keys": [{"key_id": "key_3f9c1a2b7d4e", "name": "crm-backend",
           "batch": {"count": 3, "failed": 0, "audio_s": 512.3, "speakers_audio_s": 120.0},
           "realtime": {"count": 12, "failed": 1, "audio_s": 3605.1, "speakers_audio_s": 0.0}}]}
```

| Field | Meaning |
|---|---|
| `from` | The range and grouping as applied, with `to` and `group`. |
| `scope` | `all`: the whole workspace, every key listed (an Admin key). `key`: a Member key's own work. |
| `totals` | `batch`, `realtime` and `peak_realtime_sessions` over the range. |
| `periods` | Only the days (or months) with usage, oldest first. `period` is `YYYY-MM-DD`, or `YYYY-MM` by month. |
| `keys` | Each key's totals over the range, by `key_id` and `name`, revoked keys too. |
| `count` | Batch jobs, or live sessions, that ended in the range. |
| `failed` | Of those, the ones that failed. Their audio is not in audio_s. |
| `audio_s` | Seconds of audio of the ones that did not fail, rounded to 0.1 s. |
| `speakers_audio_s` | The part of `audio_s` sent with `diarize=true`. |
| `peak_realtime_sessions` | The most live sessions open at once in the workspace that day or month, a two-channel session counting 2. `null` for a Member key: the peak is the whole workspace's. |

- **The range** is at most 366 days by day and 3660 days by month.
- **Your own row:** `key_id` is the key's id in the list of keys, next to its prefix (`vatis_sk_` and 6 more characters). `GET /v1/me` says which key a request carries ([Authentication and API keys](https://platform.vatis.tech/docs/authentication)).

## List activity

`GET /v1/activity`

Every batch job and live session of the workspace (a Member key: its own), the open ones first, with a summary of the last 24 hours.

| Parameter | Values | Default | Meaning |
|---|---|---|---|
| `limit` | 1 to 100 | `25` | Rows per page. |
| `offset` | a whole number, 0 or more | `0` | Rows to skip. Past `total`: an empty page. |
| `type` | `batch`, `realtime`, or both, comma-separated | all | Only rows of these kinds. Example: `batch,realtime`. |
| `status` | `queued`, `running`, `completed`, `failed` | all | Only rows in this state. |
| `key_id` | a key's id | all | Only one API key's rows, a revoked key's too. A Member key can name only itself: another key's id is `403` `admin_only`. |
| `id` | the start of an id, 3 to 64 letters, digits or `_` |  | Only the rows whose id starts so, for example `tr_3b4`. |

An empty value counts as not sent.

```bash
curl -sS -H "Authorization: Bearer $VATIS_KEY" "https://api.eu.vatis.tech/v1/activity?limit=10&status=failed"
```

```javascript
// The last failed jobs and sessions, and the summary: node activity.mjs
const url = new URL("https://api.eu.vatis.tech/v1/activity");
url.search = new URLSearchParams({ limit: "10", status: "failed" });
const headers = { Authorization: `Bearer ${process.env.VATIS_KEY}` };

const response = await fetch(url, { headers });
const page = await response.json();
if (!response.ok) {
  console.error(`${response.status} ${page.error.code}: ${page.error.message}`);
  process.exit(1);
}

const { running, last_24h, failed_24h } = page.summary; // the whole workspace, not filtered
console.log(`open now: ${running}; last 24 hours: ${last_24h}, ${failed_24h} failed`);
for (const row of page.activity) {
  console.log(`${row.created_at} ${row.type} ${row.id ?? "(not kept)"}: ${row.error.code}`);
}
```

```go
// The last failed jobs and sessions, and the summary: go run activity.go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"os"
)

func main() {
	params := url.Values{"limit": {"10"}, "status": {"failed"}}
	address := "https://api.eu.vatis.tech/v1/activity?" + params.Encode()
	request, err := http.NewRequest("GET", address, nil)
	check(err)
	request.Header.Set("Authorization", "Bearer "+os.Getenv("VATIS_KEY"))

	response, err := http.DefaultClient.Do(request)
	check(err)
	defer response.Body.Close()
	var page struct {
		Summary struct {
			Running   int
			Last24h   int `json:"last_24h"`
			Failed24h int `json:"failed_24h"`
		}
		Activity []struct {
			CreatedAt string `json:"created_at"`
			Type      string
			ID        *string // null when not kept
			Error     struct{ Code string }
		}
		Error struct{ Code, Message string }
	}
	check(json.NewDecoder(response.Body).Decode(&page))
	if response.StatusCode >= 400 {
		check(fmt.Errorf("%d %s: %s", response.StatusCode, page.Error.Code, page.Error.Message))
	}

	summary := page.Summary // the whole workspace, not filtered
	fmt.Printf("open now: %d; last 24 hours: %d, %d failed\n",
		summary.Running, summary.Last24h, summary.Failed24h)
	for _, row := range page.Activity {
		id := "(not kept)"
		if row.ID != nil {
			id = *row.ID
		}
		fmt.Printf("%s %s %s: %s\n", row.CreatedAt, row.Type, id, row.Error.Code)
	}
}

// check stops the program on an error.
func check(err error) {
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
```

```python
"""The last failed jobs and sessions, and the summary: python3 activity.py"""
import os
import sys

import httpx

url = "https://api.eu.vatis.tech/v1/activity"
headers = {"Authorization": f"Bearer {os.environ['VATIS_KEY']}"}

response = httpx.get(url, headers=headers, params={"limit": 10, "status": "failed"}, timeout=60)
page = response.json()
if response.is_error:
    error = page["error"]
    sys.exit(f"{response.status_code} {error['code']}: {error['message']}")

summary = page["summary"]  # the whole workspace, not filtered
print(f"open now: {summary['running']}; last 24 hours: {summary['last_24h']}, {summary['failed_24h']} failed")
for row in page["activity"]:
    print(f"{row['created_at']} {row['type']} {row['id'] or '(not kept)'}: {row['error']['code']}")
```

```java
// The last failed jobs and sessions, and the summary: java Activity.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class Activity {
    public static void main(String[] args) throws Exception {
        String url = "https://api.eu.vatis.tech/v1/activity?limit=10&status=failed";
        HttpRequest request = HttpRequest.newBuilder(URI.create(url))
            .header("Authorization", "Bearer " + System.getenv("VATIS_KEY"))
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        Object page = Json.parse(response.body());
        if (response.statusCode() >= 400) {
            Object error = get(page, "error");
            System.err.println(response.statusCode() + " " + get(error, "code") + ": "
                + get(error, "message"));
            System.exit(1);
        }

        Object summary = get(page, "summary"); // the whole workspace, not filtered
        System.out.printf("open now: %.0f; last 24 hours: %.0f, %.0f failed%n",
            get(summary, "running"), get(summary, "last_24h"), get(summary, "failed_24h"));
        for (Object row : (List<?>) get(page, "activity")) {
            Object id = get(row, "id");
            System.out.println(get(row, "created_at") + " " + get(row, "type") + " "
                + (id == null ? "(not kept)" : id) + ": " + get(row, "error", "code"));
        }
    }

    // The value at a path of names in read JSON, as get(answer, "error", "code").
    static Object get(Object json, String... path) {
        for (String name : path) {
            json = ((Map<?, ?>) json).get(name);
        }
        return json;
    }

    // Reads JSON into maps, lists, strings, doubles, booleans and null: Java
    // has no JSON parser built in, a real program would use a library.
    static class Json {
        final String text;
        int at = 0;

        Json(String text) {
            this.text = text;
        }

        static Object parse(String text) {
            return new Json(text).value();
        }

        // The next character that is not white space.
        char next() {
            while (Character.isWhitespace(text.charAt(at))) {
                at++;
            }
            return text.charAt(at++);
        }

        Object value() {
            char first = next();
            if (first == '{') {
                Map<String, Object> object = new LinkedHashMap<>();
                if (next() != '}') {
                    at--;
                    do {
                        String name = (String) value();
                        next(); // the colon
                        object.put(name, value());
                    } while (next() == ',');
                }
                return object;
            }
            if (first == '[') {
                List<Object> array = new ArrayList<>();
                if (next() != ']') {
                    at--;
                    do {
                        array.add(value());
                    } while (next() == ',');
                }
                return array;
            }
            if (first == '"') {
                StringBuilder string = new StringBuilder();
                for (char c = text.charAt(at++); c != '"'; c = text.charAt(at++)) {
                    if (c == '\\') {
                        c = text.charAt(at++);
                        if (c == 'u') {
                            c = (char) Integer.parseInt(text.substring(at, at + 4), 16);
                            at += 4;
                        } else if ("bfnrt".indexOf(c) >= 0) {
                            c = "\b\f\n\r\t".charAt("bfnrt".indexOf(c));
                        }
                    }
                    string.append(c);
                }
                return string.toString();
            }
            // a number, true, false or null
            int start = at - 1;
            while (at < text.length() && ",:]} \t\r\n".indexOf(text.charAt(at)) < 0) {
                at++;
            }
            String word = text.substring(start, at);
            if (word.equals("null")) {
                return null;
            }
            if (word.equals("true") || word.equals("false")) {
                return Boolean.valueOf(word);
            }
            return Double.valueOf(word);
        }
    }
}
```

```csharp
// The last failed jobs and sessions, and the summary: dotnet run --project activity
// (first dotnet new console -o activity, then put this in activity/Program.cs)
using System.Net.Http.Headers;
using System.Text.Json;

var url = "https://api.eu.vatis.tech/v1/activity?limit=10&status=failed";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VATIS_KEY"));

using var response = await http.GetAsync(url);
var page = JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;
if (!response.IsSuccessStatusCode)
{
    var error = page.GetProperty("error");
    var message = error.GetProperty("message");
    Console.Error.WriteLine($"{(int)response.StatusCode} {error.GetProperty("code")}: {message}");
    return 1;
}

var summary = page.GetProperty("summary"); // the whole workspace, not filtered
var running = summary.GetProperty("running");
var last24h = summary.GetProperty("last_24h");
var failed24h = summary.GetProperty("failed_24h");
Console.WriteLine($"open now: {running}; last 24 hours: {last24h}, {failed24h} failed");
foreach (var row in page.GetProperty("activity").EnumerateArray())
{
    var id = row.GetProperty("id");
    var shown = id.ValueKind == JsonValueKind.Null ? "(not kept)" : id.GetString();
    var type = row.GetProperty("type");
    var code = row.GetProperty("error").GetProperty("code");
    Console.WriteLine($"{row.GetProperty("created_at")} {type} {shown}: {code}");
}
return 0;
```

**Expected result** (curl without filters, trimmed to two rows):

```json
{"activity": [
   {"seq": 4186, "id": "sess_51d0c8e2f4a74b9e8c1d03a6f2b7e590", "type": "realtime", "status": "running", "kept": true,
    "created_at": "2026-11-12T09:21:40Z", "started_at": "2026-11-12T09:21:40Z", "ended_at": null, "deleted_at": null,
    "queued_s": null, "processing_s": null, "first_text_ms": null, "audio_s": null, "model_id": "vatis_ro_v9_realtime",
    "speakers": true, "channels": 1, "translation": null, "key": {"id": "key_7b21d0e4a9c3", "name": "crm-backend"},
    "error": null, "end": null},
   {"seq": 4182, "id": "tr_3b41a7db9aba4c10", "type": "batch", "status": "completed", "kept": true,
    "created_at": "2026-11-12T09:14:03Z", "started_at": "2026-11-12T09:14:04Z", "ended_at": "2026-11-12T09:14:36Z",
    "deleted_at": null, "queued_s": 0.842, "processing_s": 31.604, "first_text_ms": null, "audio_s": 741.2,
    "model_id": "vatis_ro_v9", "speakers": true, "channels": 1, "translation": null,
    "key": {"id": "key_7b21d0e4a9c3", "name": "crm-backend"}, "error": null, "end": null}],
 "total": 132, "offset": 0, "limit": 25,
 "summary": {"running": 1, "queued": 0, "last_24h": 87, "failed_24h": 3, "batch_speed_24h": 23.4,
             "types": {"batch": {"running": 0, "queued": 0, "last_24h": 40, "failed_24h": 2},
                       "realtime": {"running": 1, "queued": 0, "last_24h": 35, "failed_24h": 1}}},
 "keys": [{"id": "key_7b21d0e4a9c3", "name": "crm-backend"}],
 "retention_days": 7}
```

### The page and its summary

| Field | Meaning |
|---|---|
| `activity` | The rows: `running` and `queued` first, newest first, then the rest, newest first. |
| `total` | The rows that match the filters. |
| `offset` | As applied, with `limit`. |
| `summary` | The whole workspace (a Member key: its own), not filtered: `running` (files being transcribed and sessions open), `queued` (files waiting), `last_24h` (rows created in the last 24 hours), `failed_24h` (of those, failed), `batch_speed_24h`, and `types`: the same four counts for `batch` and `realtime`. |
| `batch_speed_24h` | How many times faster than real time the files completed in the last 24 hours were transcribed (the median of `audio_s / processing_s`, 1 decimal). `null` when there were none. |
| `keys` | The keys that appear in the record, `id` and `name`, by name. |
| `retention_days` | How long finished rows are kept, in days: 7, as transcripts are. |

### A row

Every row has every field, `null` where it does not apply.

| Field | Meaning |
|---|---|
| `seq` | The row's number, increasing. |
| `id` | The transcript's id (`tr_...`) or the session's (`sess_...`). `null` when not kept. |
| `type` | `batch` or `realtime`. |
| `status` | `queued` (a file waiting), `running`, `completed` or `failed`. |
| `kept` | `false`: sent with `store=false`. The row then shows only `seq`, `type`, `status`, the times and `error` or `end`. |
| `created_at` | When the file was accepted, or the session began. |
| `started_at` | When the file's transcription began (`null` while it waits); a session's `created_at`. |
| `ended_at` | When it ended; `null` while queued or running. |
| `deleted_at` | When a client deleted the transcript. |
| `queued_s` | A file: the seconds it waited, then `processing_s`, the seconds its transcription took. |
| `first_text_ms` | A session: the milliseconds from `session.started` to the first text sent, once it ended. |
| `audio_s` | A file: its length, once completed. A session: the audio received, once ended. |
| `model_id` | The model, then `speakers` (whether `diarize` was asked) and `channels` (2 with `multichannel`, else 1). |
| `translation` | Always `null` on the cloud. |
| `key` | The API key that sent it: `id` and `name`. |
| `error` | A failed row: `code` and `message`. |
| `end` | A row that did not fail but ended otherwise than plainly: `code` and `message`, for example `idle_timeout`, `session_time_limit`, `service_restart` or `deleted`. |

### What the record holds

- **Which work has a row:** every batch job the API accepted, waiting for the answer or not, and every live session that started. A connection refused before `session.started` (a wrong key or parameter, no free session) has none.
- **A row's life:** a batch job is `queued`, `running` once its transcription starts, then `completed` or `failed`. A session is `running` once it starts, then `completed` or `failed`.
- **Failed** means what Usage counts as failed, so the two agree. A session ended by the idle timeout, the time limit, a restart of the service or a refused message is `completed`, with `end`. A transcript deleted before its job ended is `completed` with `end` `deleted`.
- **No content:** a row holds no text, file name, URL, `metadata` or `client_reference`. Each `message` is a fixed sentence for its code, never words from your file or your client.
- **How long:** finished rows go after 7 days, with the transcripts. A deleted transcript's row stays, with `deleted_at`. Usage is kept apart and keeps everything.

## Who sees what

Keys belong to the workspace, and each has a role ([Authentication and API keys](https://platform.vatis.tech/docs/authentication)):

|  | Admin key | Member key |
|---|---|---|
| `GET /v1/usage` | the whole workspace, `scope` `all` | its own work, `scope` `key`, `peak_realtime_sessions` `null` |
| `GET /v1/activity` | every key's rows, summary and keys | its own rows, summary and key; another key's `key_id` is `403` `admin_only` |

## In the console

On [platform.vatis.tech](https://platform.vatis.tech/usage), the **Usage** page charts the same numbers by day or month and by key, and the **Activity** page lists the same rows, with their filters. What a person sees there follows their role in the workspace, as a key's role does here.

> **Usage and credit.** Usage is the audio your workspace transcribed. Its credit pays for that audio by the second; a workspace whose credit is used up is paused ([Limits and free credit](https://platform.vatis.tech/docs/limits)).

## Common errors

| Status and code | When | What to do |
|---|---|---|
| `400` `invalid_parameter` | Usage: a date that is not `YYYY-MM-DD`, `from` after `to`, a range too long, or another `group`. Activity: a `limit` outside 1 to 100, another `type` or `status`, an unknown `key_id`, or an `id` shorter than 3 characters. Or an unknown parameter. | Fix the parameter `param` names. |
| `401` `unauthorized` | No key, or a wrong, revoked or expired one. | Check the key. |
| `403` `admin_only` | A Member key asked for another key's rows (`key_id`). | Ask for your own rows, or use an Admin key. |

## Next steps

- [Limits and free credit](https://platform.vatis.tech/docs/limits): the free credit, the spend limit, and what pauses a workspace.
- [Errors](https://platform.vatis.tech/docs/errors): every code, and what to do about it.
- [All endpoints](https://platform.vatis.tech/docs/endpoints): every request the API takes.
