How to retrieve account spends using GraphQL

Hey there! From documentation it's really unclear how to retrieve e.g. my daily account spends using GraphQL. Documentation really lack info on how to structure queries which is especially confusing for someone not familiar with GraphQL (like me lol). Can you please help? Thanks!
1 Reply
Eren
Eren2mo ago
Hey Aleksei you can use this API call to return Daily Summary spends
curl --location 'https://api.runpod.io/graphql' \
\
--header 'Content-Type: application/json' \
\
--header 'Authorization: Bearer rpa_....' \
\
--data '{"query":"query getUserBillingSummary($input: UserBillingInput!) {\n myself {\n billing(input: $input) {\n summary {\n time\n gpuCloudAmount\n cpuCloudAmount\n runpodEndpointAmount\n serverlessAmount\n storageAmount\n __typename\n }\n __typename\n }\n __typename\n }\n}","variables":{"input":{"granularity":"DAILY"}}}' \
curl --location 'https://api.runpod.io/graphql' \
\
--header 'Content-Type: application/json' \
\
--header 'Authorization: Bearer rpa_....' \
\
--data '{"query":"query getUserBillingSummary($input: UserBillingInput!) {\n myself {\n billing(input: $input) {\n summary {\n time\n gpuCloudAmount\n cpuCloudAmount\n runpodEndpointAmount\n serverlessAmount\n storageAmount\n __typename\n }\n __typename\n }\n __typename\n }\n}","variables":{"input":{"granularity":"DAILY"}}}' \
Returns this:
{
"data": {
"myself": {
"billing": {
"summary": [
{
"time": "2025-02-08T00:00:00.000Z",
"gpuCloudAmount": X,
"cpuCloudAmount": X,
"runpodEndpointAmount": X,
"serverlessAmount": XX.XXXXXXXXXXXXXXXX,
"storageAmount": XX.XXXXXXXXXXXXXXXX,
"__typename": "UserSummaryBilling"
},
...
{
"data": {
"myself": {
"billing": {
"summary": [
{
"time": "2025-02-08T00:00:00.000Z",
"gpuCloudAmount": X,
"cpuCloudAmount": X,
"runpodEndpointAmount": X,
"serverlessAmount": XX.XXXXXXXXXXXXXXXX,
"storageAmount": XX.XXXXXXXXXXXXXXXX,
"__typename": "UserSummaryBilling"
},
...

Did you find this page helpful?