Skip to main content

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.

MethodPathSummary
POST/cloud/signupSign up for Spanway Cloud
POST/cloud/verifyVerify a Cloud signup and create the workspace
POST/cloud/resendMail a fresh Cloud verification link
GET/cloud/tenantRead your Cloud workspace
PATCH/cloud/tenantRename your Cloud workspace
GET/cloud/tenant/exportDownload your Cloud workspace as an import bundle
POST/cloud/tenant/cancelClose your Cloud workspace
POST/cloud/subscribeStart a Stripe checkout for a paid plan
POST/cloud/portalOpen the Stripe billing portal
GET/cloud/tenantsList 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}/suspendSuspend a Cloud tenant
POST/cloud/tenants/{tenant_id}/reinstateReinstate a suspended Cloud tenant
GET/cloud/plansList the Cloud plans and prices
GET/cloud/creditsRead your prepaid credit balance and ledger
POST/cloud/credits/purchaseStart a Stripe checkout to buy credits
GET/cloud/credits/auto-topupRead your auto top-up settings
PUT/cloud/credits/auto-topupTurn auto top-up on
DELETE/cloud/credits/auto-topupTurn auto top-up off and forget the card
GET/cloud/tenant/credentialsList your own provider keys
POST/cloud/tenant/credentialsAdd your own provider key
DELETE/cloud/tenant/credentials/{credential_id}Remove one of your provider keys
POST/cloud/importImport a Cloud workspace bundle into this gateway
GET/cloud/billing/statusCheck 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):

FieldTypeRequiredDescription
accepted_termstrueYesAccepted Terms
emailstringYesEmail
companystringYesCompany
legal_namestringYesLegal Name
countrystringYesCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
regionenum: "us-east-1", "eu-central-1" or nullNoWhere 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:

StatusDescriptionBody
200The signup is recorded and a verification link is on its wayapplication/json SignupResponse
400The email address is not accepted, or the region is not offered for new workspacesapplication/json ErrorDetail
403The address is not on general_settings.cloud.signup_allowlist, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
409The address already belongs to a verified tenantapplication/json ErrorDetail
421The chosen region is served by another gateway, so the signup has to be sent to its signup pageapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
429More than 10 signups came from this address in the last hourapplication/json ErrorDetail
451The address, account or region is refused under the sanctions policyapplication/json DenialBody
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
under_reviewbooleanNoUnder 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):

FieldTypeRequiredDescription
tokenstringYesToken
passwordstringYesPassword

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:

StatusDescriptionBody
200The workspace exists and its first key is shown this onceapplication/json VerifyResponse
400The link is unknown or expired, or the password breaks the password policyapplication/json ErrorDetail
403There is no license, or the license does not include Spanway Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
409The signup was verified alreadyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
451The address, account or region is refused under the sanctions policyapplication/json DenialBody
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
organization_idstringYesOrganization Id
team_idstringYesTeam Id
user_idstringYesUser Id
api_keystringYesApi Key
base_urlstringYesBase 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):

FieldTypeRequiredDescription
emailstringYesEmail

Example request:

curl -X POST "http://localhost:4000/cloud/resend" \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com"
}'

Responses:

StatusDescriptionBody
200Always ok, so the answer never says whether the address signed upapplication/json ResendResponse
403There is no license, or the license does not include Spanway Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
429More than 10 requests came from this address in the last hourapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
status"ok"NoStatus

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:

StatusDescriptionBody
200The caller's tenant with its plan quota and balanceapplication/json TenantView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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):

FieldTypeRequiredDescription
companystringYesCompany

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:

StatusDescriptionBody
200The renamed tenantapplication/json TenantView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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:

StatusDescriptionBody
200The bundle to send to POST /cloud/import on a self-hosted gatewayapplication/json TenantExport
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
409The tenant has no organization yetapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
format"spanway-cloud-export/1"NoThe bundle format version
tenant_idstringYesThe Cloud tenant the bundle came from
planstringYesThe Cloud plan the tenant was on
organizationExportedOrganizationYesThe tenant's organization
teamsarray of ExportedTeamYesEvery team of the organization
membersarray of ExportedMemberYesEvery member, without passwords
model_accessModelAccessYesWhich models the organization and each team may call
budgetsRateLimitsYesThe organization and team budgets
rate_limitsRateLimitsYesThe organization and team rate limits
guardrail_and_routing_settingsobjectYesEach team's routing settings, policies and metadata, by team id
keysarray of CloudExportedKeyYesThe keys to regenerate after import, without secrets
keys_notestringNoWhy 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):

FieldTypeRequiredDescription
confirmtrueYesConfirm

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:

StatusDescriptionBody
200The tenant, now cancelledapplication/json TenantView
400The tenant is cancelled alreadyapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail
502Stripe refused or did not answer the requestapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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):

FieldTypeRequiredDescription
planenum: "free", "pro", "enterprise"YesPlan

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:

StatusDescriptionBody
200Send the user to this Stripe Checkout pageapplication/json CheckoutResponse
400The plan cannot be bought online, or the tenant is not activeapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail
502Stripe refused or did not answer the requestapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
checkout_urlstringYesCheckout 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):

FieldTypeRequiredDescription
return_pathstringNoReturn 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:

StatusDescriptionBody
200Send the user to this Stripe billing portal pageapplication/json PortalResponse
400The tenant has not subscribed yetapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail
502Stripe refused or did not answer the requestapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
portal_urlstringYesPortal 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:

NameInTypeRequiredDescription
statusqueryenum: "pending_verification", "active", "suspended", "cancelled" or nullNo
planqueryenum: "free", "pro", "enterprise" or nullNo
pagequeryintegerNo
page_sizequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/cloud/tenants" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of tenantsapplication/json TenantListResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may manage tenants, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or no tenant has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenantsarray of TenantViewYesTenants
totalintegerYesTotal
pageintegerYesPage
page_sizeintegerYesPage 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:

NameInTypeRequiredDescription
tenant_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/cloud/tenants/tenant_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The tenant with its plan quotaapplication/json TenantView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may manage tenants, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or no tenant has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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:

NameInTypeRequiredDescription
tenant_idpathstringYes

Request body (application/json, schema ChangePlanRequest):

FieldTypeRequiredDescription
planenum: "free", "pro", "enterprise"YesPlan

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:

StatusDescriptionBody
200The tenant on its new planapplication/json TenantView
400The tenant is on that plan alreadyapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may manage tenants, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or no tenant has that idapplication/json ErrorDetail
409The tenant has not verified its signup yetapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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:

NameInTypeRequiredDescription
tenant_idpathstringYes

Request body (application/json, schema SuspendTenantRequest):

FieldTypeRequiredDescription
reasonstringYesReason

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:

StatusDescriptionBody
200The tenant, now suspendedapplication/json TenantView
400Only an active tenant can be suspendedapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may manage tenants, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or no tenant has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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:

NameInTypeRequiredDescription
tenant_idpathstringYes

Request body (application/json, schema ReinstateTenantRequest):

FieldTypeRequiredDescription
notestring or nullNoNote

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:

StatusDescriptionBody
200The tenant, active againapplication/json TenantView
400Only a suspended tenant can be reinstatedapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may manage tenants, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or no tenant has that idapplication/json ErrorDetail
409A sanctions decision blocked or restricted the tenantapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
tenant_idstringYesTenant Id
organization_idstring or nullNoOrganization Id
admin_user_idstring or nullNoAdmin User Id
default_team_idstring or nullNoDefault Team Id
emailstringYesEmail
companystringYesCompany
planenum: "free", "pro", "enterprise"YesPlan
statusenum: "pending_verification", "active", "suspended", "cancelled"YesStatus
home_regionenum: "us-east-1", "eu-central-1"NoHome Region
verification_sent_atstring or nullNoVerification Sent At
verified_atstring or nullNoVerified At
terms_versionstring or nullNoTerms Version
terms_accepted_atstring or nullNoTerms Accepted At
trial_ends_atstring or nullNoTrial Ends At
plan_effective_atstring or nullNoPlan Effective At
stripe_customer_idstring or nullNoStripe Customer Id
stripe_subscription_idstring or nullNoStripe Subscription Id
suspended_reasonstring or nullNoSuspended Reason
auto_topup_threshold_usdnumber or nullNoAuto Topup Threshold Usd
auto_topup_amount_usdnumber or nullNoAuto Topup Amount Usd
stripe_payment_method_idstring or nullNoStripe Payment Method Id
auto_topup_last_attempt_atstring or nullNoAuto Topup Last Attempt At
auto_topup_configured_atstring or nullNoAuto Topup Configured At
legal_namestring or nullNoLegal Name
countrystring or nullNoCountry
subdivisionstring or nullNoSubdivision
citystring or nullNoCity
address_linestring or nullNoAddress Line
postal_codestring or nullNoPostal Code
screening_statusenum: "unscreened", "clear", "pending_review", "restricted", "blocked"NoScreening Status
screened_list_digeststring or nullNoScreened List Digest
screened_atstring or nullNoScreened At
sanctions_blocked_atstring or nullNoSanctions Blocked At
sanctions_blocked_usdnumber or nullNoSanctions Blocked Usd
closed_atstring or nullNoClosed At
redacted_atstring or nullNoRedacted At
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
quotaPlanQuotaYesNone on a limit means unlimited, None on allowed_model_groups means every model group.
api_urlstringYesApi Url
credits_balance_usdnumberYesCredits Balance Usd
overage_this_period_usdnumberYesOverage This Period Usd
usage_price_per_usdnumberYesUsage 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:

StatusDescriptionBody
200The plan catalogueapplication/json PlansResponse
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
429One address sent more requests to the public pages this minute than the gateway allows. Wait the number of seconds in Retry-After and try againapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
plansarray of PublicPlanYesPlans
regionsarray of PublicRegionYesThe 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:

NameInTypeRequiredDescription
pagequeryintegerNo
page_sizequeryintegerNo

Example request:

curl -X GET "http://localhost:4000/cloud/credits" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The balance and one page of ledger entriesapplication/json CreditsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
balance_usdnumberYesBalance Usd
entriesarray of CreditEntryViewYesEntries
totalintegerYesTotal
pageintegerYesPage
page_sizeintegerYesPage 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):

FieldTypeRequiredDescription
amount_usdnumberYesAmount Usd
save_cardbooleanNoSave 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:

StatusDescriptionBody
200Send the user to this Stripe Checkout pageapplication/json CheckoutResponse
400The tenant is neither active nor suspendedapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail
502Stripe refused or did not answer the requestapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
checkout_urlstringYesCheckout 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:

StatusDescriptionBody
200The auto top-up settingsapplication/json AutoTopupView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
enabledbooleanYesWhether the saved card is charged when the balance runs low
threshold_usdnumber or nullYesThe balance in USD at or below which a top-up is charged
amount_usdnumber or nullYesHow many USD of credits each top-up buys
card_savedbooleanYesWhether a card from an earlier credit purchase is on file
last_attempt_atstring or nullYesWhen 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):

FieldTypeRequiredDescription
threshold_usdnumberYesThreshold Usd
amount_usdnumberYesAmount 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:

StatusDescriptionBody
200The new auto top-up settingsapplication/json AutoTopupView
400No card is saved, or the tenant is neither active nor suspendedapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
enabledbooleanYesWhether the saved card is charged when the balance runs low
threshold_usdnumber or nullYesThe balance in USD at or below which a top-up is charged
amount_usdnumber or nullYesHow many USD of credits each top-up buys
card_savedbooleanYesWhether a card from an earlier credit purchase is on file
last_attempt_atstring or nullYesWhen 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:

StatusDescriptionBody
200Auto top-up is off and no card is savedapplication/json AutoTopupView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail
502Stripe refused or did not answer the requestapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
enabledbooleanYesWhether the saved card is charged when the balance runs low
threshold_usdnumber or nullYesThe balance in USD at or below which a top-up is charged
amount_usdnumber or nullYesHow many USD of credits each top-up buys
card_savedbooleanYesWhether a card from an earlier credit purchase is on file
last_attempt_atstring or nullYesWhen 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:

StatusDescriptionBody
200The tenant's provider keys, maskedapplication/json TenantCredentialsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
credentialsarray of TenantCredentialYesCredentials

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):

FieldTypeRequiredDescription
providerenum: "anthropic", "cohere", "deepseek", "fireworks_ai", "gemini", "groq", "mistral", "openai", ...YesThe provider the key belongs to
api_keystringYesThe provider key, stored encrypted
extraobjectNoExtra 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:

StatusDescriptionBody
200The stored key, maskedapplication/json TenantCredential
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled on this gateway, so the route does not existapplication/json ErrorDetail
409The tenant has no workspace yetapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
credential_idstringYesThe id to remove the key with
providerstringYesThe provider the key belongs to
masked_keystringYesThe first three and last four characters, the rest hidden
created_atstring or nullNoWhen 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:

NameInTypeRequiredDescription
credential_idpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/cloud/tenant/credentials/credential_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The key and its deployment are goneapplication/json DeletedResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not an organization admin of a Cloud tenant, holds a view-only role for a change, or the license does not include Cloudapplication/json ErrorDetail
404Cloud is not enabled, or the tenant has no key with that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
deletedtrueNoDeleted

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):

FieldTypeRequiredDescription
format"spanway-cloud-export/1"NoThe bundle format version
tenant_idstringYesThe Cloud tenant the bundle came from
planstringYesThe Cloud plan the tenant was on
organizationExportedOrganizationYesThe tenant's organization
teamsarray of ExportedTeamYesEvery team of the organization
membersarray of ExportedMemberYesEvery member, without passwords
model_accessModelAccessYesWhich models the organization and each team may call
budgetsRateLimitsYesThe organization and team budgets
rate_limitsRateLimitsYesThe organization and team rate limits
guardrail_and_routing_settingsobjectYesEach team's routing settings, policies and metadata, by team id
keysarray of CloudExportedKeyYesThe keys to regenerate after import, without secrets
keys_notestringNoWhy the bundle carries no key secrets
dry_runbooleanNoDry 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:

StatusDescriptionBody
200What was written, or with dry_run what would beapplication/json ImportResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may import, and the license must include Cloudapplication/json ErrorDetail
409An organization with the same name existsapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
organization_idstring or nullYesOrganization Id
team_idsarray of stringYesTeam Ids
user_idsarray of stringYesUser Ids
keys_to_regenerateintegerYesKeys To Regenerate
dry_runbooleanYesDry 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:

StatusDescriptionBody
200Whether requests are charged and whether overage metering is allowedapplication/json CloudBillingStatus
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins and admin viewers may read this, and the license must include Cloudapplication/json ErrorDetail
404Cloud is not turned on for this gatewayapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
config_validbooleanYesConfig Valid
config_errorstring or nullYesConfig Error
requestsenum: "charged", "refused"YesRequests
usage_price_per_usdnumber or nullYesUsage Price Per Usd
overage_meteringOverageMeteringStatus or nullYes