Skip to main content
POST
/
v1
/
analytics
/
team-credit-usage
Get team credit usage over time
curl --request POST \
  --url https://api.magnific.com/v1/analytics/team-credit-usage \
  --header 'Content-Type: application/json' \
  --header 'x-magnific-api-key: <api-key>' \
  --data '
{
  "granularity": "month",
  "start_date": "2026-01-01T00:00:00.000Z",
  "end_date": "2026-03-31T00:00:00.000Z",
  "project_references": [
    "a1b2c3d4-1111-4000-8000-000000000001"
  ],
  "api_key_ids": [
    "api-key-1",
    "api-key-2"
  ],
  "group_ids": [
    10,
    20
  ]
}
'
{
  "data": [
    {
      "date": "2026-01-01T00:00:00.000Z",
      "consumptions": [
        {
          "tool": "AI Image Models",
          "user_uses": 45,
          "user_credits": 1800,
          "user_usages": [
            {
              "user_email": "designer@company.com",
              "user_uses": 30,
              "user_credits": 1200,
              "project_reference": "a1b2c3d4-1111-4000-8000-000000000001",
              "project_name": "Marketing Campaign",
              "group_name": "Design Team"
            },
            {
              "user_email": "developer@company.com",
              "user_uses": 15,
              "user_credits": 600
            }
          ]
        },
        {
          "tool": "Asset Download",
          "user_uses": 10,
          "user_credits": 900
        }
      ]
    }
  ]
}

Authorizations

x-magnific-api-key
string
header
required

Your Magnific API key. Required for authentication. Learn how to obtain an API key

Body

application/json
granularity
enum<string>
default:day

Time bucket granularity for aggregation. Defaults to day if omitted.

Available options:
day,
week,
month,
year
Example:

"month"

start_date
string<date>

Start date for the query range (YYYY-MM-DD). Defaults to 7 days ago.

Example:

"2026-01-01T00:00:00.000Z"

end_date
string<date>

End date for the query range (YYYY-MM-DD). Defaults to today.

Example:

"2026-03-31T00:00:00.000Z"

project_references
string<uuid>[]

Filter by specific project references.

Example:
["a1b2c3d4-1111-4000-8000-000000000001"]
api_key_ids
string[]

Filter by specific API key IDs.

Example:
["api-key-1", "api-key-2"]
group_ids
integer[]

Filter by specific team group IDs. Members of these groups are included in the results.

Required range: x >= 1
Example:
[10, 20]

Response

OK

data
object[]