API Reference Get Usage
Get Usage
This month's usage next to the organization's plan limits.
Session token
Returns an organization's usage this calendar month next to its plan limits — the numbers behind 402 USAGE_LIMIT_EXCEEDED (see Monthly Usage Limits).
Note
Requires a session JWT for any member of the organization. API keys are not accepted on billing endpoints. A non-member gets 403 forbidden ("Not a member of this organization"). Any plan.
Query Parameters
NameDescription
orgIdThe organization ID (a UUID). Missing or malformed, the request returns
400.Response
NameDescription
usage.buildsBuilds this calendar month.
usage.ai_queriesAI assistant queries this calendar month.
usage.pagesPages recorded this calendar month.
usage.projectsProjects the organization has now, not counting deleted ones. This is a current count, not a monthly total, and it is what the
limits.projects cap applies to.limitsThe plan's limits.
-1 means unlimited. An organization without a subscription gets the Free limits shown above.tierfree, starter, pro, or enterprise.Errors
| Status | Code | When |
|---|---|---|
| 400 | validation_error | orgId is missing or isn't a UUID |
| 401 | unauthorized | No session token, an invalid or expired one, or an API key |
| 403 | forbidden | You're not a member of the organization |
Was this page helpful? Yes No
Previous
Next
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl "https://api.syntext.dev/v1/billing/usage?orgId=$ORG_ID" \
-H "Authorization: Bearer $SYNTEXT_JWT"
// A browser has no environment variables: set these to your values.
const ORG_ID = '<ORG_ID>';
const SYNTEXT_JWT = '<SYNTEXT_JWT>';
const response = await fetch(`https://api.syntext.dev/v1/billing/usage?orgId=${ORG_ID}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${SYNTEXT_JWT}`,
},
});
const data = await response.json();
console.log(response.status, data);
import os
import requests
url = f"https://api.syntext.dev/v1/billing/usage?orgId={os.environ['ORG_ID']}"
headers = {
"Authorization": f"Bearer {os.environ['SYNTEXT_JWT']}",
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.syntext.dev/v1/billing/usage?orgId="+os.Getenv("ORG_ID"), nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SYNTEXT_JWT"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "net/http"
require "uri"
uri = URI("https://api.syntext.dev/v1/billing/usage?orgId=#{ENV.fetch("ORG_ID")}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("SYNTEXT_JWT")}"
response = http.request(request)
puts response.code
puts response.body
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.syntext.dev/v1/billing/usage?orgId=' . getenv('ORG_ID'),
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SYNTEXT_JWT'),
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.syntext.dev/v1/billing/usage?orgId=" + System.getenv("ORG_ID")))
.header("Authorization", "Bearer " + System.getenv("SYNTEXT_JWT"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.syntext.dev/v1/billing/usage?orgId=" + Environment.GetEnvironmentVariable("ORG_ID"));
request.Headers.TryAddWithoutValidation("Authorization", "Bearer " + Environment.GetEnvironmentVariable("SYNTEXT_JWT"));
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
json
{
"data": {
"usage": { "pages": 12, "builds": 37, "ai_queries": 140, "projects": 1 },
"limits": { "projects": 1, "pages": 50, "buildsPerMonth": 100, "aiQueries": 200, "members": 2 },
"tier": "free"
}
}