GoliathDevelopersGet an API key
Reference/Teamgenerated from the gateway manifest

getTeamCallStats

Per-member CALL COUNTS AND TALK TIME in a time window.

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

Per-member CALL COUNTS AND TALK TIME in a time window: one call, exact, live (not a nightly snapshot). The answer to "break down team talk time this week" and "who made the most calls". WINDOW: startDate (inclusive) and endDate (exclusive) as ISO datetimes WITH an offset: resolve "this week"/"since 9/28" in the USER's timezone yourself (getMyProfile.resolvedTimezone, or the organization timezone) before calling. At most 93 calendar days; a wider window is REFUSED with a message. WHAT IS COUNTED, per member, over the organization's calls created in the window and handled by that member: outboundCalls and inboundCalls (every status, missed and unanswered included); connectedCalls = status COMPLETED, the same "connects" the team analytics pages count as completedCalls; conversationCalls = connected AND (lasted at least 120 seconds, or a transcript or AI summary exists), team analytics' conversationCalls; talkSeconds = summed duration of the connected calls (a connected call with no recorded duration adds 0): divide by 60 or 3600 yourself. A call an AI EMPLOYEE handled is not counted for any member, even when it carries one (a screened call the AI took over), and calls with no member at all (imported dialer history) are not counted: so these are human calling numbers, and can be lower than the analytics pages, which credit AI-handled calls to the member. byUser is ranked by talkSeconds (name null when the user is gone); totals sums the rows. On an org-wide read only members with at least one call appear; every member you NAME in userIds appears (zeros included). VISIBILITY (the inbox rule): with no userIds, a key owner who may read teammates (VIEW_TEAM_CALLS_TEXTS or VIEW_ALL_PHONES; admins) gets every member; anyone else gets ONLY THEIR OWN row: say so rather than presenting it as the team. Naming a teammate in userIds without either is REFUSED (an error, not zeros). getMyCapabilities says which the key owner holds. Teammate ids come from listTeammates.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getTeamCallStats",
    "variables": {
      "startDate": "2026-01-01T00:00:00.000Z",
      "endDate": "2026-01-01T00:00:00.000Z"
    }
  }'
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.team.getTeamCallStats({
  startDate: '2026-01-01T00:00:00.000Z',
  endDate: '2026-01-01T00:00:00.000Z'
})
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: 'getTeamCallStats',
    variables: {
      startDate: '2026-01-01T00:00:00.000Z',
      endDate: '2026-01-01T00:00:00.000Z'
    }
  }),
})
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.

startDateDateTime!required
endDateDateTime!required
userIds[ID!]

Response

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

response shape
{
  "data": {
    "teamAnalyticsQuery": {
      "callStats": {
        "startDate": "2026-01-01T00:00:00.000Z",
        "endDate": "2026-01-01T00:00:00.000Z",
        "totals": {
          "outboundCalls": 0,
          "inboundCalls": 0,
          "connectedCalls": 0,
          "conversationCalls": 0,
          "talkSeconds": 0
        },
        "byUser": [
          {
            "userId": "<ID>",
            "name": "…",
            "outboundCalls": 0,
            "inboundCalls": 0,
            "connectedCalls": 0,
            "conversationCalls": 0,
            "talkSeconds": 0
          }
        ]
      }
    }
  }
}

Errors

Behaviour

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