Download OpenAPI specification:Download
API for billing, subscriptions, metering, and webhook handling
Returns the payment method on file (card or PayPal) and all active subscriptions (Stripe web, Google Play IAP, Apple App Store IAP) for the authenticated user. Requires a valid FxA OAuth access token with appropriate scopes.
{- "billing_name": "string",
- "exp_month": 0,
- "exp_year": 0,
- "last4": "string",
- "payment_provider": "string",
- "payment_type": "string",
- "paypal_payment_error": "string",
- "brand": "string",
- "subscriptions": [
- {
- "_subscription_type": "web",
- "created": 0,
- "current_period_end": 0,
- "current_period_start": 0,
- "cancel_at_period_end": true,
- "end_at": 0,
- "plan_id": "string",
- "product_id": "string",
- "priceInfo": {
- "amount": 0,
- "currency": "string",
- "interval": "string",
- "interval_count": 0
}, - "status": "string",
- "subscription_id": "string"
}
]
}Records a usage event for a metered product. Events are deduplicated by the id field — retries with the same id will not double-count within the retention window. Requires a valid metering service credential.
| id required | string [ 1 .. 256 ] characters Stable idempotency key for this usage event; retries with the same id will not double-count |
| userIdentifier required | string [ 1 .. 256 ] characters Unique identifier for the user being metered |
| slug required | string [ 1 .. 128 ] characters ^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$ Meter slug identifier (lowercase alphanumeric, hyphens, underscores) |
| amount required | number > 0 Usage amount to record (must be positive) |
| timestamp | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... ISO 8601 timestamp with offset; defaults to server time if omitted |
{- "id": "string",
- "userIdentifier": "string",
- "slug": "string",
- "amount": 0,
- "timestamp": "2019-08-24T14:15:22Z"
}Returns the current usage, limit, and metering window for a specific user and meter slug. Requires a valid metering service credential.
| userIdentifier required | string Unique identifier for the user being queried |
| slug required | string Meter slug identifier to query usage for |
{- "usage": 0,
- "limit": 0,
- "grantedAmount": 0,
- "unit": "string",
- "windowStart": "2019-08-24T14:15:22Z",
- "windowEnd": "2019-08-24T14:15:22Z"
}Grants additional usage against a meter for a user, raising the effective limit reported by usage queries. Requires a valid metering service credential.
| userIdentifier required | string [ 1 .. 256 ] characters User identifier the grant applies to |
| slug required | string [ 1 .. 128 ] characters ^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$ Meter slug the grant applies to |
| amount required | number > 0 Additional usage to grant on top of the meter limit (must be a positive, finite number) |
| reason | string [ 1 .. 1024 ] characters Optional human-readable note recorded for audit |
required | object or object or object Default: {"type":"unending"} When the grant stops applying: unending, the end of the meter’s current window, or an explicit expiry |
{- "userIdentifier": "string",
- "slug": "string",
- "amount": 0,
- "reason": "string",
- "lifetime": {
- "type": "unending"
}
}{- "id": "string",
- "userIdentifier": "string",
- "slug": "string",
- "amount": 0,
- "grantedBy": "string",
- "reason": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "active": true
}Returns all usage grants for a user, optionally filtered by meter slug. Each grant includes an active flag reflecting whether it currently applies. Requires a valid metering service credential. Metering clients are mutually trusted: any authenticated client may read grants created by any other client.
| userIdentifier required | string Unique identifier for the user whose grants are listed |
| slug | any Optional meter slug to filter the grants by |
{- "grants": [
- {
- "id": "string",
- "userIdentifier": "string",
- "slug": "string",
- "amount": 0,
- "grantedBy": "string",
- "reason": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "expiresAt": "2019-08-24T14:15:22Z",
- "active": true
}
]
}Deletes a single usage grant by its identifier. Requires a valid metering service credential. Metering clients are mutually trusted: any authenticated client may delete a grant created by any other client.
| grantId required | string Identifier of the grant to delete |