From 7ffed587593e8488f4e15a4ae173e9614fb883ca Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Fri, 1 May 2026 11:59:02 -0400 Subject: [PATCH 1/2] Update api.mdx --- docs/analytics/api.mdx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/analytics/api.mdx b/docs/analytics/api.mdx index cd886d311..f56fc254a 100644 --- a/docs/analytics/api.mdx +++ b/docs/analytics/api.mdx @@ -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="" # 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="" # e.g. example.sourcegraphcloud.com +export START_DATE="2025-01-01" +export END_DATE="2025-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" +``` From f618520a2ae0f38cc3c61910ac1037eba282890a Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Fri, 1 May 2026 12:11:06 -0400 Subject: [PATCH 2/2] update dates --- docs/analytics/api.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/analytics/api.mdx b/docs/analytics/api.mdx index f56fc254a..ae19db78b 100644 --- a/docs/analytics/api.mdx +++ b/docs/analytics/api.mdx @@ -74,8 +74,8 @@ Example: ```sh export INSTANCE_URL="" # e.g. example.sourcegraphcloud.com -export START_DATE="2025-01-01" -export END_DATE="2025-12-31" +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"