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

# Plan and usage

GET /billing/usage

This workspace's plan, its usage this period, and whether we are delivering
conversions to its destinations.

Reference: https://docs.pivolio.com/api-reference/pivolio/billing/get-usage

## Authentication

- `X-Workspace-Id` header (required) — API Key authentication via header

## Response

### 200

Successful Response

- `plan` (enum, required, nullable) — A workspace's pricing tier. There is no Free tier: an unsubscribed workspace has no subscription row at all, and its events are tracked and reported but never dispatched.
  - Allowed values: `starter`, `growth`, `scale`
- `status` (enum, required, nullable) — Lifecycle state of a workspace subscription. A Free workspace's row is ``active`` with no provider subscription.
  - Allowed values: `trialing`, `active`, `past_due`, `canceled`
- `billing_interval` (enum, required, nullable) — A subscription's billing cadence.
  - Allowed values: `month`, `year`
- `usage` (integer, required, nullable)
- `cap` (integer, required, nullable)
- `percent` (double, required, nullable)
- `dispatching` (boolean, required)
- `auto_upgrade` (boolean, required)
- `current_period_end` (datetime, required, nullable)
- `trial_end` (datetime, required, nullable)
- `cancel_at_period_end` (boolean, required)
- `pending_plan` (enum, required, nullable) — A workspace's pricing tier. There is no Free tier: an unsubscribed workspace has no subscription row at all, and its events are tracked and reported but never dispatched.
  - Allowed values: `starter`, `growth`, `scale`
- `pending_interval` (enum, required, nullable) — A subscription's billing cadence.
  - Allowed values: `month`, `year`
- `pending_downgrade_at` (datetime, required, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (string, required)
- `code` (string, required)
- `errors` (list of FieldError, optional, nullable)

## Types

### FieldError

- `field` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "plan": "growth",
  "status": "active",
  "billing_interval": "month",
  "usage": 12500,
  "cap": 50000,
  "percent": 25,
  "dispatching": true,
  "auto_upgrade": false,
  "current_period_end": "2024-07-31T23:59:59Z",
  "trial_end": null,
  "cancel_at_period_end": false,
  "pending_plan": null,
  "pending_interval": null,
  "pending_downgrade_at": null
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/billing/usage"

payload = {}
headers = {
    "X-Workspace-Id": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/billing/usage';
const options = {
  method: 'GET',
  headers: {'X-Workspace-Id': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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

```go
package main

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

func main() {

	url := "https://api.example.com/billing/usage"

	payload := strings.NewReader("{}")

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

	req.Header.Add("X-Workspace-Id", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/billing/usage")

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

request = Net::HTTP::Get.new(url)
request["X-Workspace-Id"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/billing/usage")
  .header("X-Workspace-Id", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/billing/usage', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Workspace-Id' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/billing/usage");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Workspace-Id", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Workspace-Id": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/billing/usage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```