Skip to main content
POST
/
expense
/
Create Expense
curl --request POST \
  --url https://server26-dot-royalti-project.uc.r.appspot.com/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"
  }
}
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

Authentication

This endpoint requires authentication. Include your bearer token in the Authorization header.

Request Body

Example Request

{
  "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
    }
  ]
}

Request Schema

FieldTypeRequiredDescription
titlestringTitle/description of the expense
typestringType of expense
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)
artiststringAssociated artist ID (when type is artist)
productstringAssociated product ID (when type is product)
assetstringAssociated asset ID (when type is asset)
memostringAdditional notes about the expense
filesstringAssociated files/receipts
splitarrayExpense split information among users

Responses

✅ 201 - Success

⚠️ 400 - Bad Request

⚠️ 401 - Unauthorized

⚠️ 404 - Not Found

❌ 500 - Internal Server Error

Tags

Expense

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
I