Skip to main content
POST
/
sources
Add Tenant Source
curl --request POST \
  --url https://api.royalti.io/sources \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "royaltySourceId": "src-1",
  "settings": {},
  "replacements": {}
}
'
{
  "TenantId": 1,
  "RoyaltySourceId": "src-1",
  "isActive": true,
  "settings": {},
  "replacements": {},
  "royaltySource": {
    "id": "src-1",
    "name": "spotify",
    "label": "Spotify",
    "type": "DSP",
    "format": "csv",
    "public": true
  }
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Required Permissions

  • sources:create

Business Rules

  • Source must have public=true to be associated with tenants
  • Source must have isActive=true to be associated
  • Cannot add duplicate associations (same tenant + source combination)
  • Association is automatically set to isActive=true on creation

Side Effects

  • Triggers regeneration of tenant’s sales data query cache
  • Updates tenant-specific BigQuery query configurations

Validation

  • Verifies royalty source exists and is available
  • Checks for existing association
  • Returns 400 if duplicate or source not available
  • Returns 404 if source not found

Code Examples

const response = await fetch('https://api.royalti.io/sources', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "royaltySourceId": "src-1",
    "settings": {},
    "replacements": {}
  })
});

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

Authorizations

Authorization
string
header
required

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

Body

application/json
royaltySourceId
string
required

ID of the royalty source to associate

Example:

"src-1"

settings
object

Tenant-specific settings for this source

Example:
{}
replacements
object

Field mapping/replacement rules

Example:
{}

Response

Tenant source association created

Association between a tenant and a royalty source. Note: The composite key is (TenantId, RoyaltySourceId).

TenantId
integer

Tenant ID (automatically set from authenticated user)

Example:

1

RoyaltySourceId
string

Royalty source ID

Example:

"src-1"

isActive
boolean
default:true

Whether this source association is active for the tenant

Example:

true

settings
object

Tenant-specific settings for this source

Example:
{}
replacements
object

Tenant-specific field replacements/mappings

Example:
{}
royaltySource
object