The CLI authentication flow creates a session, opens a browser for the user to sign in, and polls until the session completes. grantiva auth login does all of this for you — this page documents the endpoints behind it.Sessions are valid for 90 days from creation, but a session only stays useful until it is completed and polled once: the key is handed over exactly once and then cleared from the session record.
status is pending, active, or expired. A pending session past its expiry flips to expired on the next poll.When the browser login completes, the next poll returns the key:
The api_key is returned once. The server clears it from the session as soon as it is read — a second poll returns "api_key": null with status: "active". Store it on first read.
The issued key is a personal access token (gpat_ prefix) scoped to the user’s default organization, with full API access. It is named CLI session (<email>) and appears in the organization’s API key list. Revoke it there to sign the CLI out permanently.Errors
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Grantiva","colors":{"primary":"#0D9373","light":"#14B8A6","dark":"#0F766E"},"logo":{"light":"https://mintcdn.com/grantiva/28yUEStsNJ7W6bTh/logo/light.svg?fit=max\u0026auto=format\u0026n=28yUEStsNJ7W6bTh\u0026q=85\u0026s=eae01fca557fac8bace0e6013fba687e","dark":"https://mintcdn.com/grantiva/28yUEStsNJ7W6bTh/logo/dark.svg?fit=max\u0026auto=format\u0026n=28yUEStsNJ7W6bTh\u0026q=85\u0026s=eff9cf4b2d0249e169d9097ff2cd8ce2"},"favicon":"https://mintcdn.com/grantiva/5pA1C2NemWT_0-V1/favicon.ico?fit=max\u0026auto=format\u0026n=5pA1C2NemWT_0-V1\u0026q=85\u0026s=6179ff3876d340dbbbc59f55625081e6","navbar":{"links":[{"href":"mailto:support@grantiva.io","label":"Support"}],"primary":{"type":"button","label":"Get Started","href":"https://grantiva.io/get-started"}},"footer":{"socials":{"github":"https://github.com/grantiva"}},"contextual":{"options":["copy","view","claude","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/grantiva"},{"anchor":"Dashboard","icon":"chart-line","href":"https://grantiva.io/dashboard"},{"anchor":"Status","icon":"signal","href":"https://grantiva-services.instatus.com"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"grantiva","hasAudioNarration":false,"actualSubdomain":"grantiva","customDomains":["docs.grantiva.io"],"gitSource":{"type":"github","owner":"grantiva","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aa172c396b31dab3ab9d3ea","collectionId":"7b2bedaf-285e-4a6a-b269-61d6da31b886","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aa172c396b31dab3ab9d3ea"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{},"buildId":"6aa172c396b31dab3ab9d3ea","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Documentation","count":47},{"language":"default","tag":"API Reference","count":46},{"language":"default","tag":"CLI","count":13},{"language":"default","tag":"SDKs","count":9},{"language":"default","tag":"Concepts","count":8},{"language":"default","tag":"Dashboard","count":8},{"language":"default","tag":"Getting Started","count":8},{"language":"default","tag":"Console","count":7},{"language":"default","tag":"Feature Flags","count":6},{"language":"default","tag":"Organization","count":6}]},"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":"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":"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":"llms-txt-v2","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":"byok-sep-25","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":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","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":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/auth/cli-sessions","slug":"/api-reference/auth/cli-sessions","pageMetadata":{"title":"CLI Sessions","description":"Authenticate the Grantiva CLI via browser login","href":"/api-reference/auth/cli-sessions"},"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: \"Authenticate the Grantiva CLI via browser login\"\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`,hr:`hr`,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,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The CLI authentication flow creates a session, opens a browser for the user to sign in, and polls until the session completes. `,_jsx(_components.code,{children:`grantiva auth login`}),` does all of this for you — this page documents the endpoints behind it.`]}),`\n`,_jsx(_components.p,{children:`Sessions are valid for 90 days from creation, but a session only stays useful until it is completed and polled once: the key is handed over exactly once and then cleared from the session record.`}),`\n`,_jsx(Heading,{level:`2`,id:`create-a-session`,children:`Create a session`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`POST /api/v1/auth/cli/sessions`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`No authentication. Returns the session id to embed in the browser login URL.`}),`\n`,_jsx(Heading,{level:`3`,id:`response`,children:`Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,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:`3`,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:` \"session_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"3f8c1a90-1b2c-4d5e-8f90-112233445566\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Open `,_jsx(_components.code,{children:`https://api.grantiva.io/api/v1/auth/cli?session=\u003csession_id>`}),` in the user’s browser. They sign in there with a password or a passkey.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`poll-session-status`,children:`Poll session status`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`GET /api/v1/auth/cli/sessions/:sessionId`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`No authentication — knowing the session id is the credential, so treat it as a secret.`}),`\n`,_jsx(Heading,{level:`3`,id:`response-2`,children:`Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,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:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"pending\"`}),_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:` \"api_key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_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:` \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`status`}),` is `,_jsx(_components.code,{children:`pending`}),`, `,_jsx(_components.code,{children:`active`}),`, or `,_jsx(_components.code,{children:`expired`}),`. A pending session past its expiry flips to `,_jsx(_components.code,{children:`expired`}),` on the next poll.`]}),`\n`,_jsx(_components.p,{children:`When the browser login completes, the next poll returns the key:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,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:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"active\"`}),_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:` \"api_key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpat_abc123...\"`}),_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:` \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"you@example.com\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(Warning,{children:[`The `,_jsx(_components.code,{children:`api_key`}),` is returned `,_jsx(_components.strong,{children:`once`}),`. The server clears it from the session as soon as it is read — a second poll returns `,_jsx(_components.code,{children:`\"api_key\": null`}),` with `,_jsx(_components.code,{children:`status: \"active\"`}),`. Store it on first read.`]}),`\n`,_jsxs(_components.p,{children:[`The issued key is a personal access token (`,_jsx(_components.code,{children:`gpat_`}),` prefix) scoped to the user’s default organization, with full API access. It is named `,_jsx(_components.code,{children:`CLI session (\u003cemail>)`}),` and appears in the organization’s `,_jsx(_components.a,{href:`/api-reference/org/api-keys`,children:`API key list`}),`. Revoke it there to sign the CLI out permanently.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Errors`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:`Meaning`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`400`}),_jsx(_components.td,{children:`The session id is not a UUID`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`404`}),_jsx(_components.td,{children:`Session not found`})]})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`validate-a-key`,children:`Validate a key`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`GET /api/v1/auth/me`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`headers`,children:`Headers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Header`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`Authorization`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Bearer \u003capi_key>`})})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`response-3`,children:`Response`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,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:`4`,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:` \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"you@example.com\"`}),_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:` \"api_key_prefix\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpat_abc\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`api_key_prefix`}),` is the first 8 characters of the key. `,_jsx(_components.code,{children:`401`}),` when the key is unknown, revoked, or expired.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`see-also`,children:`See also`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/auth/account`,children:`Account \u0026 Sessions`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/org/api-keys`,children:`API Keys`})}),`\n`]})]})}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":"CLI Sessions","description":"Authenticate the Grantiva CLI via browser login","href":"/api-reference/auth/cli-sessions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Create a session","slug":"create-a-session","depth":2,"children":[{"title":"Response","slug":"response","depth":3,"children":[]}]},{"title":"Poll session status","slug":"poll-session-status","depth":2,"children":[{"title":"Response","slug":"response-2","depth":3,"children":[]}]},{"title":"Validate a key","slug":"validate-a-key","depth":2,"children":[{"title":"Headers","slug":"headers","depth":3,"children":[]},{"title":"Response","slug":"response-3","depth":3,"children":[]}]},{"title":"See also","slug":"see-also","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"grantiva","siteName":"Grantiva","title":"CLI Sessions - Grantiva","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-02T17:06:42.784Z","originalFileLocation":"api-reference/auth/cli-sessions.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=\"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=\"Authenticate the Grantiva CLI via browser login\">\u003cmeta data-mint-head name=\"application-name\" content=\"Grantiva\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_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/grantiva/mV1kXh7vilTKFaGS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"CLI Sessions - Grantiva\">\u003cmeta data-mint-head property=\"og:description\" content=\"Authenticate the Grantiva CLI via browser login\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Grantiva\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.grantiva.io/api-reference/auth/cli-sessions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://grantiva.mintlify.app/_mintlify/api/og/v2?division=Auth\u0026amp;title=CLI+Sessions\u0026amp;description=Authenticate+the+Grantiva+CLI+via+browser+login\u0026amp;theme=ba1821250ed20c14294f1caa\u0026amp;signature=f248ebfc6d04ea1a820a02bfd0e3ac3846ade6713e7d702e5e7331cd252f21af\">\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=\"CLI Sessions - Grantiva\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Authenticate the Grantiva CLI via browser login\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://grantiva.mintlify.app/_mintlify/api/og/v2?division=Auth\u0026amp;title=CLI+Sessions\u0026amp;description=Authenticate+the+Grantiva+CLI+via+browser+login\u0026amp;theme=ba1821250ed20c14294f1caa\u0026amp;signature=f248ebfc6d04ea1a820a02bfd0e3ac3846ade6713e7d702e5e7331cd252f21af\">\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/grantiva/mV1kXh7vilTKFaGS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Grantiva\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.grantiva.io/api-reference/auth/cli-sessions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/auth/cli-sessions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.grantiva.io/#organization\",\"name\":\"Grantiva\",\"url\":\"https://docs.grantiva.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/grantiva/28yUEStsNJ7W6bTh/logo/light.svg?fit=max\u0026auto=format\u0026n=28yUEStsNJ7W6bTh\u0026q=85\u0026s=eae01fca557fac8bace0e6013fba687e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.grantiva.io#website\",\"name\":\"Grantiva\",\"url\":\"https://docs.grantiva.io\",\"publisher\":{\"@id\":\"https://docs.grantiva.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions#webpage\",\"url\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions\",\"name\":\"CLI Sessions\",\"description\":\"Authenticate the Grantiva CLI via browser login\",\"dateModified\":\"2026-09-02T17:06:42.784Z\",\"isPartOf\":{\"@id\":\"https://docs.grantiva.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Grantiva\",\"item\":\"https://docs.grantiva.io\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CLI Sessions\",\"item\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions#article\",\"headline\":\"CLI Sessions\",\"name\":\"CLI Sessions\",\"description\":\"Authenticate the Grantiva CLI via browser login\",\"url\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.grantiva.io/api-reference/auth/cli-sessions#webpage\"},\"dateModified\":\"2026-09-02T17:06:42.784Z\",\"publisher\":{\"@id\":\"https://docs.grantiva.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.grantiva.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Grantiva\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Grantiva","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/grantiva"},{"anchor":"Dashboard","icon":"chart-line","href":"https://grantiva.io/dashboard"},{"anchor":"Status","icon":"signal","href":"https://grantiva-services.instatus.com"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"API Reference","groups":[{"group":"Overview","pages":[{"title":"API Reference","href":"/api-reference/introduction"},{"title":"Authentication","href":"/api-reference/authentication"},{"title":"API Conventions","href":"/api-reference/conventions"},{"title":"Backend JWT Verification","href":"/backend-verification"}]},{"group":"Attestation","pages":[{"title":"Get Challenge","href":"/api-reference/attestation/challenge"},{"title":"Validate Attestation","href":"/api-reference/attestation/validate"},{"title":"Refresh Token","href":"/api-reference/attestation/refresh"},{"title":"JWKS","href":"/api-reference/attestation/jwks"},{"title":"Heartbeat","href":"/api-reference/heartbeat"}]},{"group":"Platform","pages":[{"title":"Health","href":"/api-reference/health"},{"title":"Usage","href":"/api-reference/usage"},{"title":"Apps","href":"/api-reference/apps"}]},{"group":"Feedback","pages":[{"title":"Feature Requests","href":"/api-reference/feedback/feature-requests"},{"title":"Voting","href":"/api-reference/feedback/voting"},{"title":"Comments","href":"/api-reference/feedback/comments"},{"title":"Support Tickets","href":"/api-reference/feedback/support-tickets"},{"title":"Feedback Console API","href":"/api-reference/feedback/console"}]},{"group":"Feature Flags","pages":[{"title":"Get Flags","href":"/api-reference/flags/get-flags"},{"title":"Stream Flags (SSE)","href":"/api-reference/flags/stream"},{"title":"Test an Evaluation","href":"/api-reference/flags/evaluate"},{"title":"Flag Targeting Rules","href":"/api-reference/flags/rules"},{"title":"Flag Overrides","href":"/api-reference/flags/overrides"},{"title":"Manage Flags","href":"/api-reference/flags/manage"}]},{"group":"Custom Claims","pages":[{"title":"Custom Claims","href":"/api-reference/claims"}]},{"group":"Analytics","pages":[{"title":"Reports","href":"/api-reference/analytics/dashboard"},{"title":"Events","href":"/api-reference/analytics/events"},{"title":"Devices","href":"/api-reference/analytics/devices"},{"title":"Compliance \u0026 Risk","href":"/api-reference/analytics/compliance"},{"title":"Export","href":"/api-reference/analytics/export"}]},{"group":"Webhooks","pages":[{"title":"Webhook Endpoints","href":"/api-reference/webhooks/endpoints"},{"title":"Webhook Events","href":"/api-reference/webhooks/events"}]},{"group":"Organization","pages":[{"title":"API Keys","href":"/api-reference/org/api-keys"},{"title":"Team \u0026 Invites","href":"/api-reference/org/team"},{"title":"Organization Settings","href":"/api-reference/org/settings"},{"title":"Release Notes","href":"/api-reference/org/release-notes"},{"title":"Risk Alert Rules","href":"/api-reference/org/risk-alerts"},{"title":"Attestation Failure Alerts","href":"/api-reference/org/alerts"}]},{"group":"Push","pages":[{"title":"Push Subscriptions","href":"/api-reference/push/subscriptions"},{"title":"Publish","href":"/api-reference/push/publish"}]},{"group":"Entitlements","pages":[{"title":"Entitlement Configuration","href":"/api-reference/entitlements/config"},{"title":"Apple Server Notifications","href":"/api-reference/entitlements/apple-notifications"},{"title":"Stripe Entitlement Webhook","href":"/api-reference/entitlements/stripe-webhook"}]},{"group":"Visual Regression Testing","pages":[{"title":"VRT Runs","href":"/api-reference/vrt/runs"},{"title":"VRT Baselines","description":"Manage baseline images and the GitHub app link for visual regression testing","href":"/api-reference/vrt/baselines"}]},{"group":"Auth","pages":[{"title":"CLI Sessions","href":"/api-reference/auth/cli-sessions"},{"title":"Account \u0026 Sessions","description":"Dashboard authentication: login, sessions, password reset, email changes, invites, and org switching","href":"/api-reference/auth/account"}]}]}]},"basePath":"","title":"CLI Sessions - Grantiva","buildId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","deploymentId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","dynamics":[],"chunks":[]}