Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/analytics/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,27 @@ export END_DATE="2025-12-31"
curl -X GET "https://analytics.sourcegraph.com/api/reports/by-user-client-date?instanceURL=$INSTANCE_URL&startDate=$START_DATE&endDate=$END_DATE" \
-H "Authorization: Bearer $ACCESS_TOKEN"
```

### Credit buckets

The credits API endpoint provides access to credit bucket allocations and consumption for your instance. To retrieve this data, run the following commands:

```sh
export INSTANCE_URL="<INSTANCE_URL>" # e.g. example.sourcegraphcloud.com

curl -X GET "https://analytics.sourcegraph.com/api/credits?instanceURL=$INSTANCE_URL" \
-H "Authorization: Bearer $ACCESS_TOKEN"
```

Optional `startDate` and `endDate` values (formatted as `YYYY-MM-DD`) can be specified to filter buckets by their active period. Both parameters are optional. If neither is specified, all buckets are returned.

Example:

```sh
export INSTANCE_URL="<INSTANCE_URL>" # e.g. example.sourcegraphcloud.com
export START_DATE="2026-05-01"
export END_DATE="2026-12-31"

curl -X GET "https://analytics.sourcegraph.com/api/credits?instanceURL=$INSTANCE_URL&startDate=$START_DATE&endDate=$END_DATE" \
-H "Authorization: Bearer $ACCESS_TOKEN"
```