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
]
}
'import requests
url = "https://api.magnific.com/v1/analytics/team-credit-usage"
payload = {
"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]
}
headers = {
"x-magnific-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-magnific-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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]
})
};
fetch('https://api.magnific.com/v1/analytics/team-credit-usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magnific.com/v1/analytics/team-credit-usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-magnific-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.magnific.com/v1/analytics/team-credit-usage"
payload := strings.NewReader("{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-magnific-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.magnific.com/v1/analytics/team-credit-usage")
.header("x-magnific-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magnific.com/v1/analytics/team-credit-usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-magnific-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"date": "2026-01-01T00:00:00.000Z",
"consumptions": [
{
"tool": "AI Image Models",
"tool_name": "pikaso-tti-flux-dev",
"user_uses": 45,
"user_credits": 1800,
"user_usages": [
{
"user_email": "designer@company.com",
"user_reference": "usr_a3f81c2d9e4b7f60",
"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_reference": "usr_5c09e7b21f8a43d6",
"user_uses": 15,
"user_credits": 600
}
]
},
{
"tool": "AI Image Models",
"tool_name": "pikaso-image-ai_image_generator-nano_banana_2",
"user_uses": 45,
"user_credits": 1800,
"user_usages": [
{
"user_email": "designer@company.com",
"user_reference": "usr_a3f81c2d9e4b7f60",
"user_uses": 45,
"user_credits": 1800
}
]
},
{
"tool": "AI Image Models",
"tool_name": "pikaso-image-ai_image_generator-nano_banana_2",
"user_uses": 120,
"user_credits": 4800,
"user_usages": [
{
"api_key_id": "d98b3edd-38c6-4f03-a9bd-da6eff110782",
"api_key_name": "prod-batch",
"user_email": null,
"user_uses": 120,
"user_credits": 4800
}
]
},
{
"tool": "Asset Download",
"tool_name": "magnific-premium-photo-download",
"user_uses": 14,
"user_credits": 1260,
"user_usages": [
{
"user_email": null,
"user_reference": "usr_7b1d4e0af62c9835",
"user_uses": 10,
"user_credits": 900
},
{
"user_email": null,
"user_reference": null,
"user_uses": 4,
"user_credits": 360
}
]
}
]
}
]
}Analytics API
Get team credit usage over time
Query your team AI credit consumption over time. Filter by group, project, or API key with day, week, month, or year granularity.
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
]
}
'import requests
url = "https://api.magnific.com/v1/analytics/team-credit-usage"
payload = {
"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]
}
headers = {
"x-magnific-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-magnific-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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]
})
};
fetch('https://api.magnific.com/v1/analytics/team-credit-usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magnific.com/v1/analytics/team-credit-usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-magnific-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.magnific.com/v1/analytics/team-credit-usage"
payload := strings.NewReader("{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-magnific-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.magnific.com/v1/analytics/team-credit-usage")
.header("x-magnific-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magnific.com/v1/analytics/team-credit-usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-magnific-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"granularity\": \"month\",\n \"start_date\": \"2026-01-01T00:00:00.000Z\",\n \"end_date\": \"2026-03-31T00:00:00.000Z\",\n \"project_references\": [\n \"a1b2c3d4-1111-4000-8000-000000000001\"\n ],\n \"api_key_ids\": [\n \"api-key-1\",\n \"api-key-2\"\n ],\n \"group_ids\": [\n 10,\n 20\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"date": "2026-01-01T00:00:00.000Z",
"consumptions": [
{
"tool": "AI Image Models",
"tool_name": "pikaso-tti-flux-dev",
"user_uses": 45,
"user_credits": 1800,
"user_usages": [
{
"user_email": "designer@company.com",
"user_reference": "usr_a3f81c2d9e4b7f60",
"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_reference": "usr_5c09e7b21f8a43d6",
"user_uses": 15,
"user_credits": 600
}
]
},
{
"tool": "AI Image Models",
"tool_name": "pikaso-image-ai_image_generator-nano_banana_2",
"user_uses": 45,
"user_credits": 1800,
"user_usages": [
{
"user_email": "designer@company.com",
"user_reference": "usr_a3f81c2d9e4b7f60",
"user_uses": 45,
"user_credits": 1800
}
]
},
{
"tool": "AI Image Models",
"tool_name": "pikaso-image-ai_image_generator-nano_banana_2",
"user_uses": 120,
"user_credits": 4800,
"user_usages": [
{
"api_key_id": "d98b3edd-38c6-4f03-a9bd-da6eff110782",
"api_key_name": "prod-batch",
"user_email": null,
"user_uses": 120,
"user_credits": 4800
}
]
},
{
"tool": "Asset Download",
"tool_name": "magnific-premium-photo-download",
"user_uses": 14,
"user_credits": 1260,
"user_usages": [
{
"user_email": null,
"user_reference": "usr_7b1d4e0af62c9835",
"user_uses": 10,
"user_credits": 900
},
{
"user_email": null,
"user_reference": null,
"user_uses": 4,
"user_credits": 360
}
]
}
]
}
]
}Authorizations
Your Magnific API key. Required for authentication. Learn how to obtain an API key
Body
application/json
Time bucket granularity for aggregation. Defaults to day if omitted.
Available options:
day, week, month, year Example:
"month"
Start date for the query range (YYYY-MM-DD). Defaults to 7 days ago.
Example:
"2026-01-01T00:00:00.000Z"
End date for the query range (YYYY-MM-DD). Defaults to today.
Example:
"2026-03-31T00:00:00.000Z"
Filter by specific project references.
Example:
["a1b2c3d4-1111-4000-8000-000000000001"]
Filter by specific API key IDs.
Example:
["api-key-1", "api-key-2"]
Filter by specific team group IDs. Members of these groups are included in the results.
Required range:
x >= 1Example:
[10, 20]
Response
OK
Show child attributes
Show child attributes
Was this page helpful?