Skip to main content
POST
/
publisher-writer
/
agreements
curl --request POST \
  --url https://api.royalti.io/publisher-writer/agreements \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "publisherId": "8f14e45f-ceea-4d5e-8b3a-0a1b2c3d4e5f",
  "writerId": "6c1f2e3a-1234-4abc-9def-abcdef123456",
  "name": "Afrosounds Publishing - Amaka Eze"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "tenantId": 123,
  "publisherId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "writerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "description": "<string>",
  "territories": [
    {
      "territoryCode": "WW",
      "prShare": 50,
      "mrShare": 50,
      "srShare": 50,
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z"
    }
  ],
  "contractNumber": "<string>",
  "contractDate": "2023-11-07T05:31:56Z",
  "startDate": "2023-11-07T05:31:56Z",
  "endDate": "2023-11-07T05:31:56Z",
  "isActive": true,
  "publisher": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "firstName": "<string>",
    "lastName": "<string>"
  },
  "writer": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "firstName": "<string>",
    "lastName": "<string>"
  },
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}
{
"message": "<string>",
"error": "<string>"
}
{
"message": "<string>",
"error": "<string>"
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

POST /publisher-writer/agreements Description: Creates a new agreement inside a DB transaction. Verifies the publisher and writer both exist for the tenant, validates territories (if supplied) against CISAC rules, and checks for territory conflicts against any of this publisher/writer pair’s other currently-active agreements — a conflicting territory rolls back the transaction and returns 400. Defaults status to draft and isActive to true when not supplied. The response object does NOT include the nested publisher/writer relations (those only get attached on scoped reads, not on the raw .create() result). Authorization:
  • Required role: admin or higher
Method: POST

Code Examples

const response = await fetch('https://api.royalti.io/publisher-writer/agreements', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "ref": "#/components/schemas/AgreementCreateRequest"
  })
});

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

response = requests.post(
  'https://api.royalti.io/publisher-writer/agreements',
  headers={
    'Authorization': f'Bearer {token}'
  },
  json={"ref":"#/components/schemas/AgreementCreateRequest"}
)

data = response.json()
print(data)
curl -X POST https://api.royalti.io/publisher-writer/agreements \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ref":"#/components/schemas/AgreementCreateRequest"}'

Authorizations

Authorization
string
header
required

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

Body

application/json
publisherId
string<uuid>
required

Must reference an existing Publisher on this tenant.

writerId
string<uuid>
required

Must reference an existing CWRWriter on this tenant.

name
string

Required by the model (allowNull:false); omitting it fails Sequelize validation.

description
string
territories
object[]

Validated against CISAC territory rules, and checked for conflicts against this publisher/writer pair's other ACTIVE agreements.

contractNumber
string
contractDate
string<date-time>
startDate
string<date-time>
endDate
string<date-time>
status
enum<string>
default:draft
Available options:
draft,
pending,
active,
expired,
terminated
isActive
boolean
default:true

Response

Agreement created

id
string<uuid>
tenantId
integer
publisherId
string<uuid>
writerId
string<uuid>
name
string
description
string | null
territories
object[]
contractNumber
string | null
contractDate
string<date-time> | null
startDate
string<date-time> | null
endDate
string<date-time> | null
status
enum<string>
Available options:
draft,
pending,
active,
expired,
terminated
isActive
boolean
default:true
publisher
object

Only present when the record was loaded via the model's default scope (all reads; NOT present on the POST /agreements create response).

writer
object

Only present when the record was loaded via the model's default scope (all reads; NOT present on the POST /agreements create response).

createdAt
string<date-time>
updatedAt
string<date-time>