Create an advance draft
curl --request POST \
--url https://api.royalti.io/advance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"principalDisbursedUsd": 123,
"multiple": 123,
"captureRate": 123,
"disbursementCurrency": "USD",
"disbursedAmount": 123,
"fxRate": 123,
"fxDate": "2023-12-25",
"termMonths": 24,
"memo": "<string>"
}
'import requests
url = "https://api.royalti.io/advance"
payload = {
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"principalDisbursedUsd": 123,
"multiple": 123,
"captureRate": 123,
"disbursementCurrency": "USD",
"disbursedAmount": 123,
"fxRate": 123,
"fxDate": "2023-12-25",
"termMonths": 24,
"memo": "<string>"
}
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({
TenantUserId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
principalDisbursedUsd: 123,
multiple: 123,
captureRate: 123,
disbursementCurrency: 'USD',
disbursedAmount: 123,
fxRate: 123,
fxDate: '2023-12-25',
termMonths: 24,
memo: '<string>'
})
};
fetch('https://api.royalti.io/advance', 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/advance",
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([
'TenantUserId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'principalDisbursedUsd' => 123,
'multiple' => 123,
'captureRate' => 123,
'disbursementCurrency' => 'USD',
'disbursedAmount' => 123,
'fxRate' => 123,
'fxDate' => '2023-12-25',
'termMonths' => 24,
'memo' => '<string>'
]),
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/advance"
payload := strings.NewReader("{\n \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\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/advance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/advance")
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 \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"TenantId": 123,
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "draft",
"principalDisbursedUsd": "<string>",
"multiple": "<string>",
"totalRepayableUsd": "<string>",
"outstandingUsd": "<string>",
"captureRate": "<string>",
"disbursementCurrency": "NGN",
"disbursedAmount": "<string>",
"fxRate": "<string>",
"fxDate": "2023-12-25",
"termMonths": 24,
"firstSweptAt": "2023-11-07T05:31:56Z",
"activatedAt": "2023-11-07T05:31:56Z",
"recoupedAt": "2023-11-07T05:31:56Z",
"writtenOffAt": "2023-11-07T05:31:56Z",
"writtenOffUsd": "<string>",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"memo": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"message": "Unauthorized"
}Advance
Create an advance draft
Create advance
POST
/
advance
Create an advance draft
curl --request POST \
--url https://api.royalti.io/advance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"principalDisbursedUsd": 123,
"multiple": 123,
"captureRate": 123,
"disbursementCurrency": "USD",
"disbursedAmount": 123,
"fxRate": 123,
"fxDate": "2023-12-25",
"termMonths": 24,
"memo": "<string>"
}
'import requests
url = "https://api.royalti.io/advance"
payload = {
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"principalDisbursedUsd": 123,
"multiple": 123,
"captureRate": 123,
"disbursementCurrency": "USD",
"disbursedAmount": 123,
"fxRate": 123,
"fxDate": "2023-12-25",
"termMonths": 24,
"memo": "<string>"
}
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({
TenantUserId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
principalDisbursedUsd: 123,
multiple: 123,
captureRate: 123,
disbursementCurrency: 'USD',
disbursedAmount: 123,
fxRate: 123,
fxDate: '2023-12-25',
termMonths: 24,
memo: '<string>'
})
};
fetch('https://api.royalti.io/advance', 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/advance",
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([
'TenantUserId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'principalDisbursedUsd' => 123,
'multiple' => 123,
'captureRate' => 123,
'disbursementCurrency' => 'USD',
'disbursedAmount' => 123,
'fxRate' => 123,
'fxDate' => '2023-12-25',
'termMonths' => 24,
'memo' => '<string>'
]),
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/advance"
payload := strings.NewReader("{\n \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\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/advance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/advance")
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 \"TenantUserId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"principalDisbursedUsd\": 123,\n \"multiple\": 123,\n \"captureRate\": 123,\n \"disbursementCurrency\": \"USD\",\n \"disbursedAmount\": 123,\n \"fxRate\": 123,\n \"fxDate\": \"2023-12-25\",\n \"termMonths\": 24,\n \"memo\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"TenantId": 123,
"TenantUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "draft",
"principalDisbursedUsd": "<string>",
"multiple": "<string>",
"totalRepayableUsd": "<string>",
"outstandingUsd": "<string>",
"captureRate": "<string>",
"disbursementCurrency": "NGN",
"disbursedAmount": "<string>",
"fxRate": "<string>",
"fxDate": "2023-12-25",
"termMonths": 24,
"firstSweptAt": "2023-11-07T05:31:56Z",
"activatedAt": "2023-11-07T05:31:56Z",
"recoupedAt": "2023-11-07T05:31:56Z",
"writtenOffAt": "2023-11-07T05:31:56Z",
"writtenOffUsd": "<string>",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"memo": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"message": "Unauthorized"
}Description
Create advance Creates adraft Advance for the given user. totalRepayableUsd is
computed and fixed as principalDisbursedUsd × multiple;
outstandingUsd starts at 0 (set to the full repayable only on
activation). The user must exist in the workspace.
Authorization:
- Required role:
adminor higher
Code Examples
const response = await fetch('https://api.royalti.io/advance', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"TenantUserId": "sample-TenantUserId",
"principalDisbursedUsd": 1,
"multiple": 1,
"captureRate": 1,
"disbursementCurrency": "sample-disbursementCurrency",
"disbursedAmount": 1,
"fxRate": 1,
"fxDate": "2024-01-21",
"termMonths": 1,
"memo": "sample-memo"
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.royalti.io/advance',
json={"TenantUserId":"sample-TenantUserId","principalDisbursedUsd":1,"multiple":1,"captureRate":1,"disbursementCurrency":"sample-disbursementCurrency","disbursedAmount":1,"fxRate":1,"fxDate":"2024-01-21","termMonths":1,"memo":"sample-memo"}
)
data = response.json()
print(data)
curl -X POST https://api.royalti.io/advance \
-H "Content-Type: application/json" \
-d '{"TenantUserId":"sample-TenantUserId","principalDisbursedUsd":1,"multiple":1,"captureRate":1,"disbursementCurrency":"sample-disbursementCurrency","disbursedAmount":1,"fxRate":1,"fxDate":"2024-01-21","termMonths":1,"memo":"sample-memo"}'
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Body
application/json
Accepted as TenantUserId or user in the request body.
Must be a positive number.
Must be >= 1.
Percent, must be > 0 and <= 100.
Available options:
NGN, USD Display-only FX snapshot amount, relevant when disbursementCurrency is NGN.
Required to be positive when disbursementCurrency is NGN and provided.
⌘I