Skip to main content
GET
/
2
/
usage
Get API & WebSocket usage
curl --request GET \
  --url https://demo-api.mobula.io/api/2/usage
import requests

url = "https://demo-api.mobula.io/api/2/usage"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://demo-api.mobula.io/api/2/usage', 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://demo-api.mobula.io/api/2/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$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://demo-api.mobula.io/api/2/usage"

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

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://demo-api.mobula.io/api/2/usage")
.asString();
require 'uri'
require 'net/http'

url = URI("https://demo-api.mobula.io/api/2/usage")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "source": "api",
    "apiKey": "<string>",
    "from": "<string>",
    "to": "<string>",
    "finalizedThrough": "<string>",
    "nextCursor": "<string>",
    "totals": {
      "credits": 1,
      "requestCalls": 1
    },
    "rows": [
      {
        "timestamp": "<string>",
        "credits": 1,
        "requestCalls": 1,
        "metrics": {}
      }
    ]
  }
}
{
"success": false,
"error": "<string>"
}
{
"success": false,
"error": "<string>"
}
{
"success": false,
"error": "<string>"
}
Choose one source per call:
  • api — REST usage: credits, requestCalls, and per-endpoint metrics.
  • wss — WebSocket usage: events, with a per-service breakdown.
Provide apiKey and exactly one of customerId or organizationId — find these on your dashboard settings page. Rows are newest-first — paginate with nextCursor.

Query Parameters

source
enum<string>
required

api (REST credits/calls) or wss (WebSocket/webhook events). One per call. Which usage stream to return: api (REST credits/calls) or wss (websocket/webhook events). Required; only one per call.

Available options:
api,
wss
Example:

"api"

apiKey
string
required

API key to return usage for. Find your keys on the dashboard settings page (admin.mobula.io).

Minimum string length: 1
customerId
string

Verify the key belongs to this customer. Provide exactly one of customerId or organizationId.

Minimum string length: 1
organizationId
string

Verify the key belongs to this organization. Mutually exclusive with customerId.

Minimum string length: 1
from

Window start — epoch ms or ISO 8601. Defaults to to minus 30 days; must be within the last 12 months.

to

Window end — epoch ms or ISO 8601. Defaults to now; future values clamped to now.

limit
integer

Page size for rows (1–100, default 20).

cursor
string

Pagination cursor from a previous nextCursor. Rows are newest-first.

Response

Usage response.

success
enum<boolean>
required

True on success. Errors return { success: false, error }.

Available options:
true
data
object
required