from spine import SpineClientwith SpineClient(api_key="sk_spine_...") as client: ...
Never commit keys to source control. Use your deployment platform’s
secret manager (AWS Secrets Manager, 1Password, Doppler, etc.) and
inject them at runtime.
If no key is provided and SPINE_API_KEY is unset, SpineClient()
raises ValueError immediately — before any network call.
Key rotation
Keys revoked in the dashboard stop working on the next request; you’ll
see AuthenticationError raised from the SDK. Roll new keys through
your secret store before revoking the old one so running processes
don’t break mid-run.
Overriding the base URL
Point the SDK at a staging or enterprise deployment via base_url (or
the SPINE_BASE_URL env var):
The SDK appends /v1 automatically, so pass the host without the API
prefix.
Injecting your own HTTP client
For advanced cases (custom proxies, SSL contexts, test doubles), pass a
pre-configured httpx.Client or httpx.AsyncClient. The SDK still
applies the X-API-KEY and User-Agent headers — your client does not
need to set them.
When you inject a client, the SDK does not close it on __exit__ —
that’s your responsibility.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Spine Documentation","description":"The highest-quality research API. #1 on GAIA Level 3 — verified, auditable multi-agent research delivered as polished artifacts via a single API call. Plus Spine Canvas, a visual multi-agent workspace.","colors":{"primary":"#6e56cf","light":"#9d86ff","dark":"#6e56cf"},"logo":{"light":"https://mintcdn.com/spineai/t8hvI4O_HYGJeQrn/logo/spine-logos/logo-black-full.svg?fit=max\u0026auto=format\u0026n=t8hvI4O_HYGJeQrn\u0026q=85\u0026s=0158b96e864b6d8ee6826a0d8bebfe39","dark":"https://mintcdn.com/spineai/t8hvI4O_HYGJeQrn/logo/spine-logos/logo-white-full.svg?fit=max\u0026auto=format\u0026n=t8hvI4O_HYGJeQrn\u0026q=85\u0026s=98cc979fb7cfb7997d201420a9780857"},"favicon":"https://mintcdn.com/spineai/t8hvI4O_HYGJeQrn/logo/spine-logos/favicon.svg?fit=max\u0026auto=format\u0026n=t8hvI4O_HYGJeQrn\u0026q=85\u0026s=4c6841d66822c1a199bc29a79f8bc551","api":{"playground":{"display":"none"}},"appearance":{"default":"dark"},"background":{"decoration":"gradient","color":{"light":"#FAFAF9","dark":"#0B0B0C"}},"navbar":{"links":[{"href":"mailto:support@getspine.ai","label":"Support"}],"primary":{"type":"button","label":"Developer Portal","href":"https://platform.getspine.ai"}},"footer":{"socials":{"x":"https://x.com/Spine_AI","linkedin":"https://www.linkedin.com/company/spine-ai"}},"fonts":{"heading":{"family":"Inter","weight":600},"body":{"family":"Inter","weight":400}},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"github-light","dark":"tokyo-night"}},"latex":true},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"spineai","hasAudioNarration":false,"actualSubdomain":"spineai","customDomains":["docs.getspine.ai"],"gitSource":{"type":"github","owner":"spine-ai","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae91ea1ab2971a8eb0c525d:success","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"Spine API","count":44},{"language":"default","tag":"Spine App","count":40},{"language":"default","tag":"Blocks","count":21},{"language":"default","tag":"Advanced Features","count":8},{"language":"default","tag":"Python SDK","count":8},{"language":"default","tag":"TypeScript SDK","count":8},{"language":"default","tag":"Concepts","count":7},{"language":"default","tag":"The Canvas","count":7},{"language":"default","tag":"Endpoints","count":5},{"language":"default","tag":"Use with agents","count":5}]},"assistantConfig":{},"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":"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":"site-roles","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":"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":"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":"turbopuffer-dual-write","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":"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":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"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}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"nav[data-sidebar] a,aside a{padding-top:0.35rem;padding-bottom:0.35rem;font-size:0.875rem;letter-spacing:0.005em}header a[role=\"button\"],header a.primary-cta,a[data-primary=\"true\"]{border-radius:9999px!important;padding:0.5rem 1.1rem;font-weight:500}pre,pre code,.code-block,[class*=\"code-block\"]{border-radius:6px;font-family:\"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, monospace;font-size:0.85rem;line-height:1.55}main article,main [class*=\"prose\"]{max-width:72ch}main a{text-underline-offset:3px;text-decoration-thickness:1px}[class*=\"card\"]:hover{transform:translateY(-1px);transition:transform 120ms ease}"}]}
{"page":{"pagePath":"sdks/python/authentication","slug":"/sdks/python/authentication","pageMetadata":{"title":"Authentication","description":"How to pass your API key to the SDK and override the base URL.","href":"/sdks/python/authentication"},"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: \"How to pass your API key to the SDK and override the base URL.\"\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={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The Spine API uses API keys sent as the `,_jsx(_components.code,{children:`X-API-KEY`}),` request header. The\nSDK adds the header for you on every request — you just need to give it\na key.`]}),`\n`,_jsx(Heading,{level:`2`,id:`passing-the-key`,children:`Passing the key`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Environment variable (preferred)`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light tokyo-night`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#1a1b26`,color:`#24292e`,\"--shiki-dark\":`#a9b1d6`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#51597D`,\"--shiki-dark-font-style\":`italic`},children:`# Shell:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#51597D`,\"--shiki-dark-font-style\":`italic`},children:`# export SPINE_API_KEY=sk_spine_...`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` spine `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` SpineClient`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:`with`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:` SpineClient`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`()`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:` as`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` client`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#E0AF68`},children:` ...`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Explicit argument`,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light tokyo-night`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#1a1b26`,color:`#24292e`,\"--shiki-dark\":`#a9b1d6`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` spine `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` SpineClient`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:`with`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:` SpineClient`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`(`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:`api_key`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECE6A`},children:`sk_spine_...`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`)`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:` as`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` client`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#E0AF68`},children:` ...`})}),`\n`]})})})]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Never commit keys to source control. Use your deployment platform’s\nsecret manager (AWS Secrets Manager, 1Password, Doppler, etc.) and\ninject them at runtime.`})}),`\n`,_jsxs(_components.p,{children:[`If no key is provided and `,_jsx(_components.code,{children:`SPINE_API_KEY`}),` is unset, `,_jsx(_components.code,{children:`SpineClient()`}),`\nraises `,_jsx(_components.code,{children:`ValueError`}),` immediately — before any network call.`]}),`\n`,_jsx(Heading,{level:`2`,id:`key-rotation`,children:`Key rotation`}),`\n`,_jsxs(_components.p,{children:[`Keys revoked in the dashboard stop working on the next request; you’ll\nsee `,_jsx(_components.code,{children:`AuthenticationError`}),` raised from the SDK. Roll new keys through\nyour secret store before revoking the old one so running processes\ndon’t break mid-run.`]}),`\n`,_jsx(Heading,{level:`2`,id:`overriding-the-base-url`,children:`Overriding the base URL`}),`\n`,_jsxs(_components.p,{children:[`Point the SDK at a staging or enterprise deployment via `,_jsx(_components.code,{children:`base_url`}),` (or\nthe `,_jsx(_components.code,{children:`SPINE_BASE_URL`}),` env var):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light tokyo-night`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#1a1b26`,color:`#24292e`,\"--shiki-dark\":`#a9b1d6`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:`client `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:` SpineClient`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`(`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:`base_url`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECE6A`},children:`https://staging.getspine.ai`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The SDK appends `,_jsx(_components.code,{children:`/v1`}),` automatically, so pass the host without the API\nprefix.`]}),`\n`,_jsx(Heading,{level:`2`,id:`injecting-your-own-http-client`,children:`Injecting your own HTTP client`}),`\n`,_jsxs(_components.p,{children:[`For advanced cases (custom proxies, SSL contexts, test doubles), pass a\npre-configured `,_jsx(_components.code,{children:`httpx.Client`}),` or `,_jsx(_components.code,{children:`httpx.AsyncClient`}),`. The SDK still\napplies the `,_jsx(_components.code,{children:`X-API-KEY`}),` and `,_jsx(_components.code,{children:`User-Agent`}),` headers — your client does not\nneed to set them.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light tokyo-night`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#1a1b26`,color:`#24292e`,\"--shiki-dark\":`#a9b1d6`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` httpx`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` spine `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#7DCFFF`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` SpineClient`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:`transport `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` httpx`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:`HTTPTransport`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`(`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:`proxy`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECE6A`},children:`http://corp-proxy:8080`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:`http_client `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` httpx`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:`Client`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`(`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:`transport`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#C0CAF5`},children:`transport`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`,`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:` base_url`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECE6A`},children:`https://api.getspine.ai/v1`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#89DDFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:`with`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#7AA2F7`},children:` SpineClient`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`(`}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#E0AF68`},children:`http_client`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#89DDFF`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#C0CAF5`},children:`http_client`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#9ABDF5`},children:`)`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#BB9AF7`},children:` as`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#A9B1D6`},children:` client`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#89DDFF`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#E0AF68`},children:` ...`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`When you inject a client, the SDK does `,_jsx(_components.strong,{children:`not`}),` close it on `,_jsx(_components.code,{children:`__exit__`}),` —\nthat’s your responsibility.`]})]})}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":{"codeStyling":{"theme":{"light":"github-light","dark":"tokyo-night"}},"config":{},"pageMetadata":{"title":"Authentication","description":"How to pass your API key to the SDK and override the base URL.","href":"/sdks/python/authentication"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Passing the key","slug":"passing-the-key","depth":2,"children":[]},{"title":"Key rotation","slug":"key-rotation","depth":2,"children":[]},{"title":"Overriding the base URL","slug":"overriding-the-base-url","depth":2,"children":[]},{"title":"Injecting your own HTTP client","slug":"injecting-your-own-http-client","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/spineai/4315a4734dcfd3ba/scripts/per-tab-cta.js"],"subdomain":"spineai","siteName":"Spine Documentation","title":"Authentication - Spine Documentation","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-17T03:38:06.402Z","originalFileLocation":"sdks/python/authentication.mdx"},"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=\"dark\"}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=\"How to pass your API key to the SDK and override the base URL.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Spine Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_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/spineai/sFPsSa1SIGxYmv5T/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Authentication - Spine Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"How to pass your API key to the SDK and override the base URL.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Spine Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.getspine.ai/sdks/python/authentication\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://spineai.mintlify.site/_mintlify/api/og/v2?division=Python+SDK\u0026amp;title=Authentication\u0026amp;description=How+to+pass+your+API+key+to+the+SDK+and+override+the+base+URL.\u0026amp;theme=7c94212fecbb318c6aea9fa1\u0026amp;signature=232f758431d0e63d329881bc164625c4f8a1f1cd7a59ceb09e6c0b62c263634a\">\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=\"Authentication - Spine Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How to pass your API key to the SDK and override the base URL.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://spineai.mintlify.site/_mintlify/api/og/v2?division=Python+SDK\u0026amp;title=Authentication\u0026amp;description=How+to+pass+your+API+key+to+the+SDK+and+override+the+base+URL.\u0026amp;theme=7c94212fecbb318c6aea9fa1\u0026amp;signature=232f758431d0e63d329881bc164625c4f8a1f1cd7a59ceb09e6c0b62c263634a\">\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/spineai/sFPsSa1SIGxYmv5T/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Spine Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#6e56cf\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.getspine.ai/sdks/python/authentication\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdks/python/authentication.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.getspine.ai/#organization\",\"name\":\"Spine Documentation\",\"url\":\"https://docs.getspine.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/spineai/t8hvI4O_HYGJeQrn/logo/spine-logos/logo-black-full.svg?fit=max\u0026auto=format\u0026n=t8hvI4O_HYGJeQrn\u0026q=85\u0026s=0158b96e864b6d8ee6826a0d8bebfe39\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.getspine.ai#website\",\"name\":\"Spine Documentation\",\"url\":\"https://docs.getspine.ai\",\"publisher\":{\"@id\":\"https://docs.getspine.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.getspine.ai/sdks/python/authentication#webpage\",\"url\":\"https://docs.getspine.ai/sdks/python/authentication\",\"name\":\"Authentication\",\"description\":\"How to pass your API key to the SDK and override the base URL.\",\"dateModified\":\"2026-04-17T03:38:06.402Z\",\"isPartOf\":{\"@id\":\"https://docs.getspine.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.getspine.ai/sdks/python/authentication#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.getspine.ai/sdks/python/authentication#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Python SDK\",\"item\":\"https://docs.getspine.ai/sdks/python/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Authentication\",\"item\":\"https://docs.getspine.ai/sdks/python/authentication\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.getspine.ai/sdks/python/authentication#article\",\"headline\":\"Authentication\",\"name\":\"Authentication\",\"description\":\"How to pass your API key to the SDK and override the base URL.\",\"url\":\"https://docs.getspine.ai/sdks/python/authentication\",\"mainEntityOfPage\":{\"@id\":\"https://docs.getspine.ai/sdks/python/authentication#webpage\"},\"dateModified\":\"2026-04-17T03:38:06.402Z\",\"publisher\":{\"@id\":\"https://docs.getspine.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.getspine.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Spine Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Spine Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdks/python/authentication.md","siteName":"Spine Documentation","nav":{"global":null,"tabs":[{"tab":"Spine API","groups":[{"group":"Get Started","pages":[{"title":"Spine API","sidebarTitle":"Overview","href":"/api-reference/overview"},{"title":"Quickstart","href":"/api-reference/quickstart"},{"title":"Authentication","href":"/api-reference/authentication"}]},{"group":"Concepts","pages":[{"title":"Canvases and runs","href":"/api-reference/concepts/canvases-and-runs"},{"title":"Templates","href":"/api-reference/concepts/templates"},{"title":"Block types","href":"/api-reference/concepts/block-types"},{"title":"Agent instructions","href":"/api-reference/concepts/agent-instructions"},{"title":"File uploads","href":"/api-reference/concepts/file-uploads"},{"title":"Webhooks","href":"/api-reference/concepts/webhooks"},{"title":"Polling and status","sidebarTitle":"Polling and status (alternative)","href":"/api-reference/concepts/polling-and-status"}]},{"group":"Use with agents","pages":[{"title":"Claude Code","href":"/api-reference/integrations/claude-code"},{"title":"OpenClaw","href":"/api-reference/integrations/openclaw"},{"title":"Codex CLI","href":"/api-reference/integrations/codex-cli"},{"title":"Cursor","href":"/api-reference/integrations/cursor"},{"title":"Bolt, Replit, Lovable","href":"/api-reference/integrations/web-builders"}]},{"group":"Endpoints","pages":[{"title":"Create a run","openapi":"POST /v1/run","href":"/api-reference/endpoints/create-run"},{"title":"Get a run","openapi":"GET /v1/run/{run_id}","href":"/api-reference/endpoints/get-run"},{"title":"Get canvas DAG","openapi":"GET /v1/canvas/{canvas_id}/dag","href":"/api-reference/endpoints/get-canvas-dag"},{"title":"Get task tree","openapi":"GET /v1/canvas/{canvas_id}/tasks","href":"/api-reference/endpoints/get-canvas-tasks"},{"title":"Get a single task","openapi":"GET /v1/canvas/{canvas_id}/tasks/{task_id}","href":"/api-reference/endpoints/get-task"}]},{"group":"Resources","pages":[{"title":"Errors","href":"/api-reference/errors"},{"title":"For agents","href":"/api-reference/for-agents"},{"title":"SDKs","href":"/api-reference/sdks"}]},{"group":"Python SDK","pages":[{"title":"Python SDK","href":"/sdks/python/overview"},{"title":"Quickstart","description":"Install the SDK and run your first end-to-end request.","href":"/sdks/python/quickstart"},{"title":"Authentication","href":"/sdks/python/authentication"},{"title":"Runs and polling","description":"Create runs, wait for them, and stream progress with the Python SDK.","href":"/sdks/python/runs"},{"title":"Canvas introspection","href":"/sdks/python/canvas"},{"title":"Webhooks","href":"/sdks/python/webhooks"},{"title":"Errors and retries","href":"/sdks/python/errors"},{"title":"API reference","href":"/sdks/python/reference"}]},{"group":"TypeScript SDK","pages":[{"title":"TypeScript SDK","href":"/sdks/typescript/overview"},{"title":"Quickstart","href":"/sdks/typescript/quickstart"},{"title":"Authentication","href":"/sdks/typescript/authentication"},{"title":"Runs and polling","href":"/sdks/typescript/runs"},{"title":"Canvas introspection","href":"/sdks/typescript/canvas"},{"title":"Webhooks","href":"/sdks/typescript/webhooks"},{"title":"Errors and retries","href":"/sdks/typescript/errors"},{"title":"API reference","href":"/sdks/typescript/reference"}]},{"group":"Runs","pages":[{"title":"Create a canvas run","deprecated":null,"version":null,"openapi":"/openapi.yaml post /v1/run","href":"/api-reference/runs/create-a-canvas-run"},{"title":"Get run status and results","deprecated":null,"version":null,"openapi":"/openapi.yaml get /v1/run/{run_id}","href":"/api-reference/runs/get-run-status-and-results"}]},{"group":"Canvas","pages":[{"title":"Get canvas DAG","deprecated":null,"version":null,"openapi":"/openapi.yaml get /v1/canvas/{canvas_id}/dag","href":"/api-reference/canvas/get-canvas-dag"},{"title":"Get task tree","deprecated":null,"version":null,"openapi":"/openapi.yaml get /v1/canvas/{canvas_id}/tasks","href":"/api-reference/canvas/get-task-tree"},{"title":"Get a single task","deprecated":null,"version":null,"openapi":"/openapi.yaml get /v1/canvas/{canvas_id}/tasks/{task_id}","href":"/api-reference/canvas/get-a-single-task"}]}]},{"tab":"Spine App","pages":[{"title":"Spine App","href":"/app/what-is-spine"}]}]},"basePath":"","title":"Authentication - Spine Documentation","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}