API

SparkCredit

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
POST /api/v1/organizations/{org_slug}/spark_credits create Success
GET /api/v1/organizations/{org_slug}/spark_credits load SparkCredits billing summary
GET /api/v1/organizations/{org_slug}/spark_credits/daily_usage load Current-month daily Spark usage in UTC
PATCH /api/v1/organizations/{org_slug}/spark_credits patch Updated SparkCredits billing summary
PUT /api/v1/organizations/{org_slug}/spark_credits update Success

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

spark_credit, err := client.SparkCredit(nil).Load(map[string]any{"organization_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(spark_credit)
created, err := client.SparkCredit(nil).Create(map[string]any{"organization_id": "example", "kind": "example", "request_key": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(created)
updated, err := client.SparkCredit(nil).Update(map[string]any{"organization_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(updated)
patched, err := client.SparkCredit(nil).Patch(map[string]any{"organization_id": "example", "view": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(patched)

Lua

Construct client as shown in the Lua setup, then call the operations:

local spark_credit, err = client:SparkCredit():load({ organization_id = "example" })
local created, err = client:SparkCredit():create({ organization_id = "example", kind = "example", request_key = "example" })
local updated, err = client:SparkCredit():update({ organization_id = "example" })
local patched, err = client:SparkCredit():patch({ organization_id = "example", view = "example" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$spark_credit = $client->SparkCredit()->load(["organization_id" => "example"]);
$created = $client->SparkCredit()->create(["organization_id" => "example", "kind" => "example", "request_key" => "example"]);
$updated = $client->SparkCredit()->update(["organization_id" => "example"]);
$patched = $client->SparkCredit()->patch(["organization_id" => "example", "view" => "example"]);

Python

Construct client as shown in the Python setup, then call the operations:

spark_credit = client.SparkCredit().load({"organization_id": "example"})
created = client.SparkCredit().create({ "organization_id": "example", "kind": "example", "request_key": "example" })
updated = client.SparkCredit().update({"organization_id": "example"})
patched = client.SparkCredit().patch({"organization_id": "example", "view": "example"})

Ruby

Construct client as shown in the Ruby setup, then call the operations:

spark_credit = client.SparkCredit.load({ "organization_id" => "example" })
created = client.SparkCredit.create({ "organization_id" => "example", "kind" => "example", "request_key" => "example" })
updated = client.SparkCredit.update({ "organization_id" => "example" })
patched = client.SparkCredit.patch({ "organization_id" => "example", "view" => "example" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const spark_credit = await client.SparkCredit().load({ organization_id: "example" })
const created = await client.SparkCredit().create({ organization_id: "example", kind: "example", request_key: "example" })
const updated = await client.SparkCredit().update({ organization_id: "example" })
const patched = await client.SparkCredit().patch({ organization_id: "example", view: "example" })

Fields

Field Type Required Description
amount_cents integer No Purchase amount in USD cents.
autofill any Yes Autofill
autofill_payment_unconfirmed boolean Yes Autofill Payment Unconfirmed
available_usd string Yes Available Usd
billing_unit string No Compute minute quote version returned by the billing summary.
can_manage boolean Yes Can Manage
compute_minutes object No Compute Minutes
compute_usd string No Compute Usd
credits_per_usd integer Yes Credits Per Usd
inference_usd string No Inference Usd
kind string Yes Kind
payment_method one,object,null Yes Payment Method
payments_enabled boolean Yes Payments Enabled
plan one,string,null Yes Plan
plans array Yes Plans
quoted_credits_cents integer No Grant shown for a top-up or subscription, in usage cents.
quoted_price_cents integer No Monthly cash price shown for a subscription, in USD cents.
refill_limits_cents array Yes Refill Limits Cents
refill_options array Yes Refill Options
refill_thresholds_cents array Yes Refill Thresholds Cents
request_key string Yes Request Key
settings any Yes Settings
starter_cents integer Yes Starter Cents
top_up_max_cents integer Yes Maximum manual top-up, in USD cents.
top_up_step_cents integer Yes Minimum manual top-up and increment, in USD cents.

create

POST /api/v1/organizations/{org_slug}/spark_credits

Operation ID: post_api_v1_organizations_org_slug_spark_credits.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes

Request body

application/json

Property Type Required Description
amount_cents integer No Purchase amount in USD cents. Compute top-ups use $10 increments; inference uses its USD presets.
billing_unit string No Compute minute quote version returned by the billing summary.
kind enum: top_up, inference_top_up, subscribe, payment_method, manage_plan Yes
plan string No
quoted_credits_cents integer No Grant shown for a top-up or subscription, in usage cents.
quoted_price_cents integer No Monthly cash price shown for a subscription, in USD cents.
request_key string (uuid) Yes

Responses

200: Success

application/json

The response is object.

201: Hosted Stripe session

application/json

Property Type Required Description
url string Yes
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

load

GET /api/v1/organizations/{org_slug}/spark_credits

Operation ID: api_v1_spark_credits.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes
view query enum: wallet No Omit monthly usage from the wallet response.

Responses

200: SparkCredits billing summary

application/json

Property Type Required Description
autofill object or null Yes
autofill_payment_unconfirmed boolean Yes
available_usd string Yes
can_manage boolean Yes
compute_minutes object No
compute_minutes.available string Yes
compute_minutes.balance_runtime object Yes
compute_minutes.balance_runtime.example_daily_hours integer Yes
compute_minutes.balance_runtime.example_days integer Yes
compute_minutes.balance_runtime.parallel_runners integer Yes
compute_minutes.balance_runtime.runners array of object Yes
compute_minutes.balance_runtime.runners[].memory_gib integer Yes
compute_minutes.balance_runtime.runners[].minutes integer Yes
compute_minutes.balance_runtime.runners[].name string Yes
compute_minutes.balance_runtime.runners[].vcpus number Yes
compute_minutes.balance_runtime.single_runner_daily_minutes integer Yes
compute_minutes.baseline_gib integer Yes
compute_minutes.baseline_vcpu integer Yes
compute_minutes.billing_unit string Yes
compute_minutes.included string Yes
compute_minutes.inference_available_usd string Yes
compute_minutes.inference_top_up_cents array of integer Yes
compute_minutes.minutes_per_dollar integer Yes
compute_minutes.purchased string Yes
compute_minutes.top_up_runtime object Yes
compute_minutes.top_up_runtime.example_daily_hours integer Yes
compute_minutes.top_up_runtime.example_days integer Yes
compute_minutes.top_up_runtime.parallel_runners integer Yes
compute_minutes.top_up_runtime.runners array of object Yes
compute_minutes.top_up_runtime.runners[].memory_gib integer Yes
compute_minutes.top_up_runtime.runners[].minutes integer Yes
compute_minutes.top_up_runtime.runners[].name string Yes
compute_minutes.top_up_runtime.runners[].vcpus number Yes
compute_minutes.top_up_runtime.single_runner_daily_minutes integer Yes
compute_minutes.used string No
compute_usd string No
credits_per_usd integer Yes
inference_usd string No
payment_method object,null Yes
payment_method.brand string Yes
payment_method.last4 string Yes
payments_enabled boolean Yes
plan string,null Yes
plans array of object Yes
plans[].bonus_credits_cents integer Yes
plans[].credits_cents integer Yes
plans[].extra_minutes_vs_payg integer No
plans[].included_minutes integer No
plans[].key string Yes
plans[].name string Yes
plans[].price_cents integer Yes
plans[].runtime object No
plans[].runtime.example_daily_hours integer Yes
plans[].runtime.example_days integer Yes
plans[].runtime.parallel_runners integer Yes
plans[].runtime.runners array of object Yes
plans[].runtime.runners[].memory_gib integer Yes
plans[].runtime.runners[].minutes integer Yes
plans[].runtime.runners[].name string Yes
plans[].runtime.runners[].vcpus number Yes
plans[].runtime.single_runner_daily_minutes integer Yes
refill_limits_cents array of integer Yes
refill_options array of object Yes
refill_options[].amount_cents integer Yes Cash price in USD cents.
refill_options[].credits_cents integer Yes Included usage value in USD cents.
refill_thresholds_cents array of integer Yes
starter_cents integer Yes
top_up_max_cents integer Yes Maximum manual top-up, in USD cents.
top_up_step_cents integer Yes Minimum manual top-up and increment, in USD cents.
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

GET /api/v1/organizations/{org_slug}/spark_credits/daily_usage

Operation ID: daily_usage_api_v1_spark_credits.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes

Responses

200: Current-month daily Spark usage in UTC

application/json

Property Type Required Description
agents array of object Yes
agents[].key string Yes
agents[].label string Yes
agents[].points array of object Yes
agents[].points[].compute_minutes number Yes
agents[].points[].inference_usd number Yes
agents[].total object Yes
agents[].total.compute_minutes number Yes
agents[].total.inference_usd number Yes
all object Yes
all.key string Yes
all.label string Yes
all.points array of object Yes
all.points[].compute_minutes number Yes
all.points[].inference_usd number Yes
all.total object Yes
all.total.compute_minutes number Yes
all.total.inference_usd number Yes
days array of string (date) Yes
owners array of object Yes
owners[].key string Yes
owners[].label string Yes
owners[].points array of object Yes
owners[].points[].compute_minutes number Yes
owners[].points[].inference_usd number Yes
owners[].total object Yes
owners[].total.compute_minutes number Yes
owners[].total.inference_usd number Yes
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

patch

PATCH /api/v1/organizations/{org_slug}/spark_credits

Operation ID: patch_api_v1_organizations_org_slug_spark_credits.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes
view query enum: wallet No Omit monthly usage from the wallet response.

Request body

application/json

Property Type Required Description
settings object and object or null Yes

Responses

200: Updated SparkCredits billing summary

application/json

Property Type Required Description
autofill object or null Yes
autofill_payment_unconfirmed boolean Yes
available_usd string Yes
can_manage boolean Yes
compute_minutes object No
compute_minutes.available string Yes
compute_minutes.balance_runtime object Yes
compute_minutes.balance_runtime.example_daily_hours integer Yes
compute_minutes.balance_runtime.example_days integer Yes
compute_minutes.balance_runtime.parallel_runners integer Yes
compute_minutes.balance_runtime.runners array of object Yes
compute_minutes.balance_runtime.runners[].memory_gib integer Yes
compute_minutes.balance_runtime.runners[].minutes integer Yes
compute_minutes.balance_runtime.runners[].name string Yes
compute_minutes.balance_runtime.runners[].vcpus number Yes
compute_minutes.balance_runtime.single_runner_daily_minutes integer Yes
compute_minutes.baseline_gib integer Yes
compute_minutes.baseline_vcpu integer Yes
compute_minutes.billing_unit string Yes
compute_minutes.included string Yes
compute_minutes.inference_available_usd string Yes
compute_minutes.inference_top_up_cents array of integer Yes
compute_minutes.minutes_per_dollar integer Yes
compute_minutes.purchased string Yes
compute_minutes.top_up_runtime object Yes
compute_minutes.top_up_runtime.example_daily_hours integer Yes
compute_minutes.top_up_runtime.example_days integer Yes
compute_minutes.top_up_runtime.parallel_runners integer Yes
compute_minutes.top_up_runtime.runners array of object Yes
compute_minutes.top_up_runtime.runners[].memory_gib integer Yes
compute_minutes.top_up_runtime.runners[].minutes integer Yes
compute_minutes.top_up_runtime.runners[].name string Yes
compute_minutes.top_up_runtime.runners[].vcpus number Yes
compute_minutes.top_up_runtime.single_runner_daily_minutes integer Yes
compute_minutes.used string No
compute_usd string No
credits_per_usd integer Yes
inference_usd string No
payment_method object,null Yes
payment_method.brand string Yes
payment_method.last4 string Yes
payments_enabled boolean Yes
plan string,null Yes
plans array of object Yes
plans[].bonus_credits_cents integer Yes
plans[].credits_cents integer Yes
plans[].extra_minutes_vs_payg integer No
plans[].included_minutes integer No
plans[].key string Yes
plans[].name string Yes
plans[].price_cents integer Yes
plans[].runtime object No
plans[].runtime.example_daily_hours integer Yes
plans[].runtime.example_days integer Yes
plans[].runtime.parallel_runners integer Yes
plans[].runtime.runners array of object Yes
plans[].runtime.runners[].memory_gib integer Yes
plans[].runtime.runners[].minutes integer Yes
plans[].runtime.runners[].name string Yes
plans[].runtime.runners[].vcpus number Yes
plans[].runtime.single_runner_daily_minutes integer Yes
refill_limits_cents array of integer Yes
refill_options array of object Yes
refill_options[].amount_cents integer Yes Cash price in USD cents.
refill_options[].credits_cents integer Yes Included usage value in USD cents.
refill_thresholds_cents array of integer Yes
starter_cents integer Yes
top_up_max_cents integer Yes Maximum manual top-up, in USD cents.
top_up_step_cents integer Yes Minimum manual top-up and increment, in USD cents.
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

update

PUT /api/v1/organizations/{org_slug}/spark_credits

Operation ID: put_api_v1_organizations_org_slug_spark_credits.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes

Request body

application/json

The request body is object.

Responses

200: Success

application/json

The response is object.

401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway