GoliathDevelopersGet an API key
Reference/Billinggenerated from the gateway manifest

getCreditUsageByType

What used the credits this billing period, per credit type.

POST/api/v1/callADMINreadruns as the key's owner
View as Markdown

What used the credits this billing period, per credit type: series[].totalUnits for AI_CREDITS, SMS_CREDITS (outbound text segments), CALLING_MINUTES, SKIPTRACE, EMAIL_VERIFICATION and EXPORT_PROPERTIES, the Billing page usage chart's own figures (each day's use, charges less that day's refunds, summed). Pass timeZone (getMyProfile.resolvedTimezone) so the days fall as the person's chart draws them; omitted, they are UTC days. A refund that lands a day after its charge is not netted, so a total can exceed getBillingSummary's planUsage.usedThisPeriod; quote this one as what used the credits, that one as what is left. Null before a first billing period. AI use is not split further (no per-employee figure). Read-only. Admin only: a Member is told a workspace admin sees it.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getCreditUsageByType",
    "variables": {}
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.billing.getCreditUsageByType({})
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    operationId: 'getCreditUsageByType',
    variables: {}
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

timeZoneString

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "subscriptionQuery": {
      "dailyCreditUsage": {
        "periodStart": "2026-01-01T00:00:00.000Z",
        "periodEnd": "2026-01-01T00:00:00.000Z",
        "series": [
          {
            "creditType": "EXPORT_PROPERTIES",
            "totalUnits": 0
          }
        ]
      }
    }
  }
}

Errors

Behaviour

A read. It rejects an Idempotency-Key header with 400 bad_request.