Step 1 — Upload and analyze a sample file
curl --request POST \
--url https://api.royalti.io/source-creator/analyze \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'delimiter=<string>' \
--form 'decimalSeparator=<string>' \
--form headerRows=2import requests
url = "https://api.royalti.io/source-creator/analyze"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"delimiter": "<string>",
"decimalSeparator": "<string>",
"headerRows": "2"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('delimiter', '<string>');
form.append('decimalSeparator', '<string>');
form.append('headerRows', '2');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.royalti.io/source-creator/analyze', 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/source-creator/analyze",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.royalti.io/source-creator/analyze"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.royalti.io/source-creator/analyze")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/source-creator/analyze")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File analyzed successfully",
"data": {
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"headers": [
"<string>"
],
"sampleRows": [
{}
],
"fileInfo": {
"delimiter": ",",
"decimalSeparator": "<string>",
"headerRows": 123,
"totalRows": 123,
"sheets": [
"<string>"
],
"selectedSheet": "<string>",
"detectedEncoding": "<string>"
},
"existingMatch": {
"sourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceName": "<string>",
"confidence": 123
},
"matchingSources": [
{
"royaltySourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceName": "<string>",
"sourceLabel": "<string>",
"matchScore": 123,
"matchedColumns": [
"<string>"
],
"unmatchedColumns": [
"<string>"
],
"isOwnSource": true
}
],
"suggestedName": "<string>",
"periodDetection": {
"accountingPeriod": {
"value": "2025-01",
"format": "YYYY-MM",
"rawMatch": "Jan2025",
"confidence": 0.9
},
"salePeriod": {
"value": "2025-01",
"format": "YYYY-MM",
"rawMatch": "Jan2025",
"confidence": 0.9
},
"hasDateColumns": true,
"dateColumnNames": [
"<string>"
]
},
"parentSourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "This feature requires a plan upgrade",
"data": {
"feature": "royaltyAccess",
"currentPlan": "FREE",
"availablePlans": [
{}
]
}
}Source Creator
Step 1 — Upload and analyze a sample file
POST /source-creator/analyze
POST
/
source-creator
/
analyze
Step 1 — Upload and analyze a sample file
curl --request POST \
--url https://api.royalti.io/source-creator/analyze \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'delimiter=<string>' \
--form 'decimalSeparator=<string>' \
--form headerRows=2import requests
url = "https://api.royalti.io/source-creator/analyze"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"delimiter": "<string>",
"decimalSeparator": "<string>",
"headerRows": "2"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('delimiter', '<string>');
form.append('decimalSeparator', '<string>');
form.append('headerRows', '2');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.royalti.io/source-creator/analyze', 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/source-creator/analyze",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.royalti.io/source-creator/analyze"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.royalti.io/source-creator/analyze")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/source-creator/analyze")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"delimiter\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"decimalSeparator\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headerRows\"\r\n\r\n2\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File analyzed successfully",
"data": {
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"headers": [
"<string>"
],
"sampleRows": [
{}
],
"fileInfo": {
"delimiter": ",",
"decimalSeparator": "<string>",
"headerRows": 123,
"totalRows": 123,
"sheets": [
"<string>"
],
"selectedSheet": "<string>",
"detectedEncoding": "<string>"
},
"existingMatch": {
"sourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceName": "<string>",
"confidence": 123
},
"matchingSources": [
{
"royaltySourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceName": "<string>",
"sourceLabel": "<string>",
"matchScore": 123,
"matchedColumns": [
"<string>"
],
"unmatchedColumns": [
"<string>"
],
"isOwnSource": true
}
],
"suggestedName": "<string>",
"periodDetection": {
"accountingPeriod": {
"value": "2025-01",
"format": "YYYY-MM",
"rawMatch": "Jan2025",
"confidence": 0.9
},
"salePeriod": {
"value": "2025-01",
"format": "YYYY-MM",
"rawMatch": "Jan2025",
"confidence": 0.9
},
"hasDateColumns": true,
"dateColumnNames": [
"<string>"
]
},
"parentSourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "This feature requires a plan upgrade",
"data": {
"feature": "royaltyAccess",
"currentPlan": "FREE",
"availablePlans": [
{}
]
}
}This endpoint requires authentication. Include your Bearer token in the Authorization header.
Description
POST /source-creator/analyze Description: Uploads a CSV/TSV/XLSX sample file (multipart), parses headers and up to 20 sample rows, auto-detects delimiter/decimal separator/encoding, checks for existing matching sources by header similarity, and creates a newSourceCreatorSession (7-day expiry). XLSX files are
accepted by the file filter but analysis is not yet implemented for
them — the endpoint returns 400 for .xlsx uploads today.
Rate limited via heavyOperationLimiter (file parsing is expensive).
Authorization:
- Required role:
adminor higher
Code Examples
const response = await fetch('https://api.royalti.io/source-creator/analyze', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.royalti.io/source-creator/analyze',
headers={
'Authorization': f'Bearer {token}'
},
json={}
)
data = response.json()
print(data)
curl -X POST https://api.royalti.io/source-creator/analyze \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Body
multipart/form-data
CSV/TSV/XLSX file, max 10MB. Accepted mimetypes: text/csv, text/tab-separated-values, text/plain, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel (or matching .csv/.tsv/.txt/.xlsx/.xls extension).
Override the auto-detected field delimiter.
Override the auto-detected decimal separator ("," or ".").
Override the number of header/prelude rows to skip before the real data header.
Required range:
x >= 1⌘I