Usage

Get Account usage and gross ledger cost

Changed on

Returns usage-ledger consumption and gross cost from the same provider used by Replit's Usage settings page. Omit workspaceId, groupId, userId, and projectId for Account-wide totals. Filters are intersected when combined.

groupId requires workspaceId and filters usage to users who are active group members when the request is processed. Deleted or disabled memberships, deleted users, and support seats are excluded. An explicit userId is intersected with current group membership. Users can belong to multiple groups, so totals from separate group requests are not additive. Ungrouped and unattributed usage is excluded from group-filtered requests. groupId supports totals, groupBy=member, groupBy=project, groupBy=conversations, and groupBy=timeseries; it cannot be combined with groupBy=workspace. The response does not repeat the group ID or expose group names or internal Account identifiers.

Example: GET /v1/usage?workspaceId=workspace123&groupId=groupEngineering&groupBy=member

Omit all range parameters for the current billing period. billingPeriod cannot be combined with startTime or endTime. Custom ranges require both startTime and endTime, use inclusive start and exclusive end boundaries, and cannot exceed 366 days. groupBy adds one breakdown; granularity is valid only with groupBy=timeseries. groupBy=member includes every selected metric type and is not limited to Agent usage. With groupBy=project, breakdownBy=member adds a complete member breakdown and explicit unattributed-member metrics to every selected project. Pagination counts projects, and members are ordered by descending cost with userId as the tie-breaker. Requests without breakdownBy retain the existing response shape. Example: GET /v1/usage?groupBy=project&breakdownBy=member&limit=100 Breakdown responses are limited to 10,000 project/member/metric detail rows and 8 MiB of JSON. A result exceeding these bounds returns 422 usage_breakdown_too_large without partial data. Reduce limit, narrow the interval, or apply filters to retry. A cursor can be retried with a smaller limit; adding or removing breakdownBy invalidates the cursor. groupBy=conversations returns one environmentType=conversation group. attributableTotalCostUsd is conversation spend, and unattributableTotalCostUsd is all remaining spend for the selected filters.

Recent usage can arrive after a response. Costs are gross usage-ledger values, not settled invoice totals. Account credits, discounts, and net charges are intentionally excluded.

get/usage

Request

  • Base URL
    https://api.replit.com/v1
  • Auth
    HTTP bearer

Query parameters

workspaceIdstring

Restrict results to a workspace owned by the authenticated Account.

groupIdstring

Restrict usage to the current active members of one group in workspaceId. Group membership is evaluated when each request is processed.

userIdstring

Restrict results to usage attributed to a Replit user ID. Omit to include all users in the selected Account or workspace scope.

projectIdstring

Restrict results to usage attributed to a Replit project ID.

billingPeriod'current' | 'previous'

Select the current or previous billing period. Defaults to current when no custom range is supplied. Cannot be combined with startTime or endTime.

startTimestring date-time

Inclusive custom UTC interval boundary. Requires endTime.

endTimestring date-time

Exclusive custom UTC interval boundary. Requires startTime.

typestring[]

Restrict totals, metrics, and groups to one or more cataloged public metric identifiers. Repeat the parameter to select multiple values.

groupBy'workspace' | 'member' | 'project' | 'conversations' | 'timeseries'

Add one breakdown dimension. Omit for totals only. Member grouping includes every selected metric type and is not limited to Agent usage. Conversation grouping returns one group for usage attributed to conversations.

breakdownBy'member'

Adds a complete member breakdown to each project. Only valid with groupBy=project. Pagination still counts projects. Supply at most once.

granularity'day'

Time bucket width for groupBy=timeseries. Day is the only Alpha value.

limitinteger

Maximum groups to return. Ignored when groupBy is omitted.

cursorstring

Opaque groups cursor from the previous response. Reusing it with different filters returns invalid_request.

Response

Usage summary.

Changes

    • warning

      added the new sandbox_compute enum value to the //////// response property for the response status

    • warning

      added the new sandbox_compute enum value to the ////// response property for the response status

    • warning

      added the new sandbox_compute enum value to the ///// response property for the response status

    • warning

      added the new sandbox_compute enum value to the /// response property for the response status

    • info

      added the enum value sandbox_compute to the property items/ of the query request parameter type

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • warning

      added the new usage_breakdown_too_large enum value to the / response property for the response status

    • info

      added the new optional query request parameter breakdownBy

    • info

      added the non-success response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property /// to the response with the status