Skip to main content
GET
/
api
/
admins
/
credits
/
events
cURL
curl --request GET \
  --url https://api.recoupable.com/api/admins/credits/events \
  --header 'x-api-key: <api-key>'
import requests

url = "https://api.recoupable.com/api/admins/credits/events"

headers = {"x-api-key": "<api-key>"}

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

print(response.text)
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://api.recoupable.com/api/admins/credits/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.recoupable.com/api/admins/credits/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.recoupable.com/api/admins/credits/events"

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

req.Header.Add("x-api-key", "<api-key>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.recoupable.com/api/admins/credits/events")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.recoupable.com/api/admins/credits/events")

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "page": 2,
  "limit": 2,
  "total_count": 1,
  "events": [
    {
      "id": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "input_tokens": 123,
      "cached_input_tokens": 123,
      "output_tokens": 123,
      "tool_call_count": 123,
      "credits_deducted_cents": 123,
      "provider": "<string>",
      "model_id": "<string>"
    }
  ],
  "error": "<string>"
}
{
"status": "error",
"message": "<string>"
}
{
"status": "error",
"message": "<string>"
}

Authorizations

x-api-key
string
header
required

Your Recoup API key. Learn more.

Query Parameters

account_id
string<uuid>
required

UUID of the account whose usage_events rows to return.

period
enum<string>
default:monthly

Window to filter created_at against. Same semantics as the rollup endpoint. Defaults to monthly.

Available options:
all,
daily,
weekly,
monthly
limit
integer
default:100

Page size — number of events to return per request, sorted by created_at descending. Defaults to 100; max 500.

Required range: 1 <= x <= 500
page
integer
default:1

1-indexed page number. Server returns rows (page - 1) * limit through page * limit - 1. Defaults to 1. Use total_count in the response to drive a 'load more' control on the drilldown (page * limit < total_count).

Required range: x >= 1

Response

Usage events retrieved successfully

status
enum<string>
required

Status of the request

Available options:
success,
error
account_id
string<uuid>
required

UUID of the account whose events were returned (echoes the request)

period
enum<string>
required

The period the response was filtered to (echoes the request)

Available options:
all,
daily,
weekly,
monthly
page
integer
required

1-indexed page returned (echoes the request, or 1 if omitted)

Required range: x >= 1
limit
integer
required

Page size used for this response (echoes the request, or the default if omitted)

Required range: x >= 1
total_count
integer
required

Total number of usage_events rows for this account in the selected period (i.e. the size of the full result set before pagination). The client derives has_more as page * limit < total_count and shows 'X of Y events'. Computed via a COUNT(*) query alongside the paginated row fetch.

Required range: x >= 0
events
object[]
required

Raw usage_events rows, sorted by created_at descending

error
string

Error message (only present if status is 'error')