{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid, expired, or revoked.",
"request_id": "8f14e45fceea167a5a36dedd4bea2543",
"param": "aspect_ratio"
}
}
Returns what the calling credential — this API key or OAuth connection — can spend
right now, alongside the organization-wide totals it is derived from. Requires the
usage.read scope. For rates, see Pricing.
Credential-spendable vs organization-wide
The response carries two kinds of number. available and spendable_plan_credits
answer “what can this credential spend”; plan_credits and topup_credits are
organization-wide balances.
Field
What it is
available
Credits this credential can spend right now — spendable_plan_credits + topup_credits. This is the number to compare a job’s estimated_credits against.
spendable_plan_credits
The plan-pool part of available: plan_credits capped by scope.remaining. Equal to plan_credits when nothing caps this credential.
plan_credits
The organization’s remaining monthly plan pool — not necessarily all spendable by this credential. 0 when the pool is exhausted, or when the subscription is canceled and past its period end (top-ups stay spendable).
topup_credits
Remaining credits from valid, non-expired top-up purchases. Top-ups are exempt from team budgets, so they are always fully spendable.
period
The organization’s current billing period. Team budget usage resets with it.
scope
The budget regime this credential spends under — see below.
Three relations always hold:
available == spendable_plan_credits + topup_credits
spendable_plan_credits <= plan_credits
for an organization with no active teams, spendable_plan_credits == plan_credits
If your organization has no teams, nothing changed for you.scope.type is
org, spendable_plan_credits equals plan_credits, and available is still the
plan pool plus top-ups.
The budget regime (scope)
An organization can reserve parts of its monthly plan pool as per-team budgets, and
every API key can be assigned to a team. A credential then spends from exactly one
bucket, and only that bucket’s headroom is available to it — which is why available
can be lower than the organization-wide plan_credits.
scope.type
Meaning
Shortfall error code
org
The organization has no active teams (the common case), or it is a budget-exempt system organization. Nothing caps this credential, so budget, used, and remaining are all null.
The organization has at least one active team, and this credential is not bound to a budgeted one — it has no team, or its team has no budget of its own. budget is the monthly plan allocation minus every active team budget, floored at 0.
scope.team names the team the credential is bound to, or is null when it is bound to
none. scope.remaining is budget - used, floored at 0.A team-bound key whose budget is the binding constraint:
The organization still has 8031 plan credits, but the Marketing budget has 1200 left,
so this key can only spend 1200 of them — plus the 250 budget-exempt top-up credits,
for 1450 in total.
Predicting and diagnosing a 402
available is the predictor. A job whose estimated_credits is at most available
is not refused with an insufficient-credit 402, and conversely such a 402 means the
estimate exceeded available — on either number, the credential’s, not the
organization’s. One exception: an operational failure inside the deduction itself
(for example a degraded balance lookup) is reported as the generic
insufficient_credits whatever the regime,
without proving anything about available — a plain insufficient_credits where you
expected a team-aware code can therefore be transient; retry before treating it as an
exhausted balance.
The prediction holds only as long as the credit and budget state does not change between
the read and the submit. Another credential of the same organization spending, a top-up
lot expiring, a subscription change, a team budget being edited, or a key being reassigned
to a different team can all move available — and even change scope.type and therefore
which error code you get — without any spend of your own.
subscription_inactive is a separate 402,
unrelated to this comparison.
When a submit is refused, scope explains it:
scope.type names the budget regime, which is what selects the error code
(barring the operational-failure fallback above) — see the table above. It does
not tell you which balance ran out: a key under the team
regime gets insufficient_team_credits even when the organization’s plan pool, and not
the team budget, is what was exhausted.
To find the actual bottleneck under a capped regime (team or unallocated), compare
plan_credits with scope.remaining — the smaller one caps spendable_plan_credits.
Under org, scope.remaining is null and plan_credits is the only possible
bottleneck.
remaining: 0 means that bucket is fully spent for the current period. It is not
a precondition of the error: a bucket with remaining: 100 and no top-ups still refuses
a job costing 200.
So a key with no team, in an organization whose plan pool is fully allocated to teams,
reports available: 0 with scope.type: "unallocated" and remaining: 0 — every submit
that costs credits will be refused with insufficient_unallocated_credits until a budget is lowered, the
key is assigned to a team with headroom, or top-ups are purchased. See
Errors for how to resolve each code.
Authorizations
Authorization
string
header
required
Organization API key (Authorization: Bearer samsa_sk_...) or OAuth 2.1 access token (Authorization: Bearer samsa_at_...).
Response
Successful Response
GET /credits body — what the CALLING credential can spend (ADR §10, SAM-1029).
Two kinds of number:
available / spendable_plan_credits answer "what can THIS API key or
OAuth connection spend right now" — capped by its team budget bucket
(scope), so a job estimated at or below available is not rejected
with insufficient_team_credits / insufficient_unallocated_credits.
plan_credits / topup_credits are the ORGANIZATION-wide balances.
All amounts are balances (not allocations), and
available == spendable_plan_credits + topup_credits always holds, as does
spendable_plan_credits <= plan_credits (they are equal whenever no team
budget applies).
available
integer
required
Total credits the calling credential can spend right now — the sum of spendable_plan_credits and topup_credits. Capped by the credential's team budget bucket (see scope), so it can be lower than the organization-wide plan_credits.
Example:
1450
spendable_plan_credits
integer
required
Plan-pool credits the calling credential can spend right now: plan_credits capped by scope.remaining. Equal to plan_credits when no team budget applies.
Example:
1200
plan_credits
integer
required
The ORGANIZATION's remaining monthly subscription-pool credits — not necessarily all spendable by this credential (see spendable_plan_credits). 0 when the plan pool is exhausted or the subscription is canceled and past its period end (top-up credits stay spendable).
Example:
1200
topup_credits
integer
required
Remaining credits from valid (non-expired) top-up purchases. Top-ups are exempt from team budgets, so they are always fully spendable by any credential of the organization.
Example:
250
period
BillingPeriod · object
required
The org subscription's current billing-period bounds (ISO-8601).
Show child attributes
scope
PublicCreditsScope · object
required
The credit bucket the calling credential spends from (SAM-1029).
Organizations can reserve parts of their monthly plan pool for teams. A
credential (API key or OAuth connection) spends from exactly ONE bucket, and
only that bucket's headroom is available to it — which is why available
can be lower than the organization-wide plan_credits. The shortfall rule
is cost > available (spendable_plan_credits + topup_credits): a submit
is refused with an insufficient-credit 402 when the deduction,
re-evaluating the same numbers at execution time, finds the estimated cost
above available — insufficient_credits under the uncapped org regime,
insufficient_team_credits under team, and
insufficient_unallocated_credits under unallocated (operational
failures inside the deduction fall back to the generic
insufficient_credits, whatever the regime). This response is a
point-in-time snapshot, not a reservation: concurrent spends, top-up lots
expiring, a canceled subscription's period ending, or a degraded balance
lookup can make the deduction-time numbers differ from the ones reported
here, and other checks can reject a request regardless of credits.
type names the budget regime and selects which of those codes a balance
shortfall raises — it does not say which balance ran out: under a capped
regime the smaller of plan_credits and remaining limits
spendable_plan_credits.
remaining: 0 means this bucket has no plan-pool headroom left for the
current period (spent down, or never allocated any); it is NOT a
precondition of the error — a bucket with remaining: 100 and no top-ups
still refuses a job costing 200.
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Samsa","description":"Developer documentation for the Samsa public API — image generation with trained models, Magic Edit, video generation, model training, and the MCP server.","colors":{"primary":"#15123A","light":"#F3F0EA","dark":"#15123A"},"logo":{"light":"https://mintcdn.com/samsa-6b52d36f/KpPcBLFywFmPfDV-/logo/light.svg?fit=max\u0026auto=format\u0026n=KpPcBLFywFmPfDV-\u0026q=85\u0026s=7959ddf7b4b354d12d95c8cdd42b4c61","dark":"https://mintcdn.com/samsa-6b52d36f/KpPcBLFywFmPfDV-/logo/dark.svg?fit=max\u0026auto=format\u0026n=KpPcBLFywFmPfDV-\u0026q=85\u0026s=74213957254837206e4bb0ce9e2096b6","href":"https://samsa.ai"},"favicon":"https://mintcdn.com/samsa-6b52d36f/KpPcBLFywFmPfDV-/favicon.svg?fit=max\u0026auto=format\u0026n=KpPcBLFywFmPfDV-\u0026q=85\u0026s=24292e198dbc5bbc4dcbc1a41e807c52","appearance":{"default":"system"},"navbar":{"links":[{"href":"mailto:support@samsa.ai","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.samsa.ai"}},"seo":{"organization":{"id":"https://samsa.ai/#organization","name":"Samsa","legalName":"Samsa Labs AG","url":"https://samsa.ai","logo":"https://samsa.ai/wp-content/uploads/2026/01/samsa_logo.webp","sameAs":["https://www.linkedin.com/company/samsa-ai/"]}},"contextual":{"options":["copy","chatgpt","claude","cursor","vscode",{"title":"Connect to Microsoft Copilot","description":"Install MCP Server in Microsoft Copilot","icon":"microsoft","href":"https://docs.samsa.ai/mcp-server/clients"}],"display":"header"},"thumbnails":{"appearance":"dark","background":"https://mintcdn.com/samsa-6b52d36f/KpPcBLFywFmPfDV-/images/thumbnail-world.webp?fit=max\u0026auto=format\u0026n=KpPcBLFywFmPfDV-\u0026q=85\u0026s=ad0e6f187da0ece3388c05736841babd"},"styling":{"latex":false},"navigation":{"languages":[{"language":"en","default":true,"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Information","items":[{"label":"Docs home","href":"/"},{"label":"Changelog","href":"/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Pricing","href":"https://samsa.ai/pricing"},{"label":"Contact us","href":"https://samsa.ai/contact"}]},{"header":"Legal","items":[{"label":"Terms of Service","href":"https://samsa.ai/terms-of-service"},{"label":"Acceptable Use Policy","href":"https://samsa.ai/acceptable-use-policy"},{"label":"Privacy Policy","href":"https://samsa.ai/privacy-policy"},{"label":"Imprint","href":"https://samsa.ai/imprint"}]}]},"href":""},{"language":"de","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informationen","items":[{"label":"Doku-Startseite","href":"/de"},{"label":"Changelog","href":"/de/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Preise","href":"https://samsa.ai/de/preise"},{"label":"Kontakt","href":"https://samsa.ai/de/kontakt"}]},{"header":"Rechtliches","items":[{"label":"AGB","href":"https://samsa.ai/de/agb"},{"label":"Nutzungsrichtlinie","href":"https://samsa.ai/de/nutzungsrichtlinie"},{"label":"Datenschutz","href":"https://samsa.ai/de/datenschutz"},{"label":"Impressum","href":"https://samsa.ai/de/impressum"}]}]},"href":"de"},{"language":"fr","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informations","items":[{"label":"Accueil documentation","href":"/fr"},{"label":"Changelog","href":"/fr/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Tarifs","href":"https://samsa.ai/fr/prix"},{"label":"Contact","href":"https://samsa.ai/fr/contact"}]},{"header":"Légal","items":[{"label":"Conditions générales","href":"https://samsa.ai/fr/conditions-generales"},{"label":"Politique d'utilisation acceptable","href":"https://samsa.ai/fr/politique-utilisation-acceptable"},{"label":"Politique de confidentialité","href":"https://samsa.ai/fr/politique-de-confidentialite"},{"label":"Mentions légales","href":"https://samsa.ai/fr/mentions-legales"}]}]},"href":"fr"},{"language":"it","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informazioni","items":[{"label":"Home documentazione","href":"/it"},{"label":"Changelog","href":"/it/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Prezzi","href":"https://samsa.ai/it/prezzi"},{"label":"Contatti","href":"https://samsa.ai/it/contatto"}]},{"header":"Legale","items":[{"label":"Termini e condizioni","href":"https://samsa.ai/it/termini-e-condizioni"},{"label":"Politica di utilizzo accettabile","href":"https://samsa.ai/it/politica-utilizzo-accettabile"},{"label":"Informativa sulla privacy","href":"https://samsa.ai/it/informativa-sulla-privacy"},{"label":"Note legali","href":"https://samsa.ai/it/impronta"}]}]},"href":"it"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"samsa-6b52d36f","hasAudioNarration":false,"actualSubdomain":"samsa-6b52d36f","customDomains":["docs.samsa.ai"],"gitSource":{"type":"github","owner":"samsa-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"agentFeedback":true,"thumbs":false},"entitlements":{},"buildId":"6ae19d13f8179dd80879abc1","clientVersion":"0.0.4205","searchFilterCounts":[{"language":"en","tag":"API reference","count":45},{"language":"de","tag":"API-Referenz","count":45},{"language":"fr","tag":"Référence API","count":45},{"language":"it","tag":"Riferimento API","count":45},{"language":"en","tag":"Endpoints","count":43},{"language":"de","tag":"Endpunkte","count":43},{"language":"fr","tag":"Points de terminaison","count":43},{"language":"it","tag":"Endpoint","count":43},{"language":"en","tag":"Image Operations","count":13},{"language":"de","tag":"Bildoperationen","count":13},{"language":"fr","tag":"Opérations d'images","count":13},{"language":"it","tag":"Operazioni sulle immagini","count":13},{"language":"en","tag":"Documentation","count":9},{"language":"de","tag":"Dokumentation","count":9},{"language":"fr","tag":"Documentation","count":9},{"language":"it","tag":"Documentazione","count":9},{"language":"en","tag":"Guides","count":7},{"language":"de","tag":"Leitfäden","count":7},{"language":"fr","tag":"Guides","count":7},{"language":"it","tag":"Guide","count":7},{"language":"en","tag":"Model Training","count":5},{"language":"en","tag":"Models","count":5},{"language":"de","tag":"Modelltraining","count":5},{"language":"de","tag":"Modelle","count":5},{"language":"fr","tag":"Entraînement de modèles","count":5},{"language":"fr","tag":"Modèles","count":5},{"language":"it","tag":"Addestramento di modelli","count":5},{"language":"it","tag":"Modelli","count":5},{"language":"en","tag":"Account \u0026 Usage","count":4},{"language":"en","tag":"Image Generation","count":4},{"language":"en","tag":"Video Generation","count":4},{"language":"de","tag":"Konto \u0026 Nutzung","count":4},{"language":"de","tag":"Bildgenerierung","count":4},{"language":"de","tag":"Videogenerierung","count":4},{"language":"fr","tag":"Compte \u0026 utilisation","count":4},{"language":"fr","tag":"Génération d'images","count":4},{"language":"fr","tag":"Génération de vidéos","count":4},{"language":"it","tag":"Account \u0026 utilizzo","count":4},{"language":"it","tag":"Generazione di immagini","count":4},{"language":"it","tag":"Generazione di video","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navigation-items>div:not(:first-child):has(>.sidebar-group-header){border-top:1px solid rgb(17 24 39 / 0.08);padding-top:1.25rem}:is(html.dark,.dark,[data-theme=\"dark\"]) #navigation-items>div:not(:first-child):has(>.sidebar-group-header){border-top-color:rgb(255 255 255 / 0.1)}img.nav-logo{height:25px;margin-bottom:3px}:root{--samsa-ink: #15123a;--samsa-paper: #f3f0ea;--samsa-night: #0e0c16;--samsa-signal: #ff4f1a;--samsa-signal-text: #c43d0b;--samsa-ring: #c43d0b}html.dark{--samsa-signal: #ff5a24;--samsa-signal-text: #ff8a5c;--samsa-ring: #ff5a24;--primary-dark: 243 240 234}:is(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline-style:solid!important;outline-width:2px!important;outline-color:var(--samsa-ring)!important}.prose a:not(.card,[data-client-link],[class*=\"samsa-hero__\"]):hover,.prose a:not(.card,[data-client-link],[class*=\"samsa-hero__\"]):hover code{color:var(--samsa-signal-text);border-bottom-color:var(--samsa-signal-text)}a:has(>.bg-primary-dark):hover>.bg-primary-dark,button:has(>.bg-primary-dark):hover>.bg-primary-dark{background-color:var(--samsa-signal);opacity:1!important}html.dark a:has(>.bg-primary-dark) :is(.text-white,[class*=\"text-white/\"]),html.dark button:has(>.bg-primary-dark) :is(.text-white,[class*=\"text-white/\"]){color:var(--samsa-night)}html.dark a:has(>.bg-primary-dark):hover :is(.text-white,[class*=\"text-white/\"]),html.dark button:has(>.bg-primary-dark):hover :is(.text-white,[class*=\"text-white/\"]){color:#fff}[data-component-part=\"card-icon\"] svg[class]{background-color:var(--samsa-signal-text)}[data-component-part=\"card-icon\"] svg:not([style*=\"mask\"]){background-color:transparent;color:var(--samsa-signal-text);fill:currentColor}.card:hover [data-component-part=\"card-title\"]{color:var(--samsa-signal-text)}:root{--world-grain: url(\"/images/worlds/grain-128.ca7f55b1c0.webp\");--world-grain-size: 128px;--world-dim: 34.5 32.5 41.5}@media (min-resolution: 1.25dppx){:root{--world-grain-size: 102.4px}}@media (min-resolution: 1.5dppx){:root{--world-grain-size: 85.333px}}@media (min-resolution: 1.75dppx){:root{--world-grain-size: 73.143px}}@media (min-resolution: 2dppx){:root{--world-grain-size: 64px}}@media (min-resolution: 2.25dppx){:root{--world-grain-size: 56.889px}}@media (min-resolution: 2.5dppx){:root{--world-grain-size: 51.2px}}@media (min-resolution: 2.625dppx){:root{--world-grain-size: 48.762px}}@media (min-resolution: 2.75dppx){:root{--world-grain-size: 46.545px}}@media (min-resolution: 3dppx){:root{--world-grain-size: 42.667px}}@media (min-resolution: 3.5dppx){:root{--world-grain-size: 36.571px}}@media (min-resolution: 4dppx){:root{--world-grain-size: 32px}}.samsa-hero,#footer{--world: url(\"/images/worlds/lucerne-night-1600.a0818645bc.webp\");--world-base: #383439;--world-vig: 44 49 53}@media (max-width: 767px){.samsa-hero,#footer{--world: url(\"/images/worlds/lucerne-night-800.774b073457.webp\")}}.samsa-hero,#footer{--vig: 0.25;--world-scrim: linear-gradient(transparent, transparent);position:relative;isolation:isolate;overflow:hidden;background-color:var(--world-base);-webkit-mask-image:linear-gradient(#000 0 0);mask-image:linear-gradient(#000 0 0)}.samsa-hero::before,#footer::before{--world-vignette: radial-gradient(\n farthest-corner ellipse at 50% 50%,\n rgb(var(--world-vig) / 0) 30%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.0138)) 40%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.0635)) 50%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.155)) 60%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.292)) 70%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.477)) 80%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.7124)) 90%,\n rgb(var(--world-vig) / var(--vig)) 100%\n );--world-shade-layer: linear-gradient(\n rgb(var(--world-dim) / var(--world-shade, 0)),\n rgb(var(--world-dim) / var(--world-shade, 0))\n );content:\"\";position:absolute;inset:0;z-index:-2;pointer-events:none;background-image:var(--world-shade-layer),\n var(--world-scrim),\n var(--world-vignette),\n var(--world);background-position:var(--world-x, 50%) var(--world-y, 50%);background-size:calc(100% / var(--world-zoom, 1)) calc(100% / var(--world-zoom, 1)),\n calc(100% / var(--world-zoom, 1)) calc(100% / var(--world-zoom, 1)),\n calc(100% / var(--world-zoom, 1)) calc(100% / var(--world-zoom, 1)),\n cover;background-repeat:no-repeat;transform-origin:var(--world-x, 50%) var(--world-y, 50%);scale:var(--world-zoom, 1)}.samsa-hero::after,#footer::after{content:\"\";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--world-grain) 0 0 / var(--world-grain-size) var(--world-grain-size);mix-blend-mode:difference}.samsa-hero{--world-x: 70%;--world-y: 40%;--world-zoom: 1.4;--world-shade: 0;--vig: 0.25;--world-scrim: radial-gradient(\n 72% 140% at 22% 50%,\n rgb(var(--world-dim) / 0.56),\n rgb(var(--world-dim) / 0.36) 60%,\n rgb(var(--world-dim) / 0)\n );margin:1.75rem 0 2.75rem;padding:2.25rem 2rem;border-radius:1rem;color:#f3f0ea}.samsa-hero__title{margin:0 0 0.55rem;max-width:22ch;font-size:1.8rem;font-weight:650;line-height:1.15;letter-spacing:-0.021em;color:#f3f0ea}.samsa-hero__lede{margin:0 0 1.35rem;max-width:46ch;font-size:0.95rem;line-height:1.6;color:#f3f0ea}.samsa-hero__actions{display:flex;flex-wrap:wrap;align-items:center;gap:0.75rem 1.25rem}.samsa-hero__cta,.samsa-hero__link{text-decoration:none;font-size:0.875rem;font-weight:600;border-radius:0.6rem}.samsa-hero__cta{display:inline-flex;align-items:center;padding:0.58rem 1.1rem;border:0;background:#f3f0ea;color:#0e0c16;transition:background-color 0.15s ease, color 0.15s ease}.samsa-hero__cta:hover{background:#ff5a24;color:#fff}.samsa-hero .samsa-hero__link{color:#f3f0ea;border-bottom:2px solid rgb(243 240 234 / 0.45);border-radius:0;padding-bottom:2px;transition:border-color 0.15s ease, box-shadow 0.15s ease}.samsa-hero .samsa-hero__link:hover{color:#f3f0ea;border-bottom-color:#ff5a24;box-shadow:0 1px 0 #ff5a24}.samsa-hero__cta:focus-visible,.samsa-hero__link:focus-visible{outline:2px solid #ff5a24!important;outline-offset:3px}@media (max-width: 640px){.samsa-hero{--world-x: 70%;--world-y: 40%;--world-zoom: 1.2;--world-scrim: radial-gradient(\n 150% 90% at 40% 35%,\n rgb(var(--world-dim) / 0.5),\n rgb(var(--world-dim) / 0.32) 60%,\n rgb(var(--world-dim) / 0.1)\n );padding:1.75rem 1.35rem}.samsa-hero__title{font-size:1.5rem}}#footer{--world-x: 60%;--world-y: 35%;--world-zoom: 1.7;--world-shade: 0.06;--vig: 0.35;--foot-glass: rgb(255 255 255 / 0.72);--foot-glass-solid: rgb(255 255 255 / 0.96);--foot-edge: rgb(21 18 58 / 0.08);--foot-rim: rgb(255 255 255 / 0.9);--foot-heading: #15123a;--foot-text: #3f3c56;--foot-quiet: #5e5a72;--foot-hover: #c43d0b;--foot-chip: rgb(21 18 58 / 0.08);margin:2.5rem 1rem 1rem;padding:2.5rem 1rem;border:0;border-radius:28px}html.dark #footer{--foot-glass: rgb(28 26 40 / 0.66);--foot-glass-solid: rgb(26 24 36 / 0.97);--foot-edge: rgb(0 0 0 / 0.4);--foot-rim: rgb(255 255 255 / 0.12);--foot-heading: #f3f0ea;--foot-text: #c2bdd1;--foot-quiet: #a7a2b8;--foot-hover: #ff8a5c;--foot-chip: rgb(255 255 255 / 0.12)}@media (min-width: 768px){#footer{margin:3rem 1.5rem 1.5rem;padding:4rem 2rem;border-radius:36px}}#footer>div{position:relative;padding:2.5rem 1.75rem 1.75rem;border-radius:24px;background:var(--foot-glass);box-shadow:0 0 0 1px var(--foot-edge),\n 0 30px 60px -28px rgb(21 18 58 / 0.32);-webkit-backdrop-filter:blur(32px) saturate(1.8) brightness(1.12);backdrop-filter:blur(32px) saturate(1.8) brightness(1.12)}@media (min-width: 768px){#footer>div{padding:3rem 3rem 2rem}}@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){#footer>div{background:var(--foot-glass-solid)}}#footer>div::before{content:\"\";position:absolute;inset:0;border-radius:inherit;padding:1px;background:linear-gradient(180deg, var(--foot-rim), transparent 40%);-webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;pointer-events:none}#footer p{color:var(--foot-heading)}#footer a{color:var(--foot-text)}#footer a:hover{color:var(--foot-hover)}#footer svg[style*=\"mask\"]{background-color:var(--foot-text)}#footer a:hover svg[style*=\"mask\"]{background-color:var(--foot-hover)}#footer a[href*=\"mintlify.com\"]{color:var(--foot-text)}#footer a[href*=\"mintlify.com\"]:hover{color:var(--foot-hover)}#footer [class*=\"h-px\"]{background-color:var(--foot-edge)}#footer button[data-testid^=\"mode-switch\"]{color:var(--foot-quiet);background-color:transparent}#footer button[data-testid^=\"mode-switch\"][aria-pressed=\"true\"]{color:var(--foot-heading);background-color:var(--foot-chip)}#footer button[data-testid^=\"mode-switch\"]:hover{color:var(--foot-hover)}@media (min-width: 1024px) and (prefers-reduced-motion: no-preference){.samsa-hero,#footer{--world-dim: 9 7 16;--world-vig: 18 23 27;--vig: 0.3}.samsa-hero{--vig: 0.45}.samsa-hero::before,#footer::before{position:fixed;inset:0;scale:none;background-color:var(--world-base);background-image:var(--world-grain), url(\"/images/worlds/lucerne-night-1600.a0818645bc.webp\");background-position:0 0, 50% 60%;background-size:var(--world-grain-size) var(--world-grain-size),\n calc(max(100vw, 177.78vh) * 1.15) auto;background-repeat:repeat, no-repeat;background-blend-mode:difference, normal}.samsa-hero::after,#footer::after{mix-blend-mode:normal;background:linear-gradient(\n rgb(var(--world-dim) / var(--world-shade, 0)),\n rgb(var(--world-dim) / var(--world-shade, 0))\n ),\n var(--world-scrim),\n radial-gradient(\n farthest-corner ellipse at 50% 50%,\n rgb(var(--world-vig) / 0) 30%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.0138)) 40%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.0635)) 50%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.155)) 60%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.292)) 70%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.477)) 80%,\n rgb(var(--world-vig) / calc(var(--vig) * 0.7124)) 90%,\n rgb(var(--world-vig) / var(--vig)) 100%\n )}}#footer a.select-none{display:flex;flex-direction:column;align-items:flex-start;gap:14px}#footer a.select-none::after{content:\"The Brand System for AI Agents\";font-size:1rem;line-height:1.5;color:var(--foot-text);white-space:nowrap}@media (max-width: 767px){#footer div:has(>a.select-none){flex-wrap:wrap;row-gap:20px}#footer a.select-none{flex-basis:100%}#footer a.select-none+div{justify-content:flex-start}}@media (min-width: 768px) and (max-width: 1023px){#footer div:has(>div>a.select-none){flex-wrap:wrap}#footer div:has(>a.select-none){flex-basis:100%}}"}],"page":{"pagePath":"api-reference/account/credits","slug":"/api-reference/account/credits","pageMetadata":{"title":"Get credits","description":"Read the credit balance this API key can spend.","openapi":"api-reference/openapi.json GET /credits","href":"/api-reference/account/credits"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Read the credit balance this API key can spend.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Returns what the `,_jsx(_components.strong,{children:`calling credential`}),` — this API key or OAuth connection — can spend\nright now, alongside the organization-wide totals it is derived from. Requires the\n`,_jsx(_components.code,{children:`usage.read`}),` scope. For rates, see `,_jsx(_components.a,{href:`/guides/pricing`,children:`Pricing`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`credential-spendable-vs-organization-wide`,children:`Credential-spendable vs organization-wide`}),`\n`,_jsxs(_components.p,{children:[`The response carries two kinds of number. `,_jsx(_components.code,{children:`available`}),` and `,_jsx(_components.code,{children:`spendable_plan_credits`}),`\nanswer “what can `,_jsx(_components.em,{children:`this`}),` credential spend”; `,_jsx(_components.code,{children:`plan_credits`}),` and `,_jsx(_components.code,{children:`topup_credits`}),` are\norganization-wide balances.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`What it is`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`available`})}),_jsxs(_components.td,{children:[`Credits this credential can spend `,_jsx(_components.strong,{children:`right now`}),` — `,_jsx(_components.code,{children:`spendable_plan_credits + topup_credits`}),`. This is the number to compare a job’s `,_jsx(_components.code,{children:`estimated_credits`}),` against.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`spendable_plan_credits`})}),_jsxs(_components.td,{children:[`The plan-pool part of `,_jsx(_components.code,{children:`available`}),`: `,_jsx(_components.code,{children:`plan_credits`}),` capped by `,_jsx(_components.code,{children:`scope.remaining`}),`. Equal to `,_jsx(_components.code,{children:`plan_credits`}),` when nothing caps this credential.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`plan_credits`})}),_jsxs(_components.td,{children:[`The `,_jsx(_components.strong,{children:`organization’s`}),` remaining monthly plan pool — not necessarily all spendable by this credential. `,_jsx(_components.code,{children:`0`}),` when the pool is exhausted, or when the subscription is canceled and past its period end (top-ups stay spendable).`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`topup_credits`})}),_jsx(_components.td,{children:`Remaining credits from valid, non-expired top-up purchases. Top-ups are exempt from team budgets, so they are always fully spendable.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`period`})}),_jsx(_components.td,{children:`The organization’s current billing period. Team budget usage resets with it.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`scope`})}),_jsx(_components.td,{children:`The budget regime this credential spends under — see below.`})]})]})]}),`\n`,_jsx(_components.p,{children:`Three relations always hold:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`available == spendable_plan_credits + topup_credits`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`spendable_plan_credits \u003c= plan_credits`})}),`\n`,_jsxs(_components.li,{children:[`for an organization with no active teams, `,_jsx(_components.code,{children:`spendable_plan_credits == plan_credits`})]}),`\n`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`If your organization has no teams, nothing changed for you.`}),` `,_jsx(_components.code,{children:`scope.type`}),` is\n`,_jsx(_components.code,{children:`org`}),`, `,_jsx(_components.code,{children:`spendable_plan_credits`}),` equals `,_jsx(_components.code,{children:`plan_credits`}),`, and `,_jsx(_components.code,{children:`available`}),` is still the\nplan pool plus top-ups.`]})}),`\n`,_jsxs(Heading,{level:`2`,id:`the-budget-regime-scope`,children:[`The budget regime (`,_jsx(_components.code,{children:`scope`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`An organization can reserve parts of its monthly plan pool as per-team `,_jsx(_components.strong,{children:`budgets`}),`, and\nevery API key can be assigned to a team. A credential then spends from exactly one\nbucket, and only that bucket’s headroom is available to it — which is why `,_jsx(_components.code,{children:`available`}),`\ncan be lower than the organization-wide `,_jsx(_components.code,{children:`plan_credits`}),`.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`scope.type`})}),_jsx(_components.th,{children:`Meaning`}),_jsx(_components.th,{children:`Shortfall error code`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`org`})}),_jsxs(_components.td,{children:[`The organization has no active teams (the common case), or it is a budget-exempt system organization. Nothing caps this credential, so `,_jsx(_components.code,{children:`budget`}),`, `,_jsx(_components.code,{children:`used`}),`, and `,_jsx(_components.code,{children:`remaining`}),` are all `,_jsx(_components.code,{children:`null`}),`.`]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/guides/errors#insufficient_credits`,children:_jsx(_components.code,{children:`insufficient_credits`})})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`team`})}),_jsx(_components.td,{children:`The credential is bound to an active team that has its own monthly budget.`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/guides/errors#insufficient_team_credits`,children:_jsx(_components.code,{children:`insufficient_team_credits`})})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unallocated`})}),_jsxs(_components.td,{children:[`The organization has at least one active team, and this credential is `,_jsx(_components.strong,{children:`not`}),` bound to a budgeted one — it has no team, or its team has no budget of its own. `,_jsx(_components.code,{children:`budget`}),` is the monthly plan allocation minus every active team budget, floored at `,_jsx(_components.code,{children:`0`}),`.`]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/guides/errors#insufficient_unallocated_credits`,children:_jsx(_components.code,{children:`insufficient_unallocated_credits`})})})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`scope.team`}),` names the team the credential is bound to, or is `,_jsx(_components.code,{children:`null`}),` when it is bound to\nnone. `,_jsx(_components.code,{children:`scope.remaining`}),` is `,_jsx(_components.code,{children:`budget - used`}),`, floored at `,_jsx(_components.code,{children:`0`}),`.`]}),`\n`,_jsx(_components.p,{children:`A team-bound key whose budget is the binding constraint:`}),`\n`,_jsx(CodeBlock,{filename:`Response`,numberOfLines:`20`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`20`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"available\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1450`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"spendable_plan_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"plan_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8031`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"topup_credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`250`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"period\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"start\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2026-07-01T00:00:00+00:00\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"end\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2026-08-01T00:00:00+00:00\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scope\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"team\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7f3c1e28-9b4d-4a61-8e52-0c7d6b5a4f39\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Marketing\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"budget\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"used\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8800`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"remaining\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1200`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The organization still has `,_jsx(_components.code,{children:`8031`}),` plan credits, but the Marketing budget has `,_jsx(_components.code,{children:`1200`}),` left,\nso this key can only spend `,_jsx(_components.code,{children:`1200`}),` of them — plus the `,_jsx(_components.code,{children:`250`}),` budget-exempt top-up credits,\nfor `,_jsx(_components.code,{children:`1450`}),` in total.`]}),`\n`,_jsx(Heading,{level:`2`,id:`predicting-and-diagnosing-a-402`,children:`Predicting and diagnosing a 402`}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`available`}),` is the predictor.`]}),` A job whose `,_jsx(_components.code,{children:`estimated_credits`}),` is at most `,_jsx(_components.code,{children:`available`}),`\nis not refused with an insufficient-credit `,_jsx(_components.code,{children:`402`}),`, and conversely such a `,_jsx(_components.code,{children:`402`}),` means the\nestimate exceeded `,_jsx(_components.code,{children:`available`}),` — on `,_jsx(_components.strong,{children:`either`}),` number, the credential’s, not the\norganization’s. One exception: an `,_jsx(_components.strong,{children:`operational failure inside the deduction itself`}),`\n(for example a degraded balance lookup) is reported as the generic\n`,_jsx(_components.a,{href:`/guides/errors#insufficient_credits`,children:_jsx(_components.code,{children:`insufficient_credits`})}),` whatever the regime,\nwithout proving anything about `,_jsx(_components.code,{children:`available`}),` — a plain `,_jsx(_components.code,{children:`insufficient_credits`}),` where you\nexpected a team-aware code can therefore be transient; retry before treating it as an\nexhausted balance.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The prediction holds only as long as the credit and budget state does not change between\nthe read and the submit. Another credential of the same organization spending, a top-up\nlot expiring, a subscription change, a team budget being edited, or a key being reassigned\nto a different team can all move `,_jsx(_components.code,{children:`available`}),` — and even change `,_jsx(_components.code,{children:`scope.type`}),` and therefore\nwhich error code you get — without any spend of your own.\n`,_jsx(_components.a,{href:`/guides/errors#subscription_inactive`,children:_jsx(_components.code,{children:`subscription_inactive`})}),` is a separate `,_jsx(_components.code,{children:`402`}),`,\nunrelated to this comparison.`]})}),`\n`,_jsxs(_components.p,{children:[`When a submit is refused, `,_jsx(_components.code,{children:`scope`}),` explains it:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`scope.type`}),` names the budget regime, which is what selects the error code`]}),`\n(barring the operational-failure fallback above) — see the table above. It does\n`,_jsx(_components.strong,{children:`not`}),` tell you which balance ran out: a key under the `,_jsx(_components.code,{children:`team`}),`\nregime gets `,_jsx(_components.code,{children:`insufficient_team_credits`}),` even when the organization’s plan pool, and not\nthe team budget, is what was exhausted.`]}),`\n`,_jsxs(_components.li,{children:[`To find the actual bottleneck under a capped regime (`,_jsx(_components.code,{children:`team`}),` or `,_jsx(_components.code,{children:`unallocated`}),`), compare\n`,_jsx(_components.code,{children:`plan_credits`}),` with `,_jsx(_components.code,{children:`scope.remaining`}),` — the smaller one caps `,_jsx(_components.code,{children:`spendable_plan_credits`}),`.\nUnder `,_jsx(_components.code,{children:`org`}),`, `,_jsx(_components.code,{children:`scope.remaining`}),` is `,_jsx(_components.code,{children:`null`}),` and `,_jsx(_components.code,{children:`plan_credits`}),` is the only possible\nbottleneck.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`remaining: 0`}),` means that bucket is fully spent for the current `,_jsx(_components.code,{children:`period`}),`. It is `,_jsx(_components.strong,{children:`not`}),`\na precondition of the error: a bucket with `,_jsx(_components.code,{children:`remaining: 100`}),` and no top-ups still refuses\na job costing `,_jsx(_components.code,{children:`200`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`So a key with no team, in an organization whose plan pool is fully allocated to teams,\nreports `,_jsx(_components.code,{children:`available: 0`}),` with `,_jsx(_components.code,{children:`scope.type: \"unallocated\"`}),` and `,_jsx(_components.code,{children:`remaining: 0`}),` — every submit\nthat costs credits will be refused with `,_jsx(_components.code,{children:`insufficient_unallocated_credits`}),` until a budget is lowered, the\nkey is assigned to a team with headroom, or top-ups are purchased. See\n`,_jsx(_components.a,{href:`/guides/errors#insufficient_team_credits`,children:`Errors`}),` for how to resolve each code.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Get credits","description":"Read the credit balance this API key can spend.","openapi":"api-reference/openapi.json GET /credits","href":"/api-reference/account/credits"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Credential-spendable vs organization-wide","slug":"credential-spendable-vs-organization-wide","depth":2,"children":[]},{"title":"The budget regime (scope)","slug":"the-budget-regime-scope","depth":2,"children":[]},{"title":"Predicting and diagnosing a 402","slug":"predicting-and-diagnosing-a-402","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["Usage"],"summary":"Read the credit balance this API key can spend","description":"Read the credit balance this API key can spend.","operationId":"read_credits_credits_get","responses":{"200":"b7e204df-23e4-43ad-87a2-e2aeb6680d5f","401":"f1e57d13-e30e-4af8-8682-7816a82c308f","402":"4274f5e3-0767-4876-bedc-9c40cd7bfd5b","403":"19c6bd3b-8606-4933-b4d7-7ddc422310c1","404":"f48cf0ad-dea0-4cae-b3f6-5a6d57055a4f","422":"f3d193da-1a28-4f2c-96cb-1e0403c17380","429":"9880ae09-e68f-4316-ad8a-728665cc83dc","500":"30ee878b-2a83-45b8-ae32-e9292a7c37fc"},"method":"get","type":"path","servers":["a67142cd-ab67-49c9-9651-75e0f34b1e93"],"security":["a11deb78-1585-485f-a0ea-777224f847bc"],"path":"/credits","baseUrlOptions":["https://api.samsa.ai/public/v1"],"title":"Read the credit balance this API key can spend","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"responses":{"b7e204df-23e4-43ad-87a2-e2aeb6680d5f":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"available":{"type":"integer","title":"Available","description":"Total credits the calling credential can spend right now — the sum of `spendable_plan_credits` and `topup_credits`. Capped by the credential's team budget bucket (see `scope`), so it can be lower than the organization-wide `plan_credits`.","examples":[1450],"isRequired":true,"uniqueKey":"available","typeLabel":"integer"},"spendable_plan_credits":{"type":"integer","title":"Spendable Plan Credits","description":"Plan-pool credits the calling credential can spend right now: `plan_credits` capped by `scope.remaining`. Equal to `plan_credits` when no team budget applies.","examples":[1200],"isRequired":true,"uniqueKey":"spendable_plan_credits","typeLabel":"integer"},"plan_credits":{"type":"integer","title":"Plan Credits","description":"The ORGANIZATION's remaining monthly subscription-pool credits — not necessarily all spendable by this credential (see `spendable_plan_credits`). 0 when the plan pool is exhausted or the subscription is canceled and past its period end (top-up credits stay spendable).","examples":[1200],"isRequired":true,"uniqueKey":"plan_credits","typeLabel":"integer"},"topup_credits":{"type":"integer","title":"Topup Credits","description":"Remaining credits from valid (non-expired) top-up purchases. Top-ups are exempt from team budgets, so they are always fully spendable by any credential of the organization.","examples":[250],"isRequired":true,"uniqueKey":"topup_credits","typeLabel":"integer"},"period":{"properties":{"start":{"type":"string","format":"date-time","title":"Start","examples":["2026-07-01T00:00:00+00:00"],"isRequired":true,"uniqueKey":"period.start","typeLabel":"string\u003cdate-time>"},"end":{"type":"string","format":"date-time","title":"End","examples":["2026-08-01T00:00:00+00:00"],"isRequired":true,"uniqueKey":"period.end","typeLabel":"string\u003cdate-time>"}},"type":"object","required":["start","end"],"title":"BillingPeriod","description":"The org subscription's current billing-period bounds (ISO-8601).","isRequired":true,"uniqueKey":"period","typeLabel":"BillingPeriod · object"},"scope":{"properties":{"type":{"type":"string","enum":["org","team","unallocated"],"title":"PublicCreditsScopeType","description":"`org` — the organization has no ACTIVE teams (the common case; soft-deleted teams do not count), or it is a system organization exempt from team budgeting; either way the whole plan pool is available and `budget`/`used`/`remaining` are `null` because no cap exists. `team` — the credential is bound to an active team with its own monthly budget. `unallocated` — the credential spends the part of the plan pool that is NOT reserved for any team (credentials with no team, or bound to a team without a budget).","examples":["unallocated"],"isRequired":true,"uniqueKey":"scope.type","typeLabel":"enum\u003cstring>"},"team":{"oneOf":[{"type":"object","title":"PublicCreditsTeamRef","description":"The team the credential is bound to, or `null` when it is bound to none. Present on `type=unallocated` too when the bound team has no budget of its own.","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","title":"Id","isRequired":true,"uniqueKey":"scope.team.oneOf.0.id","typeLabel":"string\u003cuuid>"},"name":{"type":"string","title":"Name","examples":["Marketing"],"isRequired":true,"uniqueKey":"scope.team.oneOf.0.name","typeLabel":"string"}},"uniqueKey":"scope.team.oneOf.0","typeLabel":"PublicCreditsTeamRef · object"},{"type":"null","description":"The team the credential is bound to, or `null` when it is bound to none. Present on `type=unallocated` too when the bound team has no budget of its own.","uniqueKey":"scope.team.oneOf.1","typeLabel":"null"}],"uniqueKey":"scope.team","typeLabel":"PublicCreditsTeamRef · object | null"},"budget":{"oneOf":[{"type":"integer","title":"Budget","description":"Credits allocated to this bucket for the current billing period. `null` for `type=org` (no cap). For `unallocated` this is the monthly plan allocation minus the sum of all active team budgets, floored at 0 (`max(0, …)` — team allocations can exceed the plan pool).","example":2000,"uniqueKey":"scope.budget.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Budget","description":"Credits allocated to this bucket for the current billing period. `null` for `type=org` (no cap). For `unallocated` this is the monthly plan allocation minus the sum of all active team budgets, floored at 0 (`max(0, …)` — team allocations can exceed the plan pool).","example":2000,"uniqueKey":"scope.budget.oneOf.1","typeLabel":"null"}],"uniqueKey":"scope.budget","typeLabel":"integer | null"},"used":{"oneOf":[{"type":"integer","title":"Used","description":"Credits already spent from this bucket in the current billing period, net of refunds. `null` for `type=org`.","example":500,"uniqueKey":"scope.used.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Used","description":"Credits already spent from this bucket in the current billing period, net of refunds. `null` for `type=org`.","example":500,"uniqueKey":"scope.used.oneOf.1","typeLabel":"null"}],"uniqueKey":"scope.used","typeLabel":"integer | null"},"remaining":{"oneOf":[{"type":"integer","title":"Remaining","description":"Headroom left in this bucket (`budget - used`, floored at 0) — the ceiling this credential's plan-pool spend is capped at. `null` for `type=org` (no cap).","example":1500,"uniqueKey":"scope.remaining.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Remaining","description":"Headroom left in this bucket (`budget - used`, floored at 0) — the ceiling this credential's plan-pool spend is capped at. `null` for `type=org` (no cap).","example":1500,"uniqueKey":"scope.remaining.oneOf.1","typeLabel":"null"}],"uniqueKey":"scope.remaining","typeLabel":"integer | null"}},"type":"object","required":["type"],"title":"PublicCreditsScope","description":"The credit bucket the calling credential spends from (SAM-1029).\n\nOrganizations can reserve parts of their monthly plan pool for teams. A\ncredential (API key or OAuth connection) spends from exactly ONE bucket, and\nonly that bucket's headroom is available to it — which is why `available`\ncan be lower than the organization-wide `plan_credits`. The shortfall rule\nis `cost > available` (`spendable_plan_credits + topup_credits`): a submit\nis refused with an insufficient-credit 402 when the deduction,\nre-evaluating the same numbers at execution time, finds the estimated cost\nabove `available` — `insufficient_credits` under the uncapped `org` regime,\n`insufficient_team_credits` under `team`, and\n`insufficient_unallocated_credits` under `unallocated` (operational\nfailures inside the deduction fall back to the generic\n`insufficient_credits`, whatever the regime). This response is a\npoint-in-time snapshot, not a reservation: concurrent spends, top-up lots\nexpiring, a canceled subscription's period ending, or a degraded balance\nlookup can make the deduction-time numbers differ from the ones reported\nhere, and other checks can reject a request regardless of credits.\n`type` names the budget regime and selects which of those codes a balance\nshortfall raises — it does not say which balance ran out: under a capped\nregime the smaller of `plan_credits` and `remaining` limits\n`spendable_plan_credits`.\n`remaining: 0` means this bucket has no plan-pool headroom left for the\ncurrent period (spent down, or never allocated any); it is NOT a\nprecondition of the error — a bucket with `remaining: 100` and no top-ups\nstill refuses a job costing 200.","isRequired":true,"uniqueKey":"scope","typeLabel":"PublicCreditsScope · object"}},"type":"object","required":["available","spendable_plan_credits","plan_credits","topup_credits","period","scope"],"title":"PublicCreditsResponse","description":"``GET /credits`` body — what the CALLING credential can spend (ADR §10, SAM-1029).\n\nTwo kinds of number:\n\n* ``available`` / ``spendable_plan_credits`` answer \"what can THIS API key or\n OAuth connection spend right now\" — capped by its team budget bucket\n (``scope``), so a job estimated at or below ``available`` is not rejected\n with ``insufficient_team_credits`` / ``insufficient_unallocated_credits``.\n* ``plan_credits`` / ``topup_credits`` are the ORGANIZATION-wide balances.\n\nAll amounts are balances (not allocations), and\n``available == spendable_plan_credits + topup_credits`` always holds, as does\n``spendable_plan_credits \u003c= plan_credits`` (they are equal whenever no team\nbudget applies).","uniqueKey":"","typeLabel":"PublicCreditsResponse · object"},"examples":{"Example":{"title":"Example","value":{"available":1450,"spendable_plan_credits":1200,"plan_credits":1200,"topup_credits":250,"period":{"start":"2026-07-01T00:00:00+00:00","end":"2026-08-01T00:00:00+00:00"},"scope":{"type":"unallocated","team":{"id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","name":"Marketing"},"budget":2000,"used":500,"remaining":1500}}}},"exampleType":"generated"}},"exampleType":"generated"},"f1e57d13-e30e-4af8-8682-7816a82c308f":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"4274f5e3-0767-4876-bedc-9c40cd7bfd5b":{"description":"Insufficient credits or inactive subscription.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"19c6bd3b-8606-4933-b4d7-7ddc422310c1":{"description":"The API key lacks the required scope.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"f48cf0ad-dea0-4cae-b3f6-5a6d57055a4f":{"description":"Resource not found.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"f3d193da-1a28-4f2c-96cb-1e0403c17380":{"description":"Request validation failed.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"9880ae09-e68f-4316-ad8a-728665cc83dc":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"},"30ee878b-2a83-45b8-ae32-e9292a7c37fc":{"description":"Internal server error.","content":{"application/json":{"schema":{"properties":{"error":{"properties":{"type":{"type":"string","title":"Type","examples":["authentication_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","title":"Code","examples":["invalid_api_key"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","title":"Message","examples":["The provided API key is invalid, expired, or revoked."],"isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","title":"Request Id","examples":["8f14e45fceea167a5a36dedd4bea2543"],"isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","title":"Param","description":"Present on validation errors — names the offending field.","example":"aspect_ratio","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"}},"type":"object","required":["type","code","message","request_id"],"title":"ErrorDetail","description":"The ``error`` object of the public envelope (ADR §5).","isRequired":true,"uniqueKey":"error","typeLabel":"ErrorDetail · object"}},"type":"object","required":["error"],"title":"ErrorEnvelope","description":"The complete public error body — an ``error`` object wrapper (ADR §5).","uniqueKey":"","typeLabel":"ErrorEnvelope · object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The provided API key is invalid, expired, or revoked.","request_id":"8f14e45fceea167a5a36dedd4bea2543","param":"aspect_ratio"}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"a11deb78-1585-485f-a0ea-777224f847bc":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Organization API key (`Authorization: Bearer samsa_sk_...`) or OAuth 2.1 access token (`Authorization: Bearer samsa_at_...`).","scopes":[],"schemeName":"BearerAuth"}}},"servers":{"a67142cd-ab67-49c9-9651-75e0f34b1e93":{"url":"https://api.samsa.ai/public/v1"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"Organization API key (`Authorization: Bearer samsa_sk_...`) or OAuth 2.1 access token (`Authorization: Bearer samsa_at_...`).","scopes":[],"schemeName":"BearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Organization API key (`Authorization: Bearer samsa_sk_...`) or OAuth 2.1 access token (`Authorization: Bearer samsa_at_...`).","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"samsa-6b52d36f","siteName":"Samsa","title":"Get credits - Samsa","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/api-reference/account/credits","matchLevel":0},"de":{"href":"/de/api-reference/account/credits","matchLevel":1},"fr":{"href":"/fr/api-reference/account/credits","matchLevel":1},"it":{"href":"/it/api-reference/account/credits","matchLevel":1}}},"lastModified":"2026-08-12T20:57:33.793Z","originalFileLocation":"api-reference/account/credits.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Read the credit balance this API key can spend.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Samsa\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Get credits - Samsa\">\u003cmeta data-mint-head property=\"og:description\" content=\"Read the credit balance this API key can spend.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Samsa\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.samsa.ai/api-reference/account/credits\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://samsa-6b52d36f.mintlify.site/_mintlify/api/og/v2?division=Account+%26+Usage\u0026amp;title=Get+credits\u0026amp;description=Read+the+credit+balance+this+API+key+can+spend.\u0026amp;theme=b3c7b7defba13e92508f1219\u0026amp;signature=32b08e64beab6682e86b930eb7d29b43f98a8fddc3cb96fd397a961c6dd8bc6b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Get credits - Samsa\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Read the credit balance this API key can spend.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://samsa-6b52d36f.mintlify.site/_mintlify/api/og/v2?division=Account+%26+Usage\u0026amp;title=Get+credits\u0026amp;description=Read+the+credit+balance+this+API+key+can+spend.\u0026amp;theme=b3c7b7defba13e92508f1219\u0026amp;signature=32b08e64beab6682e86b930eb7d29b43f98a8fddc3cb96fd397a961c6dd8bc6b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/samsa-6b52d36f/d_WeLiSBvKQ9voQx/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Samsa\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#15123A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.samsa.ai/api-reference/account/credits\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/account/credits.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.samsa.ai/api-reference/account/credits\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"de\" href=\"https://docs.samsa.ai/de/api-reference/account/credits\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fr\" href=\"https://docs.samsa.ai/fr/api-reference/account/credits\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"it\" href=\"https://docs.samsa.ai/it/api-reference/account/credits\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.samsa.ai/api-reference/account/credits\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://samsa.ai/#organization\",\"name\":\"Samsa\",\"legalName\":\"Samsa Labs AG\",\"url\":\"https://samsa.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://samsa.ai/wp-content/uploads/2026/01/samsa_logo.webp\"},\"sameAs\":[\"https://www.linkedin.com/company/samsa-ai/\"]},{\"@type\":\"WebSite\",\"@id\":\"https://docs.samsa.ai#website\",\"name\":\"Samsa\",\"url\":\"https://docs.samsa.ai\",\"publisher\":{\"@id\":\"https://samsa.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.samsa.ai/api-reference/account/credits#webpage\",\"url\":\"https://docs.samsa.ai/api-reference/account/credits\",\"name\":\"Get credits\",\"description\":\"Read the credit balance this API key can spend.\",\"dateModified\":\"2026-08-12T20:57:33.793Z\",\"isPartOf\":{\"@id\":\"https://docs.samsa.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.samsa.ai/api-reference/account/credits#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.samsa.ai/api-reference/account/credits#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Endpoints\",\"item\":\"https://docs.samsa.ai/api-reference/images/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Account \u0026 Usage\",\"item\":\"https://docs.samsa.ai/api-reference/account/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Get credits\",\"item\":\"https://docs.samsa.ai/api-reference/account/credits\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.samsa.ai/api-reference/account/credits#apireference\",\"headline\":\"Get credits\",\"name\":\"Get credits\",\"description\":\"Read the credit balance this API key can spend.\",\"url\":\"https://docs.samsa.ai/api-reference/account/credits\",\"mainEntityOfPage\":{\"@id\":\"https://docs.samsa.ai/api-reference/account/credits#webpage\"},\"dateModified\":\"2026-08-12T20:57:33.793Z\",\"publisher\":{\"@id\":\"https://samsa.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.samsa.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Samsa\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Samsa\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/account/credits.md","siteName":"Samsa","nav":{"global":null,"languages":[{"language":"en","default":true,"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Information","items":[{"label":"Docs home","href":"/"},{"label":"Changelog","href":"/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Pricing","href":"https://samsa.ai/pricing"},{"label":"Contact us","href":"https://samsa.ai/contact"}]},{"header":"Legal","items":[{"label":"Terms of Service","href":"https://samsa.ai/terms-of-service"},{"label":"Acceptable Use Policy","href":"https://samsa.ai/acceptable-use-policy"},{"label":"Privacy Policy","href":"https://samsa.ai/privacy-policy"},{"label":"Imprint","href":"https://samsa.ai/imprint"}]}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"API reference","groups":[{"group":"Overview","pages":[{"title":"Samsa API","href":"/api"},{"title":"API reference","href":"/api-reference/introduction"}]},{"group":"Endpoints","pages":[{"group":"Image Generation","pages":[{"title":"Image Generation","sidebarTitle":"Overview","href":"/api-reference/images/overview"},{"title":"Generate images","openapi":"api-reference/openapi.json POST /images/generations","href":"/api-reference/images/generate"},{"title":"Get an image generation","openapi":"api-reference/openapi.json GET /images/generations/{generation_id}","href":"/api-reference/images/get-generation"},{"title":"List image engines","openapi":"api-reference/openapi.json GET /images/models","href":"/api-reference/images/list-engines"}]},{"group":"Image Uploads","pages":[{"title":"Image Uploads","sidebarTitle":"Overview","href":"/api-reference/uploads/overview"},{"title":"Prepare an image upload","openapi":"api-reference/openapi.json POST /images/uploads/prepare","href":"/api-reference/uploads/prepare"},{"title":"Complete an image upload","openapi":"api-reference/openapi.json POST /images/uploads/{image_id}/complete","href":"/api-reference/uploads/complete"}]},{"group":"Image Editing","pages":[{"title":"Image Editing","sidebarTitle":"Overview","href":"/api-reference/edits/overview"},{"title":"Edit an image","openapi":"api-reference/openapi.json POST /images/edits","href":"/api-reference/edits/create"},{"title":"Get an image edit","openapi":"api-reference/openapi.json GET /images/edits/{edit_id}","href":"/api-reference/edits/get-edit"}]},{"group":"Image Operations","pages":[{"title":"Image Operations","sidebarTitle":"Overview","href":"/api-reference/image-ops/overview"},{"title":"Transform images (img2img)","openapi":"api-reference/openapi.json POST /images/img2img","href":"/api-reference/image-ops/img2img"},{"title":"Get an img2img job","openapi":"api-reference/openapi.json GET /images/img2img/{img2img_id}","href":"/api-reference/image-ops/get-img2img"},{"title":"Generate variations","openapi":"api-reference/openapi.json POST /images/variations","href":"/api-reference/image-ops/variations"},{"title":"Get a variations job","openapi":"api-reference/openapi.json GET /images/variations/{variation_id}","href":"/api-reference/image-ops/get-variations"},{"title":"Upscale an image","openapi":"api-reference/openapi.json POST /images/upscales","href":"/api-reference/image-ops/upscale"},{"title":"Get an upscale job","openapi":"api-reference/openapi.json GET /images/upscales/{upscale_id}","href":"/api-reference/image-ops/get-upscale"},{"title":"Resize an image","openapi":"api-reference/openapi.json POST /images/resizes","href":"/api-reference/image-ops/resize"},{"title":"Get a resize job","openapi":"api-reference/openapi.json GET /images/resizes/{resize_id}","href":"/api-reference/image-ops/get-resize"},{"title":"Remove a background","openapi":"api-reference/openapi.json POST /images/background-removals","href":"/api-reference/image-ops/remove-background"},{"title":"Get a background-removal job","openapi":"api-reference/openapi.json GET /images/background-removals/{background_removal_id}","href":"/api-reference/image-ops/get-background-removal"},{"title":"Vectorize an image","openapi":"api-reference/openapi.json POST /images/vectorizations","href":"/api-reference/image-ops/vectorize"},{"title":"Get a vectorization job","openapi":"api-reference/openapi.json GET /images/vectorizations/{vectorization_id}","href":"/api-reference/image-ops/get-vectorization"}]},{"group":"Video Generation","pages":[{"title":"Video Generation","sidebarTitle":"Overview","href":"/api-reference/videos/overview"},{"title":"Generate a video","openapi":"api-reference/openapi.json POST /videos/generations","href":"/api-reference/videos/generate"},{"title":"Get a video generation","openapi":"api-reference/openapi.json GET /videos/generations/{generation_id}","href":"/api-reference/videos/get-generation"},{"title":"List video engines","openapi":"api-reference/openapi.json GET /videos/models","href":"/api-reference/videos/list-engines"}]},{"group":"Prompt Improvement","pages":[{"title":"Prompt Improvement","sidebarTitle":"Overview","href":"/api-reference/prompts/overview"},{"title":"Improve a prompt","openapi":"api-reference/openapi.json POST /prompts/improve","href":"/api-reference/prompts/improve"}]},{"group":"Model Training","pages":[{"title":"Model Training","sidebarTitle":"Overview","href":"/api-reference/model-training/overview"},{"title":"Create a model","openapi":"api-reference/openapi.json POST /models","href":"/api-reference/model-training/create"},{"title":"Prepare a model upload","openapi":"api-reference/openapi.json POST /models/prepare","href":"/api-reference/model-training/prepare"},{"title":"Complete a model upload","openapi":"api-reference/openapi.json POST /models/{model_id}/complete","href":"/api-reference/model-training/complete"},{"title":"Get model status","openapi":"api-reference/openapi.json GET /models/{model_id}/status","href":"/api-reference/model-training/status"}]},{"group":"Models","pages":[{"title":"Models","sidebarTitle":"Overview","href":"/api-reference/models/overview"},{"title":"List models","openapi":"api-reference/openapi.json GET /models","href":"/api-reference/models/list"},{"title":"Get a model","openapi":"api-reference/openapi.json GET /models/{model_id}","href":"/api-reference/models/get"},{"title":"Update a model","openapi":"api-reference/openapi.json PATCH /models/{model_id}","href":"/api-reference/models/update"},{"title":"Delete a model","openapi":"api-reference/openapi.json DELETE /models/{model_id}","href":"/api-reference/models/delete"}]},{"group":"Account \u0026 Usage","pages":[{"title":"Account \u0026 Usage","sidebarTitle":"Overview","href":"/api-reference/account/overview"},{"title":"Get current key (me)","description":"Introspect the authenticated key, its organization, and available credits.","openapi":"api-reference/openapi.json GET /me","href":"/api-reference/account/me"},{"title":"Get credits","openapi":"api-reference/openapi.json GET /credits","href":"/api-reference/account/credits"},{"title":"Get usage","description":"Read the organization's API usage, grouped by action or day.","openapi":"api-reference/openapi.json GET /usage","href":"/api-reference/account/usage"}]}]}]},{"tab":"MCP server","pages":[{"title":"MCP server","href":"/mcp-server"}]},{"tab":"Content verification","pages":[{"title":"Content verification","href":"/content-verification/overview"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},{"language":"de","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informationen","items":[{"label":"Doku-Startseite","href":"/de"},{"label":"Changelog","href":"/de/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Preise","href":"https://samsa.ai/de/preise"},{"label":"Kontakt","href":"https://samsa.ai/de/kontakt"}]},{"header":"Rechtliches","items":[{"label":"AGB","href":"https://samsa.ai/de/agb"},{"label":"Nutzungsrichtlinie","href":"https://samsa.ai/de/nutzungsrichtlinie"},{"label":"Datenschutz","href":"https://samsa.ai/de/datenschutz"},{"label":"Impressum","href":"https://samsa.ai/de/impressum"}]}]},"pages":[{"title":"de","href":"/de/api-reference/account/credits"}]},{"language":"fr","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informations","items":[{"label":"Accueil documentation","href":"/fr"},{"label":"Changelog","href":"/fr/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Tarifs","href":"https://samsa.ai/fr/prix"},{"label":"Contact","href":"https://samsa.ai/fr/contact"}]},{"header":"Légal","items":[{"label":"Conditions générales","href":"https://samsa.ai/fr/conditions-generales"},{"label":"Politique d'utilisation acceptable","href":"https://samsa.ai/fr/politique-utilisation-acceptable"},{"label":"Politique de confidentialité","href":"https://samsa.ai/fr/politique-de-confidentialite"},{"label":"Mentions légales","href":"https://samsa.ai/fr/mentions-legales"}]}]},"pages":[{"title":"fr","href":"/fr/api-reference/account/credits"}]},{"language":"it","footer":{"socials":{"linkedin":"https://www.linkedin.com/company/samsa-ai","website":"https://samsa.ai"},"links":[{"header":"Informazioni","items":[{"label":"Home documentazione","href":"/it"},{"label":"Changelog","href":"/it/changelog"},{"label":"Dashboard","href":"https://app.samsa.ai"},{"label":"Prezzi","href":"https://samsa.ai/it/prezzi"},{"label":"Contatti","href":"https://samsa.ai/it/contatto"}]},{"header":"Legale","items":[{"label":"Termini e condizioni","href":"https://samsa.ai/it/termini-e-condizioni"},{"label":"Politica di utilizzo accettabile","href":"https://samsa.ai/it/politica-utilizzo-accettabile"},{"label":"Informativa sulla privacy","href":"https://samsa.ai/it/informativa-sulla-privacy"},{"label":"Note legali","href":"https://samsa.ai/it/impronta"}]}]},"pages":[{"title":"it","href":"/it/api-reference/account/credits"}]}]},"basePath":"","title":"Get credits - Samsa","deploymentId":"dpl_FZMKUpaaKiVETbfqhoUe4sPFDTmY","buildId":"dpl_FZMKUpaaKiVETbfqhoUe4sPFDTmY","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-B6WFFOBL.js","utils-BN5um1KA.js","cloneDeep-C3md22mN.js","_Uint8Array-DLlL8L26.js","isObject-FP1Yky1u.js","utils-BSmbkXJR.js","addUniqueKeysToSchema-2tqcVnUE.js","snippetPresets-CtWfvr2J.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-DkKHBy30.js","isEqual-O3q7y6pq.js","usePlaygroundInputsStore-Brc5H9UJ.js","shallow-C4L4xvbs.js","getApiPlaygroundDisplay-2bxyq_aI.js","CodeSnippet-BJu8ddd5.js","CodeSnippets-dazWmoqB.js","Page-CnLhKuUV.js","getPastedJson-Chy3Qa1S.js","icon-CyO7h3jh.js","MethodPill-Dle0_91v.js","DuplicateIcon-CVvWAf4a.js","createIcon-Di07A27B.js","DynamicMarkdown-C4w9kavL.js","SectionHeading-XiBebVYC.js","axios-vUo_bRtp.js","Markdown-DTeL0SpS.js","dist-OCScizqf.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","katex-YMM-FMeD.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","AssistantPageLink-KcneGfMY.js"]}