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:
Parameter | Type | Description |
---|---|---|
title | string | Title/description of the expense |
type | string | Type of expense (product, artist, asset, general) |
transactionDate | string | Date of the expense transaction |
currency | string | Currency code (e.g., USD, EUR) |
amount | number | Expense amount in specified currency |
amountUSD | number | Expense amount converted to USD |
conversionRate | number | Exchange rate used for conversion |
id | string | Associated entity ID (product, artist, or asset) |
memo | string | Additional notes about the expense |
files | object | Associated files/receipts |
split | array | Expense split information among users |
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"
}
}
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Success
The response is of type object
.
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"
}
}