Skip to main content
POST
/
pro-credentials
Create a PRO credential set
curl --request POST \
  --url https://api.royalti.io/pro-credentials \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "societyCode": "BMI",
  "accountId": "RY-19-BMI",
  "submissionMethod": "SFTP",
  "credentials": {
    "host": "sftp.bmi.example",
    "port": 22,
    "username": "royalti-tenant-19",
    "password": "••••••••"
  }
}
'
import requests

url = "https://api.royalti.io/pro-credentials"

payload = {
"societyCode": "BMI",
"accountId": "RY-19-BMI",
"submissionMethod": "SFTP",
"credentials": {
"host": "sftp.bmi.example",
"port": 22,
"username": "royalti-tenant-19",
"password": "••••••••"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
societyCode: 'BMI',
accountId: 'RY-19-BMI',
submissionMethod: 'SFTP',
credentials: {
host: 'sftp.bmi.example',
port: 22,
username: 'royalti-tenant-19',
password: '••••••••'
}
})
};

fetch('https://api.royalti.io/pro-credentials', 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/pro-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'societyCode' => 'BMI',
'accountId' => 'RY-19-BMI',
'submissionMethod' => 'SFTP',
'credentials' => [
'host' => 'sftp.bmi.example',
'port' => 22,
'username' => 'royalti-tenant-19',
'password' => '••••••••'
]
]),
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/pro-credentials"

payload := strings.NewReader("{\n \"societyCode\": \"BMI\",\n \"accountId\": \"RY-19-BMI\",\n \"submissionMethod\": \"SFTP\",\n \"credentials\": {\n \"host\": \"sftp.bmi.example\",\n \"port\": 22,\n \"username\": \"royalti-tenant-19\",\n \"password\": \"••••••••\"\n }\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.royalti.io/pro-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"societyCode\": \"BMI\",\n \"accountId\": \"RY-19-BMI\",\n \"submissionMethod\": \"SFTP\",\n \"credentials\": {\n \"host\": \"sftp.bmi.example\",\n \"port\": 22,\n \"username\": \"royalti-tenant-19\",\n \"password\": \"••••••••\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.royalti.io/pro-credentials")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"societyCode\": \"BMI\",\n \"accountId\": \"RY-19-BMI\",\n \"submissionMethod\": \"SFTP\",\n \"credentials\": {\n \"host\": \"sftp.bmi.example\",\n \"port\": 22,\n \"username\": \"royalti-tenant-19\",\n \"password\": \"••••••••\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "TenantId": 123,
    "societyCode": "BMI",
    "societyName": "<string>",
    "accountId": "<string>",
    "encryptionVersion": 123,
    "endpointConfig": {},
    "isActive": true,
    "lastUsedAt": "2023-11-07T05:31:56Z",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

POST /pro-credentials Description: Creates a new credential set for a (tenant, society) pair. One active set per society per tenant — fails if credentials for the given societyCode already exist for this tenant (regardless of isActive… the pre-create check is not scoped to active-only). credentials is encrypted at rest before the row is written; the response never echoes it back. Authorization:
  • Required role: admin or higher
  • Requires an active publisher addon
Method: POST

Code Examples

const response = await fetch('https://api.royalti.io/pro-credentials', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "societyCode": "BMI",
    "societyName": "sample-societyName",
    "accountId": "sample-accountId",
    "submissionMethod": "sample-submissionMethod",
    "endpointConfig": {},
    "isActive": true
  })
});

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

response = requests.post(
  'https://api.royalti.io/pro-credentials',
  headers={
    'Authorization': f'Bearer {token}'
  },
  json={"societyCode":"BMI","societyName":"sample-societyName","accountId":"sample-accountId","submissionMethod":"sample-submissionMethod","endpointConfig":{},"isActive":true}
)

data = response.json()
print(data)
curl -X POST https://api.royalti.io/pro-credentials \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"societyCode":"BMI","societyName":"sample-societyName","accountId":"sample-accountId","submissionMethod":"sample-submissionMethod","endpointConfig":{},"isActive":true}'

Authorizations

Authorization
string
header
required

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

Body

application/json
societyCode
string
required
Required string length: 2 - 3
Example:

"BMI"

accountId
string
required
submissionMethod
enum<string>
required
Available options:
SFTP,
API,
EMAIL
credentials
object
required

Write-only credential payload. Fields used depend on submissionMethod; unused fields are ignored.

Example:
{
"host": "sftp.example-pro.org",
"port": 22,
"username": "royalti-tenant-19",
"password": "••••••••"
}
societyName
string | null
endpointConfig
object
isActive
boolean
default:true

Response

Credential set created

status
string
Example:

"success"

data
object

Serialized row — never includes the credential payload (see the tag description).