POST
/
v1
/
billing
/
{organizationId}
/
top-up
TypeScript client
import { OctosparkClient } from '@octospark/sdk'

const client = new OctosparkClient({
  token: process.env.OCTOSPARK_TOKEN
})

const response = await client.billing.createTopUpSession({
  organizationId: process.env.OCTOSPARK_ORGANIZATION_ID ?? "organizationId",
  body: {},
})
{
  "id": "<string>",
  "url": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

organizationId
string
required

Organization id (UUID). Discover ids via the list organizations endpoint or the agent context.

Body

application/json
amountDecimillicents
integer
required

One-time credit purchase amount in decimillicents (10000000 decimillicents = $1, so 100000 = 1 cent); min 100000 ($0.01), max 5000000000 ($500).

Required range: 100000 <= x <= 5000000000
Example:

200000000

successUrl
string
required

http(s) URL Stripe redirects the user to after a successful checkout.

Pattern: ^https?:\/\/
Example:

"https://app.octospark.ai/billing?topup=success"

cancelUrl
string
required

http(s) URL Stripe redirects the user to when they abandon the checkout.

Pattern: ^https?:\/\/
Example:

"https://app.octospark.ai/billing?topup=cancelled"

Response

Success

id
string
required
url
string
required