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

# Get usage

GET https://api-chat.parstechai.com/v1/usage

Reports message and conversation activity per robot over a window.

Returns every robot on your account by default. Pass `robot_id` to narrow it to one. Page with `limit` and `offset`: `pagination.total_count` tells you how many robots match, so you know how many calls to make before you start.

`messages.total` and `messages.units` are not the same number. A robot on the enhanced-accuracy model consumes two units per message, so reconcile billing against `units` and show `total` to your customer as a message count.

The window defaults to the last 30 days and may not span more than a year.

**Pre-release:** `breakdown=source` splits Instagram traffic by entry point. It adds fields rather than replacing them, so one parser handles both shapes. It is not callable yet; passing it today returns the standard payload.

This reports activity, not the account's remaining balance.

Figures are cached rather than recomputed per request, so a very recent conversation may not be counted yet. `metadata.processed_at` is the moment the figures are accurate as of.

Reference: https://docs-parschat.parstechai.com/api-reference/usage/list-usage

## Authentication

- `Authorization` header (bearer token, required) — Your API key, issued by ParsChat sales. One key per account, spanning every robot you own. Send it as `Authorization: Bearer pk_live_…`.

## Request

### Query parameters

- `from` (datetime, required) — Start of the reporting window, inclusive. RFC 3339.
- `to` (datetime, required) — End of the reporting window, inclusive. RFC 3339.
- `robot_id` (string, optional) — Report on one robot instead of all of them.
- `breakdown` (enum, optional) — Pass `source` to split the totals by entry point: direct, comment, story_reply, story_mention, reel.
  - Allowed values: `source`
- `limit` (integer, optional, default: 50) — How many items to return per page.
- `offset` (integer, optional, default: 0) — How many records to skip. Use `offset = page * limit`, and `total_count` from the response to know when to stop.

## Response

### 200

A page of per-robot usage.

- `window` (UsageListWindow, optional) — The period reported, echoing your query. Defaults to the last 30 days; may not span more than a year.
- `data` (list of Usage, optional) — One entry per robot in the window.
- `pagination` (Pagination, optional) — Offset pagination. `total_count` tells you how many records match, so you know how many pages to fetch before you start.
- `metadata` (UsageMetadata, optional) — How fresh these figures are.

## Errors

### 400 Bad Request Error

The request itself is malformed: a parameter is missing, unparseable, or out of range. Unlike 422, the request never reached validation of its contents.

- `error` (ErrorError, optional)

### 401 Unauthorized Error

The key is missing, wrong, revoked, or past its expiry date. All four answer `invalid_key`: telling an expired key from an unknown one would confirm to whoever holds a leaked key that it was once real.

- `error` (ErrorError, optional)

### 403 Forbidden Error

The call is understood but not permitted: a missing role, a lapsed plan, or exhausted capacity.

- `error` (ErrorError, optional)

### 404 Not Found Error

No such resource, or it belongs to another partner. We return 404 rather than 403 here, because a 403 would confirm the id exists.

- `error` (ErrorError, optional)

### 422 Unprocessable Entity Error

The payload is malformed, or a prerequisite is not configured.

- `error` (ErrorError, optional)

### 429 Too Many Requests Error

You are calling the API too fast. `details` names the limit you are held to. This never means an automated reply to an end customer was discarded: those are queued, not dropped.

- `error` (ErrorError, optional)

### 500 Internal Server Error

Something failed on our side. Retry with backoff, and quote `request_id` if it persists.

- `error` (ErrorError, optional)

### 503 Service Unavailable Error

A service we depend on (a channel provider, or our AI service) is unavailable. Retry with backoff.

- `error` (ErrorError, optional)

## Types

### UsageListWindow

The period reported, echoing your query. Defaults to the last 30 days; may not span more than a year.

- `from` (datetime, optional) — Start of the window, inclusive.
- `to` (datetime, optional) — End of the window, inclusive.

### Usage

Activity for one robot over a window. This reports what the robot did, not the account's remaining balance.

- `robot_id` (string, optional) — The robot this report covers.
- `external_id` (string, optional, nullable) — Your own identifier for the robot. `null` until robot creation over the API ships, so today every robot returns null here.
- `name` (string, optional) — The robot's name, for display in your own panel.
- `messages` (UsageMessages, optional) — Message counts for the window.
- `conversations` (UsageConversations, optional) — Conversation counts for the window.
- `channels_connected` (integer, optional) — Channels connected to this robot right now. Not windowed, so it matches what you see on the robot itself.
- `channel` (string, optional) — The channel the breakdown covers. Present only with `breakdown=source`.
- `by_source` (map from string to UsageBySource, optional) — Present only when you pass `breakdown=source`. Keyed by entry point: `direct`, `comment`, `story_reply`, `story_mention`, `reel`.
- `totals` (UsageTotals, optional) — Sum across every source. Present only with `breakdown=source`.

### Pagination

Offset pagination. `total_count` tells you how many records match, so you know how many pages to fetch before you start.

- `limit` (integer, optional) — How many items were requested per page.
- `offset` (integer, optional) — How many items were skipped to reach this page.
- `total_count` (integer, optional) — Total records matching the query, across every page. Divide by `limit` to get the number of calls you need.
- `has_more` (boolean, optional) — Whether another page exists after this one.

### UsageMetadata

How fresh these figures are.

- `processed_at` (datetime, optional) — The moment these figures were computed. Usage is cached, so on a cache hit this is deliberately older than now -- that gap is how you judge staleness.
- `cache_hit` (boolean, optional) — Whether these figures were served from cache rather than recomputed.

### ErrorError

- `code` (string, optional) — Stable machine-readable code. Branch on this, not on the message.
- `message` (string, optional) — Human-readable explanation. Wording may change.
- `request_id` (string, optional) — Log this. It is what lets support find your exact request.
- `details` (map from string to any, optional) — Machine-readable context for the code. On `capacity_exhausted` it carries `occupied`, `requested` and `capacity`; on `rate_limited`, `limit_per_minute` and `window_seconds`.

### UsageMessages

Message counts for the window.

- `total` (integer, optional) — All messages, in both directions.
- `units` (double, optional) — Units those messages consumed. Not the same as `total`: a robot on the enhanced-accuracy model consumes two units per message. Reconcile billing against this.
- `by_role` (UsageMessagesByRole, optional) — Who sent them. This is what separates AI answers from human ones.

### UsageConversations

Conversation counts for the window.

- `total` (integer, optional) — Conversations with at least one message.

### UsageBySource

- `conversations` (integer, optional) — Conversations that started at this entry point.
- `messages` (integer, optional) — Messages exchanged in them.

### UsageTotals

Sum across every source. Present only with `breakdown=source`.

- `conversations` (integer, optional) — All conversations in the window.
- `messages` (integer, optional) — All messages in the window.

### UsageMessagesByRole

Who sent them. This is what separates AI answers from human ones.

- `client` (integer, optional) — Sent by the end customer.
- `ai` (integer, optional) — Sent by the AI.
- `operator` (integer, optional) — Sent by a human operator.

## Examples

### Every robot

**Response**

```json
{
  "window": {
    "from": "2026-09-01T00:00:00Z",
    "to": "2026-09-30T23:59:59Z"
  },
  "data": [
    {
      "robot_id": "a3f9c21b4e7d40a8",
      "external_id": "shop_10422",
      "name": "Rose Flower Shop",
      "messages": {
        "total": 1840,
        "units": 1840,
        "by_role": {
          "client": 900,
          "ai": 820,
          "operator": 120
        }
      },
      "conversations": {
        "total": 312
      },
      "channels_connected": 1
    },
    {
      "robot_id": "b7e2d98f1c6a45b3",
      "external_id": "shop_10423",
      "name": "Cedar Coffee",
      "messages": {
        "total": 210,
        "units": 420,
        "by_role": {
          "client": 120,
          "ai": 80,
          "operator": 10
        }
      },
      "conversations": {
        "total": 44
      },
      "channels_connected": 1
    }
  ],
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total_count": 128,
    "has_more": true
  },
  "metadata": {
    "processed_at": "2026-10-01T09:15:22Z",
    "cache_hit": false
  }
}
```

**SDK Code**

```python Every robot
import requests

url = "https://api-chat.parstechai.com/v1/usage"

querystring = {"from":"2026-09-01T00:00:00Z","robot_id":"a3f9c21b4e7d40a8","to":"2026-09-30T23:59:59Z"}

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

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

print(response.json())
```

```javascript Every robot
const url = 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z';
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 Every robot
package main

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

func main() {

	url := "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z"

	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 Every robot
require 'uri'
require 'net/http'

url = URI("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")

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 Every robot
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Every robot
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Every robot
using RestSharp;

var client = new RestClient("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Every robot
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")! 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()
```

### robot_id=rbt_8fK2mQ

**Response**

```json
{
  "window": {
    "from": "2026-09-01T00:00:00Z",
    "to": "2026-09-30T23:59:59Z"
  },
  "data": [
    {
      "robot_id": "a3f9c21b4e7d40a8",
      "external_id": "shop_10422",
      "name": "Rose Flower Shop",
      "messages": {
        "total": 1840,
        "units": 1840,
        "by_role": {
          "client": 900,
          "ai": 820,
          "operator": 120
        }
      },
      "conversations": {
        "total": 312
      },
      "channels_connected": 1
    }
  ],
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total_count": 1,
    "has_more": false
  },
  "metadata": {
    "processed_at": "2026-10-01T09:15:22Z",
    "cache_hit": false
  }
}
```

**SDK Code**

```python robot_id=rbt_8fK2mQ
import requests

url = "https://api-chat.parstechai.com/v1/usage"

querystring = {"from":"2026-09-01T00:00:00Z","robot_id":"a3f9c21b4e7d40a8","to":"2026-09-30T23:59:59Z"}

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

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

print(response.json())
```

```javascript robot_id=rbt_8fK2mQ
const url = 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z';
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 robot_id=rbt_8fK2mQ
package main

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

func main() {

	url := "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z"

	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 robot_id=rbt_8fK2mQ
require 'uri'
require 'net/http'

url = URI("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")

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 robot_id=rbt_8fK2mQ
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php robot_id=rbt_8fK2mQ
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp robot_id=rbt_8fK2mQ
using RestSharp;

var client = new RestClient("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift robot_id=rbt_8fK2mQ
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")! 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()
```

### breakdown=source

**Response**

```json
{
  "window": {
    "from": "2026-09-01T00:00:00Z",
    "to": "2026-09-30T23:59:59Z"
  },
  "data": [
    {
      "robot_id": "a3f9c21b4e7d40a8",
      "external_id": "shop_10422",
      "name": "Rose Flower Shop",
      "messages": {
        "total": 1840,
        "units": 1840,
        "by_role": {
          "client": 900,
          "ai": 820,
          "operator": 120
        }
      },
      "conversations": {
        "total": 312
      },
      "channels_connected": 1,
      "channel": "instagram",
      "by_source": {
        "comment": {
          "conversations": 84,
          "messages": 310
        },
        "direct": {
          "conversations": 180,
          "messages": 1120
        },
        "story_mention": {
          "conversations": 12,
          "messages": 120
        },
        "story_reply": {
          "conversations": 36,
          "messages": 290
        }
      },
      "totals": {
        "conversations": 312,
        "messages": 1840
      }
    }
  ],
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total_count": 1,
    "has_more": false
  },
  "metadata": {
    "processed_at": "2026-10-01T09:15:22Z",
    "cache_hit": false
  }
}
```

**SDK Code**

```python breakdown=source
import requests

url = "https://api-chat.parstechai.com/v1/usage"

querystring = {"from":"2026-09-01T00:00:00Z","robot_id":"a3f9c21b4e7d40a8","to":"2026-09-30T23:59:59Z"}

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

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

print(response.json())
```

```javascript breakdown=source
const url = 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z';
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 breakdown=source
package main

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

func main() {

	url := "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z"

	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 breakdown=source
require 'uri'
require 'net/http'

url = URI("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")

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 breakdown=source
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php breakdown=source
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp breakdown=source
using RestSharp;

var client = new RestClient("https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift breakdown=source
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-chat.parstechai.com/v1/usage?from=2026-09-01T00%3A00%3A00Z&robot_id=a3f9c21b4e7d40a8&to=2026-09-30T23%3A59%3A59Z")! 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()
```