Skip to main content
POST
/
v0
/
sources
Create
curl --request POST \
  --url https://api.paygentic.io/v0/sources \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "config": {},
  "description": "<string>",
  "enabled": true,
  "metadata": {},
  "name": "<string>",
  "planId": "<string>",
  "processingMode": "automatic",
  "type": "stripe_revenue"
}'
{
  "id": "src_x3y4z5a6b7c8d9e0",
  "config": {
    "ampersandProjectId": "proj_123456"
  },
  "createdAt": "2024-01-25T12:00:00Z",
  "description": "Automated usage tracking from Stripe revenue data",
  "enabled": true,
  "metadata": {
    "billableMetricMapping": {
      "revenue": "bm_n9o0p1q2r3s4t5u6"
    }
  },
  "name": "Stripe Revenue Integration",
  "planId": "plan_f1g2h3i4j5k6l7m8",
  "processingMode": "automatic",
  "type": "stripe_revenue",
  "updatedAt": "2024-01-25T12:00:00Z"
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
name
string
required

Display label for the external data source. Sample values: 'Stripe Revenue Integration', 'LLM Usage Tracker', 'Data Processing Monitor', 'ML Compute Usage Source'

planId
string
required

The plan to associate this source with

type
enum<string>
required

The type of source. Currently only 'stripe_revenue' is supported.

Available options:
stripe_revenue
config
object

Configuration specific to the source type. For stripe_revenue, must include ampersandProjectId.

description
string

Optional explanation of the source's purpose. Sample values: 'Automated usage tracking from Stripe revenue data', 'Language model token consumption monitoring', 'Data warehouse query tracking', 'Machine learning inference usage collection'

enabled
boolean
default:true

Whether the source is enabled

metadata
object

Metadata for the source. For stripe_revenue, must include billableMetricMapping with revenue (billable metric ID).

processingMode
enum<string>
default:automatic

How events are processed - automatic (immediate) or manual (requires approval)

Available options:
automatic,
manual

Response

Source created successfully

id
string
required

Unique identifier for a source

object
enum<string>
required
Available options:
source
createdAt
string<date-time>
required
enabled
boolean
required
merchantId
string
required

Unique identifier for an organization

name
string
required
planId
string
required

Unique identifier for a plan

processingMode
enum<string>
required
Available options:
automatic,
manual
type
enum<string>
required
Available options:
stripe_revenue
updatedAt
string<date-time>
required
config
object
description
string
metadata
object