Skip to main content
PUT
/
work
/
works
/
{id}
/
writers
Replace a work's writer splits
curl --request PUT \
  --url https://api.royalti.io/work/works/{id}/writers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "writers": [
    {
      "writerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "prShare": 50,
      "mrShare": 50,
      "srShare": 50
    }
  ]
}
'
import requests

url = "https://api.royalti.io/work/works/{id}/writers"

payload = { "writers": [
{
"writerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prShare": 50,
"mrShare": 50,
"srShare": 50
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
writers: [
{
writerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
prShare: 50,
mrShare: 50,
srShare: 50
}
]
})
};

fetch('https://api.royalti.io/work/works/{id}/writers', 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/work/works/{id}/writers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'writers' => [
[
'writerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'prShare' => 50,
'mrShare' => 50,
'srShare' => 50
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$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/work/works/{id}/writers"

payload := strings.NewReader("{\n \"writers\": [\n {\n \"writerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prShare\": 50,\n \"mrShare\": 50,\n \"srShare\": 50\n }\n ]\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.royalti.io/work/works/{id}/writers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"writers\": [\n {\n \"writerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prShare\": 50,\n \"mrShare\": 50,\n \"srShare\": 50\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.royalti.io/work/works/{id}/writers")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"writers\": [\n {\n \"writerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prShare\": 50,\n \"mrShare\": 50,\n \"srShare\": 50\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "writers": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "workId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "writerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "territories": [
        {
          "territoryCode": "WW",
          "prShare": 50,
          "mrShare": 50,
          "srShare": 50,
          "startDate": "2023-11-07T05:31:56Z",
          "endDate": "2023-11-07T05:31:56Z"
        }
      ],
      "sourceLineNumber": 123,
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z"
    }
  ]
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

PUT /work/works//writers Description: Replaces the FULL CWRWorkWriter set for the work in a single transaction — this is the publishing “Writers & Splits” editor’s save action, not an incremental add/remove. Each writer is persisted as one Worldwide (WW) territory row carrying the three pool shares. Editor-invisible per-writer fields (controlled, saan, publisherFee, sourceType) are preserved from the prior row for writers that are retained. On success, may flip the work’s metadata.completeness between complete and skeleton per the WP-P4 lifecycle (skeleton re-badging only applies to bootstrap-seeded works). Authorization:
  • Requires active publisher addon
  • Required role: admin or higher
Method: PUT

Code Examples

const response = await fetch('https://api.royalti.io/work/works/{id}/writers', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "ref": "#/components/schemas/ReplaceWorkWritersRequest"
  })
});

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

response = requests.put(
  'https://api.royalti.io/work/works/{id}/writers',
  headers={
    'Authorization': f'Bearer {token}'
  },
  json={"ref":"#/components/schemas/ReplaceWorkWritersRequest"}
)

data = response.json()
print(data)
curl -X PUT https://api.royalti.io/work/works/{id}/writers \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ref":"#/components/schemas/ReplaceWorkWritersRequest"}'

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string<uuid>
required

CWRWork id (the /work/works/:id route family uses id, not workId)

Body

application/json

Replaces the FULL writer set for the work in one call. Validation: each writer requires a unique writerId + an allowed writerRole; each of prShare/mrShare/srShare must be 0-100; each pool must sum to either exactly 0 (unset) or 100% ± 0.02 across all writers; every writerId must belong to the caller's tenant. A pool sum of 0 across ALL writers is treated as "shares not entered" and persists relativeShare: null rather than 0%.

writers
object[]
required

Response

Writer splits replaced

success
boolean
Example:

true

writers
object[]