Menu
Platform
AI
App store purchases
Credits
Database
Flags
Generated Assets
Monitoring
Notifications
Organizations
Payments
- Payments
- Payments quickstart
- Checkout policies
- Checkout sessions
- Customer subscriptions
- Entitlement grants
- Exchange rates
- Licence keys
- Licence tokens
- Merchant accounts
- Portal sessions
- Price catalogs
- Revenue
- Revenue facts
- Revenue sources
- Tax threshold statuses
- Usage events
- Usage invoices
- Usage meter prices
- Usage meters
- Usage reservations
- Usage settings
- Usage tiers
Sandboxes
Webhooks
Getting Started
Authentication
KV Store
Deploy & Infrastructure
Reference
Batch ingest on an usage event
Records a batch of already-incurred usage from the merchant's own servers (Stripe's meter-event model): the caller is a key of the…
Records a batch of already-incurred usage from the merchant's own servers (Stripe's meter-event model): the caller is a key of the merchant's own org holding the exact grant billing:metering:ingest, which no wildcard covers, and each event names its subject with no subject proof. Each event is keyed by its project, meter, meter version and event id: a replay is a no-op (duplicate), and the same key with different content is a conflict and never counted. One result per event, in request order.
- Path
POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/usage_events:batchIngest - Scope
billing:metering:ingest - Effect
write— a successful call changes state. - Collection usage_events
#Request
| Field | Type | What it is |
|---|---|---|
parent | string | The environment to record in. Required. |
usage_events | IngestedUsageEvent[] | 1 to 500 events. Required. |
#IngestedUsageEvent
| Field | Type | What it is |
|---|---|---|
event_id | string | The emitter's id of this event, 1 to 128 characters of [A-Za-z0-9._:-]; with the meter and its version, the dedupe key. Required. |
meter | string | The meter. Required. |
meter_version | int32 | The emitter's version of the meter's definition, 1 or more. Required. |
subject | Subject | Who used it, as attributed by the emitter. Required. |
quantity | int64 | How much, 1 to 2^40. Required. |
occurred_time | timestamp | When it happened. Required. |
#Subject
| Field | Type | What it is |
|---|---|---|
end_user | string | An end user's id (Sylphx Auth, or the app's own OIDC issuer). One of the kind group. |
customer_organization | string | A customer organization's id. One of the kind group. |
#Response
| Field | Type | What it is |
|---|---|---|
results | IngestedUsageEventResult[] | One per event, in request order. |
#IngestedUsageEventResult
| Field | Type | What it is |
|---|---|---|
event_id | string | The event's event_id. |
outcome | string | accepted (recorded now), duplicate (already recorded with the same content: a no-op), conflict (its key was recorded with other content; this one is never counted) or rejected (refused; see reason). |
reason | string | For rejected: invalid (a field is out of range), unpriced (no active meter with a price in force at occurred_time) or reservation_required (the meter records only through a reservation); empty otherwise. |
usage_event | string | The UsageEvent that counts this usage, for accepted and duplicate. |
#Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.INVALID_FIELD— A field failed validation.UNKNOWN_FIELD— The request has a field the schema does not know.INVALID_STATE— The Resource is in a state that forbids the call.
Every error arrives in the body Errors describes.
#Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/usage_events:batchIngest" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"usage_events":[{"event_id":"…","meter":"…","meter_version":1,"occurred_time":{},"quantity":1,"subject":{}}]}'