Cloud API
This page documents the 25 gateway endpoints tagged cloud in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| POST | /cloud/signup | Sign up for Spanway Cloud |
| POST | /cloud/verify | Verify a Cloud signup and create the workspace |
| POST | /cloud/resend | Mail a fresh Cloud verification link |
| GET | /cloud/tenant | Read your Cloud workspace |
| PATCH | /cloud/tenant | Rename your Cloud workspace |
| GET | /cloud/tenant/export | Download your Cloud workspace as an import bundle |
| POST | /cloud/tenant/cancel | Close your Cloud workspace |
| POST | /cloud/subscribe | Start a Stripe checkout for a paid plan |
| POST | /cloud/portal | Open the Stripe billing portal |
| GET | /cloud/tenants | List every Cloud tenant |
| GET | /cloud/tenants/{tenant_id} | Read one Cloud tenant |
| PATCH | /cloud/tenants/{tenant_id} | Move a Cloud tenant to another plan |
| POST | /cloud/tenants/{tenant_id}/suspend | Suspend a Cloud tenant |
| POST | /cloud/tenants/{tenant_id}/reinstate | Reinstate a suspended Cloud tenant |
| GET | /cloud/plans | List the Cloud plans and prices |
| GET | /cloud/credits | Read your prepaid credit balance and ledger |
| POST | /cloud/credits/purchase | Start a Stripe checkout to buy credits |
| GET | /cloud/credits/auto-topup | Read your auto top-up settings |
| PUT | /cloud/credits/auto-topup | Turn auto top-up on |
| DELETE | /cloud/credits/auto-topup | Turn auto top-up off and forget the card |
| GET | /cloud/tenant/credentials | List your own provider keys |
| POST | /cloud/tenant/credentials | Add your own provider key |
| DELETE | /cloud/tenant/credentials/{credential_id} | Remove one of your provider keys |
| POST | /cloud/import | Import a Cloud workspace bundle into this gateway |
| GET | /cloud/billing/status | Check that Cloud usage can be priced and overage metered |
Endpoints
POST /cloud/signup
Sign up for Spanway Cloud
Start a new Cloud workspace. Anyone may call it without a key. The legal name and address are screened
against the sanctions lists, then a tenant is recorded on the free plan and a verification link is mailed.
Nothing is provisioned until the link is used, and the admin password is chosen only then, by whoever holds
the link. Paid plans start only from a completed Stripe checkout or a proxy admin. Signing up again while the
address is pending mails a fresh link that replaces the earlier one, and takes the new company unless
provisioning has already started. A workspace is created only in the region this gateway serves, so a signup
that chooses another region stores nothing and is pointed at that region's signup page.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#data-regions)
Request body (application/json, schema SignupRequest):
| Field | Type | Required | Description |
|---|---|---|---|
accepted_terms | true | Yes | Accepted Terms |
email | string | Yes | |
company | string | Yes | Company |
legal_name | string | Yes | Legal Name |
country | string | Yes | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
region | enum: "us-east-1", "eu-central-1" or null | No | Where the workspace and its data live. Empty means the region this gateway serves |
Example request:
curl -X POST "http://localhost:4000/cloud/signup" \
-H "Content-Type: application/json" \
-d '{
"accepted_terms": true,
"email": "admin@example.com",
"company": "Example Corp",
"legal_name": "Example Corp Inc.",
"country": "US",
"subdivision": "US-TX",
"city": "Austin",
"address_line": "100 Example Street",
"postal_code": "78701",
"region": "us-east-1"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The signup is recorded and a verification link is on its way | application/json SignupResponse |
| 400 | The email address is not accepted, or the region is not offered for new workspaces | application/json ErrorDetail |
| 403 | The address is not on general_settings.cloud.signup_allowlist, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 409 | The address already belongs to a verified tenant | application/json ErrorDetail |
| 421 | The chosen region is served by another gateway, so the signup has to be sent to its signup page | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | More than 10 signups came from this address in the last hour | application/json ErrorDetail |
| 451 | The address, account or region is refused under the sanctions policy | application/json DenialBody |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
under_review | boolean | No | Under Review |
POST /cloud/verify
Verify a Cloud signup and create the workspace
Finish a signup from the link in the verification mail. Anyone holding the link may call it without a key.
It creates the organization, its admin user with the password given here, a default team carrying the free
plan's limits and a first key scoped to it. The key is shown once, so store it right away.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#signup-and-verification)
Request body (application/json, schema VerifyRequest):
| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Token |
password | string | Yes | Password |
Example request:
curl -X POST "http://localhost:4000/cloud/verify" \
-H "Content-Type: application/json" \
-d '{
"token": "vt_example_token",
"password": "correct-horse-battery-staple"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The workspace exists and its first key is shown this once | application/json VerifyResponse |
| 400 | The link is unknown or expired, or the password breaks the password policy | application/json ErrorDetail |
| 403 | There is no license, or the license does not include Spanway Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 409 | The signup was verified already | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 451 | The address, account or region is refused under the sanctions policy | application/json DenialBody |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization Id |
team_id | string | Yes | Team Id |
user_id | string | Yes | User Id |
api_key | string | Yes | Api Key |
base_url | string | Yes | Base Url |
POST /cloud/resend
Mail a fresh Cloud verification link
Mail a fresh verification link while a signup is pending. Anyone may call it without a key, and the answer
is the same whether or not the address signed up. The earlier link stops working, and the new one expires
when the signup's window does, so a stale signup has to be made again.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#signup-and-verification)
Request body (application/json, schema ResendRequest):
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes |
Example request:
curl -X POST "http://localhost:4000/cloud/resend" \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Always ok, so the answer never says whether the address signed up | application/json ResendResponse |
| 403 | There is no license, or the license does not include Spanway Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | More than 10 requests came from this address in the last hour | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
status | "ok" | No | Status |
GET /cloud/tenant
Read your Cloud workspace
Read the Cloud workspace whose organization the caller administers: its plan and limits, status, prepaid
balance and this month's overage. Organization admins of the tenant may call it, and view-only roles see it
without the billing fields. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#tenant-self-service)
Example request:
curl -X GET "http://localhost:4000/cloud/tenant" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The caller's tenant with its plan quota and balance | application/json TenantView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
PATCH /cloud/tenant
Rename your Cloud workspace
Change the company name shown for the caller's Cloud workspace. Organization admins of the tenant may call
it, view-only roles may not. The new name is screened against the sanctions lists and the change is written
to the audit log. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#tenant-self-service)
Request body (application/json, schema UpdateTenantRequest):
| Field | Type | Required | Description |
|---|---|---|---|
company | string | Yes | Company |
Example request:
curl -X PATCH "http://localhost:4000/cloud/tenant" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"company": "Example Corp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The renamed tenant | application/json TenantView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
GET /cloud/tenant/export
Download your Cloud workspace as an import bundle
Download the caller's Cloud workspace as a JSON bundle for a self-hosted gateway: the organization, teams,
members, model access, budgets and rate limits. Organization admins of the tenant may call it. It carries every
member's email address, so view-only roles cannot download it, and each download is written to the audit log.
Keys are regenerated after import, so none is included.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#export-and-migration-to-self-hosted)
Example request:
curl -X GET "http://localhost:4000/cloud/tenant/export" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The bundle to send to POST /cloud/import on a self-hosted gateway | application/json TenantExport |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 409 | The tenant has no organization yet | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
format | "spanway-cloud-export/1" | No | The bundle format version |
tenant_id | string | Yes | The Cloud tenant the bundle came from |
plan | string | Yes | The Cloud plan the tenant was on |
organization | ExportedOrganization | Yes | The tenant's organization |
teams | array of ExportedTeam | Yes | Every team of the organization |
members | array of ExportedMember | Yes | Every member, without passwords |
model_access | ModelAccess | Yes | Which models the organization and each team may call |
budgets | RateLimits | Yes | The organization and team budgets |
rate_limits | RateLimits | Yes | The organization and team rate limits |
guardrail_and_routing_settings | object | Yes | Each team's routing settings, policies and metadata, by team id |
keys | array of CloudExportedKey | Yes | The keys to regenerate after import, without secrets |
keys_note | string | No | Why the bundle carries no key secrets |
POST /cloud/tenant/cancel
Close your Cloud workspace
Close the caller's Cloud workspace. Organization admins of the tenant may call it with confirm set to
true. The Stripe subscription is cancelled, the saved card is removed and the organization stops serving
requests. Export first if the workspace is moving to a self-hosted gateway.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#tenant-self-service)
Request body (application/json, schema CancelTenantRequest):
| Field | Type | Required | Description |
|---|---|---|---|
confirm | true | Yes | Confirm |
Example request:
curl -X POST "http://localhost:4000/cloud/tenant/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"confirm": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant, now cancelled | application/json TenantView |
| 400 | The tenant is cancelled already | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
| 502 | Stripe refused or did not answer the request | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
POST /cloud/subscribe
Start a Stripe checkout for a paid plan
Open a Stripe Checkout page where the tenant pays for a paid plan. Organization admins of an active tenant
may call it. Nothing changes until Stripe reports the checkout complete, and then the plan and its limits
apply. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#subscriptions-and-webhooks)
Request body (application/json, schema SubscribeRequest):
| Field | Type | Required | Description |
|---|---|---|---|
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
Example request:
curl -X POST "http://localhost:4000/cloud/subscribe" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"plan": "pro"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Send the user to this Stripe Checkout page | application/json CheckoutResponse |
| 400 | The plan cannot be bought online, or the tenant is not active | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
| 502 | Stripe refused or did not answer the request | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
checkout_url | string | Yes | Checkout Url |
POST /cloud/portal
Open the Stripe billing portal
Open the Stripe billing portal, where the tenant changes plan or payment method, or cancels. Organization
admins of a tenant that has subscribed may call it. return_path is the Admin UI page the portal links back
to. Nothing changes here. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#subscriptions-and-webhooks)
Request body (application/json, schema PortalRequest):
| Field | Type | Required | Description |
|---|---|---|---|
return_path | string | No | Return Path |
Example request:
curl -X POST "http://localhost:4000/cloud/portal" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"return_path": "/ui/cloud-plan"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Send the user to this Stripe billing portal page | application/json PortalResponse |
| 400 | The tenant has not subscribed yet | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
| 502 | Stripe refused or did not answer the request | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
portal_url | string | Yes | Portal Url |
GET /cloud/tenants
List every Cloud tenant
List every Cloud tenant, newest first, optionally narrowed by status and plan. Proxy admins and admin
viewers may call it, and only proxy admins see the billing fields. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#super-admin-operations)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
status | query | enum: "pending_verification", "active", "suspended", "cancelled" or null | No | |
plan | query | enum: "free", "pro", "enterprise" or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/cloud/tenants" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of tenants | application/json TenantListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may manage tenants, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or no tenant has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenants | array of TenantView | Yes | Tenants |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
GET /cloud/tenants/{tenant_id}
Read one Cloud tenant
Read one Cloud tenant with its plan quota, balance and status. Proxy admins and admin viewers may call it,
and only proxy admins see the billing fields. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#super-admin-operations)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/cloud/tenants/tenant_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant with its plan quota | application/json TenantView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may manage tenants, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or no tenant has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
PATCH /cloud/tenants/{tenant_id}
Move a Cloud tenant to another plan
Put a Cloud tenant on a plan by hand, for example for a negotiated contract. Only proxy admins may call it.
The plan's limits apply at once and Stripe is not told. A tenant still pending verification is refused,
because verification always provisions the free plan.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#super-admin-operations)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | path | string | Yes |
Request body (application/json, schema ChangePlanRequest):
| Field | Type | Required | Description |
|---|---|---|---|
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
Example request:
curl -X PATCH "http://localhost:4000/cloud/tenants/tenant_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"plan": "pro"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant on its new plan | application/json TenantView |
| 400 | The tenant is on that plan already | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may manage tenants, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or no tenant has that id | application/json ErrorDetail |
| 409 | The tenant has not verified its signup yet | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
POST /cloud/tenants/{tenant_id}/suspend
Suspend a Cloud tenant
Suspend an active Cloud tenant. Only proxy admins may call it. Every team of the tenant's organization is
blocked, so its keys are refused until the tenant is reinstated, and the reason is kept on the tenant and in
the audit log. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#super-admin-operations)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | path | string | Yes |
Request body (application/json, schema SuspendTenantRequest):
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | Yes | Reason |
Example request:
curl -X POST "http://localhost:4000/cloud/tenants/tenant_id-123/suspend" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Abuse report under review"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant, now suspended | application/json TenantView |
| 400 | Only an active tenant can be suspended | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may manage tenants, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or no tenant has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
POST /cloud/tenants/{tenant_id}/reinstate
Reinstate a suspended Cloud tenant
Reinstate a suspended Cloud tenant. Only proxy admins may call it. The tenant's organization is unblocked
and marked active again, so its keys work at once. A tenant a sanctions decision blocked or restricted cannot be
reinstated here. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#super-admin-operations)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | path | string | Yes |
Request body (application/json, schema ReinstateTenantRequest):
| Field | Type | Required | Description |
|---|---|---|---|
note | string or null | No | Note |
Example request:
curl -X POST "http://localhost:4000/cloud/tenants/tenant_id-123/reinstate" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "Review closed, no abuse found"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant, active again | application/json TenantView |
| 400 | Only a suspended tenant can be reinstated | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may manage tenants, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or no tenant has that id | application/json ErrorDetail |
| 409 | A sanctions decision blocked or restricted the tenant | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
organization_id | string or null | No | Organization Id |
admin_user_id | string or null | No | Admin User Id |
default_team_id | string or null | No | Default Team Id |
email | string | Yes | |
company | string | Yes | Company |
plan | enum: "free", "pro", "enterprise" | Yes | Plan |
status | enum: "pending_verification", "active", "suspended", "cancelled" | Yes | Status |
home_region | enum: "us-east-1", "eu-central-1" | No | Home Region |
verification_sent_at | string or null | No | Verification Sent At |
verified_at | string or null | No | Verified At |
terms_version | string or null | No | Terms Version |
terms_accepted_at | string or null | No | Terms Accepted At |
trial_ends_at | string or null | No | Trial Ends At |
plan_effective_at | string or null | No | Plan Effective At |
stripe_customer_id | string or null | No | Stripe Customer Id |
stripe_subscription_id | string or null | No | Stripe Subscription Id |
suspended_reason | string or null | No | Suspended Reason |
auto_topup_threshold_usd | number or null | No | Auto Topup Threshold Usd |
auto_topup_amount_usd | number or null | No | Auto Topup Amount Usd |
stripe_payment_method_id | string or null | No | Stripe Payment Method Id |
auto_topup_last_attempt_at | string or null | No | Auto Topup Last Attempt At |
auto_topup_configured_at | string or null | No | Auto Topup Configured At |
legal_name | string or null | No | Legal Name |
country | string or null | No | Country |
subdivision | string or null | No | Subdivision |
city | string or null | No | City |
address_line | string or null | No | Address Line |
postal_code | string or null | No | Postal Code |
screening_status | enum: "unscreened", "clear", "pending_review", "restricted", "blocked" | No | Screening Status |
screened_list_digest | string or null | No | Screened List Digest |
screened_at | string or null | No | Screened At |
sanctions_blocked_at | string or null | No | Sanctions Blocked At |
sanctions_blocked_usd | number or null | No | Sanctions Blocked Usd |
closed_at | string or null | No | Closed At |
redacted_at | string or null | No | Redacted At |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
quota | PlanQuota | Yes | None on a limit means unlimited, None on allowed_model_groups means every model group. |
api_url | string | Yes | Api Url |
credits_balance_usd | number | Yes | Credits Balance Usd |
overage_this_period_usd | number | Yes | Overage This Period Usd |
usage_price_per_usd | number | Yes | Usage Price Per Usd |
GET /cloud/plans
List the Cloud plans and prices
List the Cloud plans with their prices and limits, as the website shows them. Anyone may call it without a
key, and nothing changes. Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#plans-and-limits)
Example request:
curl -X GET "http://localhost:4000/cloud/plans"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The plan catalogue | application/json PlansResponse |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 429 | One address sent more requests to the public pages this minute than the gateway allows. Wait the number of seconds in Retry-After and try again | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
plans | array of PublicPlan | Yes | Plans |
regions | array of PublicRegion | Yes | The regions new workspaces can be created in |
GET /cloud/credits
Read your prepaid credit balance and ledger
Read the prepaid credit balance of the caller's Cloud workspace and its ledger of purchases and usage,
newest entry first. Organization admins of the tenant may call it, view-only roles included. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#prepaid-credits)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/cloud/credits" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The balance and one page of ledger entries | application/json CreditsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
balance_usd | number | Yes | Balance Usd |
entries | array of CreditEntryView | Yes | Entries |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /cloud/credits/purchase
Start a Stripe checkout to buy credits
Open a Stripe Checkout page to buy amount_usd of prepaid credits. Organization admins of an active or
suspended tenant may call it. Nothing changes until Stripe reports the payment: then the ledger is credited,
a tenant suspended for exhausted credits is unblocked, and with save_card the card is kept for auto top-up.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#prepaid-credits)
Request body (application/json, schema PurchaseCreditsRequest):
| Field | Type | Required | Description |
|---|---|---|---|
amount_usd | number | Yes | Amount Usd |
save_card | boolean | No | Save Card |
Example request:
curl -X POST "http://localhost:4000/cloud/credits/purchase" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount_usd": 50,
"save_card": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Send the user to this Stripe Checkout page | application/json CheckoutResponse |
| 400 | The tenant is neither active nor suspended | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
| 502 | Stripe refused or did not answer the request | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
checkout_url | string | Yes | Checkout Url |
GET /cloud/credits/auto-topup
Read your auto top-up settings
Read whether auto top-up is on for the caller's Cloud workspace, its threshold and amount, and whether a
card is saved. Organization admins of the tenant may call it, view-only roles may not. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#auto-top-up)
Example request:
curl -X GET "http://localhost:4000/cloud/credits/auto-topup" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The auto top-up settings | application/json AutoTopupView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Whether the saved card is charged when the balance runs low |
threshold_usd | number or null | Yes | The balance in USD at or below which a top-up is charged |
amount_usd | number or null | Yes | How many USD of credits each top-up buys |
card_saved | boolean | Yes | Whether a card from an earlier credit purchase is on file |
last_attempt_at | string or null | Yes | When a top-up was last charged or attempted |
PUT /cloud/credits/auto-topup
Turn auto top-up on
Turn auto top-up on, so whenever the balance falls to threshold_usd the saved card is charged
amount_usd. Organization admins of the tenant may call it, and it needs a card saved by an earlier credit
purchase. The before and after settings are written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#auto-top-up)
Request body (application/json, schema AutoTopupRequest):
| Field | Type | Required | Description |
|---|---|---|---|
threshold_usd | number | Yes | Threshold Usd |
amount_usd | number | Yes | Amount Usd |
Example request:
curl -X PUT "http://localhost:4000/cloud/credits/auto-topup" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"threshold_usd": 10,
"amount_usd": 50
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new auto top-up settings | application/json AutoTopupView |
| 400 | No card is saved, or the tenant is neither active nor suspended | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Whether the saved card is charged when the balance runs low |
threshold_usd | number or null | Yes | The balance in USD at or below which a top-up is charged |
amount_usd | number or null | Yes | How many USD of credits each top-up buys |
card_saved | boolean | Yes | Whether a card from an earlier credit purchase is on file |
last_attempt_at | string or null | Yes | When a top-up was last charged or attempted |
DELETE /cloud/credits/auto-topup
Turn auto top-up off and forget the card
Turn auto top-up off and remove the saved card, which is also detached from the Stripe customer.
Organization admins of the tenant may call it, and the change is written to the audit log. Turning auto top-up
on again needs a new credit purchase with save_card set.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#auto-top-up)
Example request:
curl -X DELETE "http://localhost:4000/cloud/credits/auto-topup" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Auto top-up is off and no card is saved | application/json AutoTopupView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
| 502 | Stripe refused or did not answer the request | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Whether the saved card is charged when the balance runs low |
threshold_usd | number or null | Yes | The balance in USD at or below which a top-up is charged |
amount_usd | number or null | Yes | How many USD of credits each top-up buys |
card_saved | boolean | Yes | Whether a card from an earlier credit purchase is on file |
last_attempt_at | string or null | Yes | When a top-up was last charged or attempted |
GET /cloud/tenant/credentials
List your own provider keys
List the provider keys the caller's Cloud workspace brought itself, masked. Organization admins of the
tenant may call it, view-only roles included. Key values are never returned and nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#bring-your-own-keys)
Example request:
curl -X GET "http://localhost:4000/cloud/tenant/credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tenant's provider keys, masked | application/json TenantCredentialsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
credentials | array of TenantCredential | Yes | Credentials |
POST /cloud/tenant/credentials
Add your own provider key
Store a provider key the tenant owns and route the default team's requests for that provider's models
through it. Organization admins of the tenant may call it, view-only roles may not. Spend made this way is
logged and rate limited as usual but never charged to credits, and the addition is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#bring-your-own-keys)
Request body (application/json, schema NewTenantCredential):
| Field | Type | Required | Description |
|---|---|---|---|
provider | enum: "anthropic", "cohere", "deepseek", "fireworks_ai", "gemini", "groq", "mistral", "openai", ... | Yes | The provider the key belongs to |
api_key | string | Yes | The provider key, stored encrypted |
extra | object | No | Extra provider settings, only organization for openai |
Example request:
curl -X POST "http://localhost:4000/cloud/tenant/credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"api_key": "sk-...",
"extra": {
"organization": "org-example"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The stored key, masked | application/json TenantCredential |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled on this gateway, so the route does not exist | application/json ErrorDetail |
| 409 | The tenant has no workspace yet | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
credential_id | string | Yes | The id to remove the key with |
provider | string | Yes | The provider the key belongs to |
masked_key | string | Yes | The first three and last four characters, the rest hidden |
created_at | string or null | No | When the key was added |
DELETE /cloud/tenant/credentials/{credential_id}
Remove one of your provider keys
Remove one of the tenant's own provider keys and the deployment that used it. Organization admins of the
tenant may call it, view-only roles may not. Requests for that provider fall back to the platform's own
deployments and are charged to credits again, and the removal is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#bring-your-own-keys)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
credential_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/cloud/tenant/credentials/credential_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The key and its deployment are gone | application/json DeletedResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloud | application/json ErrorDetail |
| 404 | Cloud is not enabled, or the tenant has no key with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
deleted | true | No | Deleted |
POST /cloud/import
Import a Cloud workspace bundle into this gateway
Import a bundle from GET /cloud/tenant/export into this self-hosted gateway. Only proxy admins may call it,
and it is served whether or not Cloud is enabled. The organization, its teams, members, model access, budgets
and rate limits are written in one transaction and the import is written to the audit log. dry_run checks
and counts without writing. Members arrive without a password and set one through an invitation. Keys are
never imported, keys_to_regenerate says how many the bundle had.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#export-and-migration-to-self-hosted)
Request body (application/json, schema ImportRequest):
| Field | Type | Required | Description |
|---|---|---|---|
format | "spanway-cloud-export/1" | No | The bundle format version |
tenant_id | string | Yes | The Cloud tenant the bundle came from |
plan | string | Yes | The Cloud plan the tenant was on |
organization | ExportedOrganization | Yes | The tenant's organization |
teams | array of ExportedTeam | Yes | Every team of the organization |
members | array of ExportedMember | Yes | Every member, without passwords |
model_access | ModelAccess | Yes | Which models the organization and each team may call |
budgets | RateLimits | Yes | The organization and team budgets |
rate_limits | RateLimits | Yes | The organization and team rate limits |
guardrail_and_routing_settings | object | Yes | Each team's routing settings, policies and metadata, by team id |
keys | array of CloudExportedKey | Yes | The keys to regenerate after import, without secrets |
keys_note | string | No | Why the bundle carries no key secrets |
dry_run | boolean | No | Dry Run |
Example request:
curl -X POST "http://localhost:4000/cloud/import" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "spanway-cloud-export/1",
"tenant_id": "tn_7d1e4c2a",
"plan": "pro",
"organization": {
"organization_id": "org_5b0f2e91",
"organization_alias": "Example Corp",
"models": [
"gpt-4o-mini"
],
"metadata": {},
"budget": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
}
},
"teams": [
{
"team_id": "team_9e2d4b61",
"team_alias": "Example Corp default team",
"models": [
"gpt-4o-mini"
],
"members_with_roles": [
{
"user_id": "user_3c8a7f10",
"role": "admin"
}
],
"budget": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
},
"blocked": false,
"metadata": {},
"router_settings": {
"routing_strategy": "simple-shuffle"
},
"policies": [],
"team_member_permissions": [],
"default_team_member_models": []
}
],
"members": [
{
"user_id": "user_3c8a7f10",
"user_email": "admin@example.com",
"user_alias": "Example Corp admin",
"user_role": "internal_user",
"organization_role": "org_admin",
"teams": [
"team_9e2d4b61"
],
"models": [],
"budget": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
}
}
],
"model_access": {
"organization": [
"gpt-4o-mini"
],
"teams": {
"team_9e2d4b61": [
"gpt-4o-mini"
]
}
},
"budgets": {
"organization": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
},
"teams": {
"team_9e2d4b61": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
}
}
},
"rate_limits": {
"organization": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
},
"teams": {
"team_9e2d4b61": {
"max_budget": 500,
"budget_duration": "30d",
"rpm_limit": 1000,
"tpm_limit": 2000000
}
}
},
"guardrail_and_routing_settings": {
"team_9e2d4b61": {
"router_settings": {
"routing_strategy": "simple-shuffle"
},
"policies": [],
"metadata": {}
}
},
"keys": [
{
"key_alias": "Example Corp default key",
"team_id": "team_9e2d4b61",
"user_id": "user_3c8a7f10"
}
],
"keys_note": "Virtual keys are not exported. Regenerate them on the self-hosted gateway after import.",
"dry_run": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | What was written, or with dry_run what would be | application/json ImportResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may import, and the license must include Cloud | application/json ErrorDetail |
| 409 | An organization with the same name exists | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string or null | Yes | Organization Id |
team_ids | array of string | Yes | Team Ids |
user_ids | array of string | Yes | User Ids |
keys_to_regenerate | integer | Yes | Keys To Regenerate |
dry_run | boolean | Yes | Dry Run |
GET /cloud/billing/status
Check that Cloud usage can be priced and overage metered
Answers whether Spanway Cloud can charge for usage right now. When general_settings.cloud does not
validate, tenant requests are refused with 503 cloud_billing_unavailable and config_error names the field.
Otherwise it checks the Stripe overage price named by overage_price_id (cached, at most one Stripe call per
hour when it passes) and says whether overage may be metered. Nothing changes and no secret is returned.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/cloud#billing-safety)
Example request:
curl -X GET "http://localhost:4000/cloud/billing/status" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whether requests are charged and whether overage metering is allowed | application/json CloudBillingStatus |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and admin viewers may read this, and the license must include Cloud | application/json ErrorDetail |
| 404 | Cloud is not turned on for this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
config_valid | boolean | Yes | Config Valid |
config_error | string or null | Yes | Config Error |
requests | enum: "charged", "refused" | Yes | Requests |
usage_price_per_usd | number or null | Yes | Usage Price Per Usd |
overage_metering | OverageMeteringStatus or null | Yes |