Create Bulk Expenses
curl --request POST \
--url https://api.royalti.io/expense/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": [
"file1.jpg",
"file2.jpg"
]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": [
"file3.jpg",
"file4.jpg"
]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": [
"file5.jpg",
"file6.jpg"
]
}
]
}
'import requests
url = "https://api.royalti.io/expense/bulk"
payload = { "expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": ["file1.jpg", "file2.jpg"]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": ["file3.jpg", "file4.jpg"]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": ["file5.jpg", "file6.jpg"]
}
] }
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({
expenses: [
{
title: 'Expense for Ladipoe',
transactionDate: '2023-03-14',
type: 'artist',
currency: 'USD',
amount: 100,
amountUSD: 100,
artist: 'ladipoe',
conversionRate: 1,
memo: 'Expense memo for ladipoe',
files: ['file1.jpg', 'file2.jpg']
},
{
title: 'Expense for Another Mavins Product',
transactionDate: '2023-03-13',
type: 'product',
currency: 'EUR',
amount: 200,
amountUSD: 240,
product: 'Another mavins Product',
memo: 'Expense memo for arya star',
files: ['file3.jpg', 'file4.jpg']
},
{
title: 'Expense for asset feeling',
transactionDate: '2023-03-13',
type: 'asset',
currency: 'EUR',
amount: 200,
amountUSD: 240,
asset: 'feeling-asset-id',
memo: 'Expense memo for feeling asset',
files: ['file5.jpg', 'file6.jpg']
}
]
})
};
fetch('https://api.royalti.io/expense/bulk', 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/expense/bulk",
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([
'expenses' => [
[
'title' => 'Expense for Ladipoe',
'transactionDate' => '2023-03-14',
'type' => 'artist',
'currency' => 'USD',
'amount' => 100,
'amountUSD' => 100,
'artist' => 'ladipoe',
'conversionRate' => 1,
'memo' => 'Expense memo for ladipoe',
'files' => [
'file1.jpg',
'file2.jpg'
]
],
[
'title' => 'Expense for Another Mavins Product',
'transactionDate' => '2023-03-13',
'type' => 'product',
'currency' => 'EUR',
'amount' => 200,
'amountUSD' => 240,
'product' => 'Another mavins Product',
'memo' => 'Expense memo for arya star',
'files' => [
'file3.jpg',
'file4.jpg'
]
],
[
'title' => 'Expense for asset feeling',
'transactionDate' => '2023-03-13',
'type' => 'asset',
'currency' => 'EUR',
'amount' => 200,
'amountUSD' => 240,
'asset' => 'feeling-asset-id',
'memo' => 'Expense memo for feeling asset',
'files' => [
'file5.jpg',
'file6.jpg'
]
]
]
]),
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/expense/bulk"
payload := strings.NewReader("{\n \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\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/expense/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/expense/bulk")
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 \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Bulk expense creation completed",
"createdExpenses": [
"Expense One",
"Expense Two"
],
"processedCount": 3,
"totalAmount": 500,
"totalAmountUSD": 540,
"errors": [
"Invalid currency for Expense Three"
]
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}Expense
Create Bulk Expenses
Create Bulk Expenses
POST
/
expense
/
bulk
Create Bulk Expenses
curl --request POST \
--url https://api.royalti.io/expense/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": [
"file1.jpg",
"file2.jpg"
]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": [
"file3.jpg",
"file4.jpg"
]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": [
"file5.jpg",
"file6.jpg"
]
}
]
}
'import requests
url = "https://api.royalti.io/expense/bulk"
payload = { "expenses": [
{
"title": "Expense for Ladipoe",
"transactionDate": "2023-03-14",
"type": "artist",
"currency": "USD",
"amount": 100,
"amountUSD": 100,
"artist": "ladipoe",
"conversionRate": 1,
"memo": "Expense memo for ladipoe",
"files": ["file1.jpg", "file2.jpg"]
},
{
"title": "Expense for Another Mavins Product",
"transactionDate": "2023-03-13",
"type": "product",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"product": "Another mavins Product",
"memo": "Expense memo for arya star",
"files": ["file3.jpg", "file4.jpg"]
},
{
"title": "Expense for asset feeling",
"transactionDate": "2023-03-13",
"type": "asset",
"currency": "EUR",
"amount": 200,
"amountUSD": 240,
"asset": "feeling-asset-id",
"memo": "Expense memo for feeling asset",
"files": ["file5.jpg", "file6.jpg"]
}
] }
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({
expenses: [
{
title: 'Expense for Ladipoe',
transactionDate: '2023-03-14',
type: 'artist',
currency: 'USD',
amount: 100,
amountUSD: 100,
artist: 'ladipoe',
conversionRate: 1,
memo: 'Expense memo for ladipoe',
files: ['file1.jpg', 'file2.jpg']
},
{
title: 'Expense for Another Mavins Product',
transactionDate: '2023-03-13',
type: 'product',
currency: 'EUR',
amount: 200,
amountUSD: 240,
product: 'Another mavins Product',
memo: 'Expense memo for arya star',
files: ['file3.jpg', 'file4.jpg']
},
{
title: 'Expense for asset feeling',
transactionDate: '2023-03-13',
type: 'asset',
currency: 'EUR',
amount: 200,
amountUSD: 240,
asset: 'feeling-asset-id',
memo: 'Expense memo for feeling asset',
files: ['file5.jpg', 'file6.jpg']
}
]
})
};
fetch('https://api.royalti.io/expense/bulk', 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/expense/bulk",
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([
'expenses' => [
[
'title' => 'Expense for Ladipoe',
'transactionDate' => '2023-03-14',
'type' => 'artist',
'currency' => 'USD',
'amount' => 100,
'amountUSD' => 100,
'artist' => 'ladipoe',
'conversionRate' => 1,
'memo' => 'Expense memo for ladipoe',
'files' => [
'file1.jpg',
'file2.jpg'
]
],
[
'title' => 'Expense for Another Mavins Product',
'transactionDate' => '2023-03-13',
'type' => 'product',
'currency' => 'EUR',
'amount' => 200,
'amountUSD' => 240,
'product' => 'Another mavins Product',
'memo' => 'Expense memo for arya star',
'files' => [
'file3.jpg',
'file4.jpg'
]
],
[
'title' => 'Expense for asset feeling',
'transactionDate' => '2023-03-13',
'type' => 'asset',
'currency' => 'EUR',
'amount' => 200,
'amountUSD' => 240,
'asset' => 'feeling-asset-id',
'memo' => 'Expense memo for feeling asset',
'files' => [
'file5.jpg',
'file6.jpg'
]
]
]
]),
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/expense/bulk"
payload := strings.NewReader("{\n \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\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/expense/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/expense/bulk")
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 \"expenses\": [\n {\n \"title\": \"Expense for Ladipoe\",\n \"transactionDate\": \"2023-03-14\",\n \"type\": \"artist\",\n \"currency\": \"USD\",\n \"amount\": 100,\n \"amountUSD\": 100,\n \"artist\": \"ladipoe\",\n \"conversionRate\": 1,\n \"memo\": \"Expense memo for ladipoe\",\n \"files\": [\n \"file1.jpg\",\n \"file2.jpg\"\n ]\n },\n {\n \"title\": \"Expense for Another Mavins Product\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"product\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"product\": \"Another mavins Product\",\n \"memo\": \"Expense memo for arya star\",\n \"files\": [\n \"file3.jpg\",\n \"file4.jpg\"\n ]\n },\n {\n \"title\": \"Expense for asset feeling\",\n \"transactionDate\": \"2023-03-13\",\n \"type\": \"asset\",\n \"currency\": \"EUR\",\n \"amount\": 200,\n \"amountUSD\": 240,\n \"asset\": \"feeling-asset-id\",\n \"memo\": \"Expense memo for feeling asset\",\n \"files\": [\n \"file5.jpg\",\n \"file6.jpg\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Bulk expense creation completed",
"createdExpenses": [
"Expense One",
"Expense Two"
],
"processedCount": 3,
"totalAmount": 500,
"totalAmountUSD": 540,
"errors": [
"Invalid currency for Expense Three"
]
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}This endpoint requires authentication. Include your Bearer token in the Authorization header.
Description
Create Bulk Expenses Description: The/expense/bulk endpoint allows creation of multiple expense records simultaneously.
Method:
POST
Authorization:
- Required role:
adminor higher
| Parameter | Type | Description |
|---|---|---|
| expenses | array | Array of expense objects |
Code Examples
const response = await fetch('https://api.royalti.io/expense/bulk', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"expenses": [
{
"title": "sample-title",
"type": "sample-type",
"transactionDate": "2024-01-21",
"currency": "sample-currency",
"amount": 1,
"amountUSD": 1,
"conversionRate": 1,
"artist": "sample-artist",
"product": "sample-product",
"asset": "sample-asset",
"memo": "sample-memo",
"files": [
{}
],
"split": [
{}
]
}
]
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.royalti.io/expense/bulk',
headers={
'Authorization': f'Bearer {token}'
},
json={"expenses":[{"title":"sample-title","type":"sample-type","transactionDate":"2024-01-21","currency":"sample-currency","amount":1,"amountUSD":1,"conversionRate":1,"artist":"sample-artist","product":"sample-product","asset":"sample-asset","memo":"sample-memo","files":[{}],"split":[{}]}]}
)
data = response.json()
print(data)
curl -X POST https://api.royalti.io/expense/bulk \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"expenses":[{"title":"sample-title","type":"sample-type","transactionDate":"2024-01-21","currency":"sample-currency","amount":1,"amountUSD":1,"conversionRate":1,"artist":"sample-artist","product":"sample-product","asset":"sample-asset","memo":"sample-memo","files":[{}],"split":[{}]}]}'
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Body
application/json
Show child attributes
Show child attributes
⌘I