Organization usage and billing
Return an organization's accounting balances and insolvency state.
Authorization
bearerAuth In: header
Path Parameters
1 <= lengthResponse Body
application/json
curl -X GET "https://example.com/v1/orgs/aa/accounting"{ "balance": { "aiCreditMicrousd": 1, "ciCreditMicrousd": 1, "hardMicrousd": 1, "hasUnpricedUsage": false, "insolvent": false, "pendingAiMicrousd": 1, "pendingCiMicrousd": 1, "pendingMicrousd": 1, "softMicrousd": 1, "totalMicrousd": 1 }, "ownerId": "abc123", "ownerType": "organization"}List organization daily charge allocations, optionally by category.
Authorization
bearerAuth In: header
Path Parameters
1 <= lengthQuery Parameters
Optional spending category.
Value in
- "ai"
- "ci"
Maximum daily allocation rows.
int641 <= value <= 500100Response Body
application/json
curl -X GET "https://example.com/v1/orgs/aa/accounting/charges?category=ci&limit=2"{ "items": [ { "amountMicrousd": 1, "category": "ci", "date": "1970-01-01", "fundingSource": "soft" } ]}Return organization resource spending chart data.
Authorization
bearerAuth In: header
Path Parameters
1 <= lengthQuery Parameters
Chart timeframe.
"last_24_hours"Value in
- "last_24_hours"
- "last_7_days"
- "month_to_date"
Response Body
application/json
curl -X GET "https://example.com/v1/orgs/aa/accounting/chart?timeframe=last_7_days"{ "from": "1970-01-01T00:00:01Z", "points": [ { "aiCacheReadTokens": 1, "aiCacheWriteTokens": 1, "aiInputTokens": 1, "aiMicrousd": 1, "aiOutputTokens": 1, "ciMicrousd": 1, "ciMinutes": 1, "hasUnpricedUsage": false, "timestamp": "1970-01-01T00:00:01Z", "totalMicrousd": 1 } ], "timeframe": "last_7_days", "to": "1970-01-01T00:00:01Z"}Redeem a category-specific coupon for an organization.
Authorization
bearerAuth In: header
Path Parameters
1 <= lengthRequest Body
application/json
Coupon redemption request body.
TypeScript Definitions
Use the request body type in TypeScript.
Category-credit coupon redemption request.
Response Body
application/json
curl -X POST "https://example.com/v1/orgs/aa/accounting/coupons/redeem" \ -H "Content-Type: application/json" \ -d '{ "code": "aa" }'{ "amountMicrousd": 1, "balance": { "aiCreditMicrousd": 1, "ciCreditMicrousd": 1, "hardMicrousd": 1, "hasUnpricedUsage": false, "insolvent": false, "pendingAiMicrousd": 1, "pendingCiMicrousd": 1, "pendingMicrousd": 1, "softMicrousd": 1, "totalMicrousd": 1 }, "category": "ci", "code": "abc123"}Billing summary for an organization.
Authorization
bearerAuth In: header
Path Parameters
Organization handle or Forgejo login.
1 <= lengthResponse Body
application/json
curl -X GET "https://example.com/v1/orgs/aa/billing""abc123"Start Stripe Checkout for an organization subscription plan.
Authorization
bearerAuth In: header
Path Parameters
Organization handle or Forgejo login.
1 <= lengthRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/v1/orgs/aa/billing/checkout" \ -H "Content-Type: application/json" \ -d '{ "cancelUrl": "aa", "planKey": "aa", "successUrl": "aa" }'"abc123"Open the Stripe customer portal for an organization.
Authorization
bearerAuth In: header
Path Parameters
Organization handle or Forgejo login.
1 <= lengthRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/v1/orgs/aa/billing/portal" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "aa" }'"abc123"