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 Object

The revenue object represents a single revenue record.

AttributeTypeDescription
idstringUnique identifier (cuid)
amountnumberRevenue amount
currencystringCurrency code (default: USD)
typestringRevenue type (see Revenue Types)
sourcestring | nullPayment source (free text)
notestring | nullOptional note
datestringDate (YYYY-MM-DD)
createdAtstringISO 8601 timestamp

Cost Object

The cost object represents a single cost record.

AttributeTypeDescription
idstringUnique identifier (cuid)
namestringCost item name
amountnumberCost amount
currencystringCurrency code (default: USD)
categorystringCost category (see Cost Categories)
isRecurringbooleanWhether this is a recurring cost
notestring | nullOptional note
datestringDate (YYYY-MM-DD)
createdAtstringISO 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

ParameterTypeRequiredDescription
amountnumberYesRevenue amount (positive number)
currencystringNoCurrency code, default: USD
typestringYesRevenue type (see Revenue Types)
sourcestringNoPayment source (free text)
notestringNoOptional note
datestringYesDate (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

ParameterTypeRequiredDescription
namestringYesCost item name
amountnumberYesCost amount (positive number)
currencystringNoCurrency code, default: USD
categorystringYesCost category (see Cost Categories)
isRecurringbooleanNoWhether recurring, default: false
notestringNoOptional note
datestringYesDate (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"
  }
}