Finance API
Track revenue and costs for your products.
Read & Create API
The Finance API supports reading and creating records. To update or delete records, please use the dashboard.
Endpoints
All finance endpoints are scoped to a specific product using its ID or slug.
Revenue
Revenue Object
The revenue object represents a single revenue record.
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier (cuid) |
amount | number | Revenue amount |
currency | string | Currency code (default: USD) |
type | string | Revenue type (see Revenue Types) |
source | string | null | Payment source (free text) |
note | string | null | Optional note |
date | string | Date (YYYY-MM-DD) |
createdAt | string | ISO 8601 timestamp |
Cost Object
The cost object represents a single cost record.
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier (cuid) |
name | string | Cost item name |
amount | number | Cost amount |
currency | string | Currency code (default: USD) |
category | string | Cost category (see Cost Categories) |
isRecurring | boolean | Whether this is a recurring cost |
note | string | null | Optional note |
date | string | Date (YYYY-MM-DD) |
createdAt | string | ISO 8601 timestamp |
Revenue Types
Revenue records are categorized by type. The type field determines how the revenue is classified:
subscriptionRecurring subscription revenue (included in MRR calculation)
one_timeOne-time purchase or payment
lifetimeLifetime deal or buy-once payment
advertisingAdvertising or sponsorship revenue
enterpriseEnterprise or custom contract revenue
affiliateAffiliate or referral commission
refundRefund issued to customer
otherOther revenue not covered above
Cost Categories
Costs are categorized to help track where money is being spent:
INFRASTRUCTUREServers, domains, cloud services
THIRD_PARTYThird-party APIs and services
MARKETINGAdvertising, sponsorships, promotions
TOOLSSoftware subscriptions and tools
OTHEROther costs not covered above
GET
List Revenue
Returns all revenue records for a product.
Request
Bash
curl https://api.myopcs.com/api/v1/products/my-saas-app/revenue \
-H "Authorization: Bearer YOUR_API_KEY"Response
{}JSON
{
"data": [
{
"id": "clxabc123",
"amount": 99.00,
"currency": "USD",
"type": "subscription",
"source": "stripe",
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
]
}GET
Retrieve Revenue
Retrieves a single revenue record by ID.
Request
Bash
curl https://api.myopcs.com/api/v1/products/my-saas-app/revenue/clxabc123 \
-H "Authorization: Bearer YOUR_API_KEY"Response
{}JSON
{
"data": {
"id": "clxabc123",
"amount": 99.00,
"currency": "USD",
"type": "subscription",
"source": "stripe",
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
}POST
Create Revenue
Creates a new revenue record for a product.
Request
Bash
curl -X POST https://api.myopcs.com/api/v1/products/my-saas-app/revenue \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 99.00,
"currency": "USD",
"type": "subscription",
"source": "stripe",
"date": "2024-01-15"
}'Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Revenue amount (positive number) |
currency | string | No | Currency code, default: USD |
type | string | Yes | Revenue type (see Revenue Types) |
source | string | No | Payment source (free text) |
note | string | No | Optional note |
date | string | Yes | Date (YYYY-MM-DD) |
Response
{}JSON
{
"data": {
"id": "clxabc123",
"amount": 99.00,
"currency": "USD",
"type": "subscription",
"source": "stripe",
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
}GET
List Costs
Returns all cost records for a product.
Request
Bash
curl https://api.myopcs.com/api/v1/products/my-saas-app/costs \
-H "Authorization: Bearer YOUR_API_KEY"Response
{}JSON
{
"data": [
{
"id": "clxdef456",
"name": "Vercel Pro",
"amount": 20.00,
"currency": "USD",
"category": "INFRASTRUCTURE",
"isRecurring": true,
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
]
}GET
Retrieve Cost
Retrieves a single cost record by ID.
Request
Bash
curl https://api.myopcs.com/api/v1/products/my-saas-app/costs/clxdef456 \
-H "Authorization: Bearer YOUR_API_KEY"Response
{}JSON
{
"data": {
"id": "clxdef456",
"name": "Vercel Pro",
"amount": 20.00,
"currency": "USD",
"category": "INFRASTRUCTURE",
"isRecurring": true,
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
}POST
Create Cost
Creates a new cost record for a product.
Request
Bash
curl -X POST https://api.myopcs.com/api/v1/products/my-saas-app/costs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Vercel Pro",
"amount": 20.00,
"currency": "USD",
"category": "INFRASTRUCTURE",
"isRecurring": true,
"date": "2024-01-15"
}'Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Cost item name |
amount | number | Yes | Cost amount (positive number) |
currency | string | No | Currency code, default: USD |
category | string | Yes | Cost category (see Cost Categories) |
isRecurring | boolean | No | Whether recurring, default: false |
note | string | No | Optional note |
date | string | Yes | Date (YYYY-MM-DD) |
Response
{}JSON
{
"data": {
"id": "clxdef456",
"name": "Vercel Pro",
"amount": 20.00,
"currency": "USD",
"category": "INFRASTRUCTURE",
"isRecurring": true,
"note": null,
"date": "2024-01-15",
"createdAt": "2024-01-15T10:30:00Z"
}
}