Skip to main content
POST
/
expense
Create Expense
curl --request POST \
  --url https://api.royalti.io/expense/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "Mavins sabi girl",
  "type": "product",
  "transactionDate": "2023-03-14",
  "currency": "USD",
  "amount": 100,
  "amountUSD": 100,
  "id": "77ec1367-be7e-4c3c-a57f-79f6b7349952",
  "conversionRate": 1,
  "memo": "Some memo",
  "files": {
    "file1": "file1.pdf",
    "file2": "file2.pdf"
  },
  "split": [
    {
      "user": "91f1d1bd-ef25-4990-bd4f-aeee696c73a9",
      "share": 30
    },
    {
      "user": "9ea08acc-e135-4bd9-b159-48339ff65061",
      "share": 50
    },
    {
      "user": "b369dabe-b4e0-4787-91a5-b561c98601e5",
      "share": 20
    }
  ]
}
'
{
  "message": "Expense created successfully",
  "expense": {
    "id": "expense-uuid-123",
    "title": "Mavins sabi girl",
    "type": "product",
    "amount": 100,
    "amountUSD": 100,
    "currency": "USD",
    "transactionDate": "2023-03-14",
    "createdAt": "2023-03-14T10:30:00.000Z",
    "updatedAt": "2023-03-14T10:30:00.000Z"
  }
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Create Expense Description:
The /expense/ endpoint allows creation of expense records with detailed information including type, amount, splits, and associated files.
Method:
POST
Request Payload:
ParameterTypeDescription
titlestringTitle/description of the expense
typestringType of expense (product, artist, asset, general)
transactionDatestringDate of the expense transaction
currencystringCurrency code (e.g., USD, EUR)
amountnumberExpense amount in specified currency
amountUSDnumberExpense amount converted to USD
conversionRatenumberExchange rate used for conversion
idstringAssociated entity ID (product, artist, or asset)
memostringAdditional notes about the expense
filesobjectAssociated files/receipts
splitarrayExpense split information among users

Code Examples

const response = await fetch('https://api.royalti.io/expense/', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "title": "sample-title",
    "type": "sample-type",
    "transactionDate": "2024-01-21",
    "currency": "sample-currency",
    "amount": 1,
    "amountUSD": 1,
    "conversionRate": 1,
    "id": "sample-id",
    "artist": "sample-artist",
    "product": "sample-product",
    "asset": "sample-asset",
    "memo": "sample-memo",
    "files": "sample-files",
    "split": [
      {
        "user": "sample-user",
        "share": 1
      }
    ]
  })
});

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

Authorizations

Authorization
string
header
required

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

Body

application/json
title
string
required

Title/description of the expense

type
enum<string>
required

Type of expense

Available options:
product,
artist,
asset,
general,
marketing,
production,
legal,
administrative
transactionDate
string<date>
required

Date of the expense transaction

currency
string
required

Currency code (e.g., USD, EUR)

amount
number
required

Expense amount in specified currency

amountUSD
number
required

Expense amount converted to USD

conversionRate
number
default:1

Exchange rate used for conversion

id
string

Associated entity ID (product, artist, or asset)

artist
string

Associated artist ID (when type is artist)

product
string

Associated product ID (when type is product)

asset
string

Associated asset ID (when type is asset)

memo
string

Additional notes about the expense

files
file

Associated files/receipts

split
object[]

Expense split information among users

Response

Success

message
string
expense
object