Skip to main content
GET
/
royalty
/
crosstab
Get a month/quarter x dimension crosstab
curl --request GET \
  --url https://api.royalti.io/royalty/crosstab \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.royalti.io/royalty/crosstab"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.royalti.io/royalty/crosstab', 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.royalti.io/royalty/crosstab",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.royalti.io/royalty/crosstab"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.royalti.io/royalty/crosstab")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.royalti.io/royalty/crosstab")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "dimension": "country",
  "granularity": "month",
  "topN": 8,
  "autoRolledUp": false,
  "results": [
    {
      "Month": "2026-05-01",
      "Country": "United States",
      "Royalty": 3256.75,
      "Count": 325000
    },
    {
      "Month": "2026-05-01",
      "Country": "Other",
      "Royalty": 512.4,
      "Count": 51000
    }
  ]
}
{
"status": "error",
"message": "Unauthorized"
}
{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Get a month/quarter x dimension crosstab Buckets royalty and count by time period (month or quarter) crossed with a dimension (country, sale type, or DSP), keeping the top-N dimension values and folding the remainder into an “Other” bucket. Authorization:
  • Required role: user or higher

Code Examples

const response = await fetch('https://api.royalti.io/royalty/crosstab', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`,
  },
});

const data = await response.json();
console.log(data);
import requests

response = requests.get(
  'https://api.royalti.io/royalty/crosstab',
  headers={
    'Authorization': f'Bearer {token}'
  },
)

data = response.json()
print(data)
curl -X GET https://api.royalti.io/royalty/crosstab \
  -H "Authorization: Bearer YOUR_TOKEN" \

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Query Parameters

dimension
enum<string>
default:country

Dimension to cross with time period

Available options:
country,
saletype,
dsp
topN
integer
default:8

Number of top dimension values to keep before bucketing the rest into "Other". Clamped to 1-12

Required range: 1 <= x <= 12
granularity
enum<string>
default:month

Time bucket size. The server auto-switches to quarter (and sets autoRolledUp: true in the response) when the requested window exceeds 24 months, regardless of what is requested here

Available options:
month,
quarter
artists
string

Filters the data by artist. Comma-separated list of artist IDs

user
string<uuid>

Filters the data by user. Specifies a user ID. A single UUID switches the response into per-member (splits-attributed) mode

country
string

Filter the data by country. Comma-separated values

dsp
string

Filters by DSP (Digital Service Provider). Comma-separated values

start
string<date>

Start date of the period (YYYY-MM-DD format). Also used to decide whether to auto-roll up to quarterly granularity

end
string<date>

End date of the period (YYYY-MM-DD format)

type
string

Filters by sale type. Comma-separated values

aggregator
string

Filters by aggregator. Comma-separated values

table_name
string

Filters by data source table name. Comma-separated values for multiple tables

upc
string

Filters by UPC (Universal Product Code). Comma-separated values

isrc
string

Filters by ISRC (International Standard Recording Code). Comma-separated values

periodFilterType
enum<string>
default:accounting

Selects the time-bucket axis. Defaults to accounting

Available options:
accounting,
sale

Response

Successfully retrieved crosstab data

dimension
enum<string>
Available options:
country,
saletype,
dsp
granularity
enum<string>
Available options:
month,
quarter
topN
integer

Number of top dimension values kept before bucketing the remainder into "Other"

autoRolledUp
boolean

True when the server auto-switched from month to quarter granularity because the requested window exceeds 24 months

results
object[]