Get Started

Revenue

API endpoint for retrieving workspace revenue transactions and analytics

GET/revenue

Headers

x-api-keystringrequired

Your Track My Posts API key

Query Parameters

workspaceSlugstringrequired

Workspace slug identifier

Example: my-workspace

sincestring

Start date filter (YYYY-MM-DD or ISO 8601 format)

Example: 2024-01-01

untilstring

End date filter (YYYY-MM-DD or ISO 8601 format)

Example: 2024-12-31

prevSincestring

Previous period start date for comparison (YYYY-MM-DD or ISO 8601 format). When provided with prevUntil, the response includes previousSummary for period-over-period comparisons.

Example: 2023-12-01

prevUntilstring

Previous period end date for comparison (YYYY-MM-DD or ISO 8601 format). When provided with prevSince, the response includes previousSummary for period-over-period comparisons.

Example: 2023-12-31

providerstring

Filter by integration provider. Use 'all' to include all providers.

Example: stripe

eventTypesarray

Filter by event types (comma-separated or array)

Example: purchaserenewal

pageinteger

Page number (1-indexed)

Example: 1

pageSizeinteger

Number of items per page (alias: limit)

Example: 20

limitinteger

Number of items per page (alias for pageSize)

Example: 20

includeSeriesboolean

Include time series data in response

sortBystring

Field to sort by

Example: occurredAt

sortOrderstring

Sort order

Example: desc

Responses

200Successful response with revenue data
400Bad request - validation error
401Unauthorized - authentication required
403Forbidden - insufficient permissions
404Not found - workspace not found
500Internal server error
curl "https://api.trackmyposts.com/revenue?workspaceSlug=my-workspace&since=2024-01-01&until=2024-12-31&prevSince=2023-12-01&prevUntil=2023-12-31&provider=stripe&eventTypes=purchase%2Crenewal&page=1&pageSize=20&limit=20&includeSeries=false&sortBy=occurredAt&sortOrder=desc" \
  -H "x-api-key: YOUR_API_KEY"
{
  "items": [
    {
      "id": "evt_1234567890",
      "workspaceId": "workspace-123",
      "integrationId": "int_1234567890",
      "eventType": "purchase",
      "amountCents": 999,
      "currency": "USD",
      "externalId": "txn_1234567890",
      "metadata": {
        "productId": "prod_123"
      },
      "occurredAt": "2024-01-15T10:30:00.000Z",
      "createdAt": "2024-01-15T10:30:05.000Z",
      "provider": "stripe"
    }
  ],
  "page": 1,
  "limit": 20,
  "total": 150,
  "totalPages": 8,
  "hasNext": true,
  "hasPrev": false,
  "summary": {
    "currency": "USD",
    "grossRevenueCents": 99900,
    "netRevenueCents": 94900,
    "refundCents": 5000,
    "recurringNetCents": 45000,
    "purchaseCount": 50,
    "subscriptionPurchaseCount": 30,
    "renewalCount": 20,
    "refundCount": 5,
    "cancellationCount": 2,
    "positiveChargeCount": 100,
    "trialCount": 10,
    "trialConversionCount": 8,
    "trialConversionRate": 0.8,
    "cancellationRate": 0.04,
    "refundRate": 0.05,
    "mrrCents": 94900,
    "averageOrderValueCents": 949,
    "uniqueCancelledSubs": 2,
    "uniqueActiveSubs": 48
  },
  "previousSummary": {
    "currency": "USD",
    "grossRevenueCents": 85000,
    "netRevenueCents": 81000,
    "refundCents": 4000,
    "recurringNetCents": 38000,
    "purchaseCount": 42,
    "subscriptionPurchaseCount": 25,
    "renewalCount": 18,
    "refundCount": 4,
    "cancellationCount": 1,
    "positiveChargeCount": 85,
    "trialCount": 8,
    "trialConversionCount": 6,
    "trialConversionRate": 0.75,
    "cancellationRate": 0.023,
    "refundRate": 0.047,
    "mrrCents": 81000,
    "averageOrderValueCents": 953,
    "uniqueCancelledSubs": 1,
    "uniqueActiveSubs": 42
  }
}

Data Structures

View all 5 data structuresRevenue

Explore all data structures used in this API endpoint