Create an API key to access Prefect Cloud from a local execution environment.
API keys enable you to authenticate a local environment to work with Prefect Cloud.If you run prefect cloud login from your CLI, you can authenticate through your browser or by pasting an API key.Authenticating through the browser directs you to an authorization page.
After you grant approval to connect, you’re redirected to the CLI and the API key is saved to your local
Prefect profile.If you choose to authenticate by pasting an API key, you must create an API key in the Prefect Cloud UI first.
In an interactive terminal you can run prefect cloud login and paste the key when prompted.In non-interactive environments (CI, containers, startup scripts), supply both --key and --workspace:
Omitting either flag in a non-interactive terminal causes the command to fail.Alternatively, if you don’t have a CLI available — for example, if you are connecting to Prefect Cloud within a remote serverless environment — set the PREFECT_API_KEY environment variable.For more information see Connect to Prefect Cloud.
Service accounts are a feature of Prefect Cloud Pro and Enterprise tier plans that enable you to
create a Prefect Cloud API key that is not associated with a user account.Service accounts are useful for configuring API access for running workers, or executing flow runs on remote infrastructure.
Events and logs for flow runs in those environments are associated with the service account rather than a user. Manage or revoke API access by
configuring or removing the service account without disrupting user access.See service accounts for more information.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Prefect","colors":{"primary":"#2D6DF6","light":"#5F92FF","dark":"#2D6DF6"},"logo":{"light":"https://mintcdn.com/prefect-bd373955/2_4m_dDmEdgqK7r9/logos/logo-wordmark-dark.svg?fit=max\u0026auto=format\u0026n=2_4m_dDmEdgqK7r9\u0026q=85\u0026s=076c95a93dbe29192ba9129faefcc878","dark":"https://mintcdn.com/prefect-bd373955/2_4m_dDmEdgqK7r9/logos/logo-wordmark-light.svg?fit=max\u0026auto=format\u0026n=2_4m_dDmEdgqK7r9\u0026q=85\u0026s=46ef25a1069c303ca7d9e24ec801e760","href":"https://www.prefect.io/docs"},"favicon":"https://mintcdn.com/prefect-bd373955/2_4m_dDmEdgqK7r9/logos/favicon.svg?fit=max\u0026auto=format\u0026n=2_4m_dDmEdgqK7r9\u0026q=85\u0026s=c0e62122cb72036e569b2656916a1b33","api":{"playground":{"display":"simple"}},"appearance":{"default":"light","strict":false},"navbar":{"primary":{"type":"github","href":"https://github.com/PrefectHQ/Prefect"}},"footer":{"socials":{"bluesky":"https://bsky.app/profile/prefect.io","github":"https://github.com/PrefectHQ/prefect","linkedin":"https://www.linkedin.com/company/prefect/mycompany","slack":"https://prefect.io/slack","x":"https://x.com/PrefectIO","youtube":"https://www.youtube.com/c/PrefectIO"}},"seo":{"metatags":{"canonical":"https://www.prefect.io/docs"}},"integrations":{"ga4":{"measurementId":"G-8GR5P04T5Y"},"gtm":{"tagId":"GTM-N633BZ8"}},"errors":{"404":{"redirect":false}},"contextual":{"options":["copy","view"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"prefect-bd373955","hasAudioNarration":false,"actualSubdomain":"prefect-bd373955","customDomains":[],"gitSource":{"type":"github","owner":"prefecthq","repo":"prefect","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aebae2be8d23663794098e8","collectionId":"28a32e15-27de-4edf-91c2-0682e8bb6873","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aebae2be8d23663794098e8"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aee42ba68213475f1385309","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"API Reference","count":1172},{"language":"default","tag":"Python SDK Reference","count":364},{"language":"default","tag":"Integrations","count":329},{"language":"default","tag":"REST API","count":183},{"language":"default","tag":"Server API","count":181},{"language":"default","tag":"prefect.server","count":148},{"language":"default","tag":"SDK Reference","count":127},{"language":"default","tag":"How-to Guides","count":71},{"language":"default","tag":"models","count":60},{"language":"default","tag":"api","count":39}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":"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":"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":"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":"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":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"#topbar-cta-button>a>span{background-color:#2d6df6;border-radius:0.25rem}#topbar-cta-button>a{padding:0.5rem 1rem}#topbar-cta-button>a div>span{font-weight:400;letter-spacing:0.4px}#topbar-cta-button>a div>span,#topbar-cta-button>a div>svg{color:#fff}img{filter:none!important}@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700\u0026display=swap\");@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700\u0026display=swap\");body{font-family:\"Inter\", sans-serif}h1,h2,h3,h4,h5,h6{font-family:\"Roboto\", sans-serif}p{font-family:\"Inter\", sans-serif}[role=\"listitem\"] *:last-child:not(.code-block,.link){border-bottom:none!important}.badge{display:table;margin:0 0 1rem;font-family:\"Inter\", sans-serif;font-size:0.6875rem;font-weight:600;line-height:1;letter-spacing:0.02em;text-transform:uppercase;padding:0.35em 0.6em;border-radius:0.375rem;white-space:nowrap}.badge.cloud{color:#fff;background-color:#2d6df6}.badge.cloud::after{content:\"Prefect Cloud\"}"},{"filePath":"assets/code.css","content":".namespace{opacity:0.7}.token.doctype .token.doctype-tag{color:#79c0ff}.token.doctype .token.name{color:#d2a8ff}.token.comment,.token.prolog{color:#8b949e}.token.punctuation,.language-html .language-css .token.punctuation,.language-html .language-javascript .token.punctuation{color:#c9d1d9}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.inserted,.token.unit{color:#79c0ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.deleted{color:#79c0ff}.token.plain-text{color:#fafafa}.language-css .token.string.url{text-decoration:underline}.token.operator,.token.entity{color:#79c0ff}.token.operator.arrow{color:#ff7b72}.token.atrule{color:#79c0ff}.token.atrule .token.rule{color:#d2a8ff}.token.atrule .token.url{color:#79c0ff}.token.atrule .token.url .token.function{color:#79c0ff}.token.atrule .token.url .token.punctuation{color:#d4d4d4}.token.keyword{color:#ff7b72}.token.keyword.module,.token.keyword.control-flow{color:#c586c0}.token.function,.token.function .token.maybe-class-name{color:#d2a8ff}.token.regex{color:#a5d6ff}.token.important{color:#ff7b72}.token.italic{font-style:italic;color:#c9d1d9}.token.constant{color:#79c0ff}.token.class-name,.token.maybe-class-name{color:#d2a8ff}.token.console{color:#9cdcfe}.token.parameter{color:#79c0ff}.token.interpolation{color:#79c0ff}.token.punctuation.interpolation-punctuation{color:#569cd6}.token.boolean{color:#ff7b72}.token.property,.token.variable,.token.imports .token.maybe-class-name,.token.exports .token.maybe-class-name{color:#79c0ff}.token.selector{color:#7ee787}.token.escape{color:#7ee787}.token.tag{color:#7ee787}.token.tag .token.punctuation{color:#808080}.token.cdata{color:#808080}.token.attr-name{color:#79c0ff}.token.attr-value,.token.attr-value .token.punctuation{color:#a5d6ff}.token.attr-value .token.punctuation.attr-equals{color:#d4d4d4}.token.entity{color:#79c0ff}.token.namespace{color:#7ee787}.token.operator{color:#94a3b8}pre[class*=\"language-javascript\"],code[class*=\"language-javascript\"],pre[class*=\"language-jsx\"],code[class*=\"language-jsx\"],pre[class*=\"language-typescript\"],code[class*=\"language-typescript\"],pre[class*=\"language-tsx\"],code[class*=\"language-tsx\"]{color:#79c0ff}pre[class*=\"language-css\"],code[class*=\"language-css\"]{color:#a5d6ff}pre[class*=\"language-html\"],code[class*=\"language-html\"]{color:#c9d1d9}.language-regex .token.anchor{color:#dcdcaa}.language-html .token.punctuation{color:#808080}span.language-json .token.punctuation{color:#4b5563}:is(.dark span.language-json .token.punctuation){color:#d1d5db}span.language-json .token.property{color:#0284c7}:is(.dark span.language-json .token.property){color:9cdcfe}span.language-json .token.string{color:#d97706}:is(.dark span.language-json .token.string){color:#ce9178}span.language-json .token.number{color:#16a34a}:is(.dark span.language-json .token.number){color:#b5cea8}.line-highlight.line-highlight{background:#f7ebc6;box-shadow:inset 5px 0 0 #f7d87c;z-index:0}"}],"page":{"pagePath":"v3/how-to-guides/cloud/manage-users/api-keys","slug":"/v3/how-to-guides/cloud/manage-users/api-keys","pageMetadata":{"title":"How to manage API keys","sidebarTitle":"Manage API keys","description":"Create an API key to access Prefect Cloud from a local execution environment.","keywords":["API key","authentication","token","Prefect Cloud","access"],"href":"/v3/how-to-guides/cloud/manage-users/api-keys"},"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: \"Create an API key to access Prefect Cloud from a local execution environment.\"\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`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`API keys enable you to authenticate a local environment to work with Prefect Cloud.`}),`\n`,_jsxs(_components.p,{children:[`If you run `,_jsx(_components.code,{children:`prefect cloud login`}),` from your CLI, you can authenticate through your browser or by pasting an API key.`]}),`\n`,_jsxs(_components.p,{children:[`Authenticating through the browser directs you to an authorization page.\nAfter you grant approval to connect, you’re redirected to the CLI and the API key is saved to your local\n`,_jsx(_components.a,{href:`/v3/develop/settings-and-profiles/`,children:`Prefect profile`}),`.`]}),`\n`,_jsx(_components.p,{children:`If you choose to authenticate by pasting an API key, you must create an API key in the Prefect Cloud UI first.`}),`\n`,_jsx(Heading,{level:`2`,id:`create-an-api-key`,children:`Create an API key`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Select the account icon at the bottom-left corner of the UI.`}),`\n`,_jsxs(_components.li,{children:[`Select `,_jsx(_components.strong,{children:`API Keys`}),`.\nThe page displays a list of previously generated keys, and allows you to create or delete API keys.`]}),`\n`,_jsxs(_components.li,{children:[`Select the `,_jsx(_components.strong,{children:`+`}),` button to create a new API key.\nProvide a name for the key and an expiration date.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Copy the key to a secure location since an API key cannot be revealed again in the UI after it is generated.`})}),`\n`,_jsx(Heading,{level:`2`,id:`log-in-to-prefect-cloud-with-an-api-key`,children:`Log in to Prefect Cloud with an API key`}),`\n`,_jsxs(_components.p,{children:[`In an interactive terminal you can run `,_jsx(_components.code,{children:`prefect cloud login`}),` and paste the key when prompted.`]}),`\n`,_jsxs(_components.p,{children:[`In non-interactive environments (CI, containers, startup scripts), supply both `,_jsx(_components.code,{children:`--key`}),` and `,_jsx(_components.code,{children:`--workspace`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,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:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`prefect`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cloud`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --key`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '\u003cmy-api-key>'`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --workspace`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '\u003caccount-handle>/\u003cworkspace-handle>'`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Omitting either flag in a non-interactive terminal causes the command to fail.`}),`\n`,_jsxs(_components.p,{children:[`Alternatively, if you don’t have a CLI available — for example, if you are connecting to Prefect Cloud within a remote serverless environment — set the `,_jsx(_components.code,{children:`PREFECT_API_KEY`}),` environment variable.`]}),`\n`,_jsxs(_components.p,{children:[`For more information see `,_jsx(_components.a,{href:`/v3/manage/cloud/connect-to-cloud`,children:`Connect to Prefect Cloud`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`service-account-api-keys-pro-enterprise`,children:`Service account API keys (Pro) (Enterprise)`}),`\n`,_jsxs(_components.p,{children:[`Service accounts are a feature of Prefect Cloud `,_jsx(_components.a,{href:`https://www.prefect.io/pricing`,children:`Pro and Enterprise tier plans`}),` that enable you to\ncreate a Prefect Cloud API key that is not associated with a user account.`]}),`\n`,_jsx(_components.p,{children:`Service accounts are useful for configuring API access for running workers, or executing flow runs on remote infrastructure.\nEvents and logs for flow runs in those environments are associated with the service account rather than a user. Manage or revoke API access by\nconfiguring or removing the service account without disrupting user access.`}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/v3/how-to-guides/cloud/manage-users/service-accounts`,children:`service accounts`}),` for more information.`]})]})}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":"How to manage API keys","sidebarTitle":"Manage API keys","description":"Create an API key to access Prefect Cloud from a local execution environment.","keywords":["API key","authentication","token","Prefect Cloud","access"],"href":"/v3/how-to-guides/cloud/manage-users/api-keys"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Create an API key","slug":"create-an-api-key","depth":2,"children":[]},{"title":"Log in to Prefect Cloud with an API key","slug":"log-in-to-prefect-cloud-with-an-api-key","depth":2,"children":[]},{"title":"Service account API keys (Pro) (Enterprise)","slug":"service-account-api-keys-pro-enterprise","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/prefect-bd373955/4f3e55fa53d4a575/script.js","/docs/_mintlify/custom/prefect-bd373955/87a13774513287dd/osano.js","/docs/_mintlify/custom/prefect-bd373955/e7b7298d9b02df32/outbound-referrer.js"],"subdomain":"prefect-bd373955","siteName":"Prefect","title":"How to manage API keys - Prefect","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-26T17:17:09.532Z","originalFileLocation":"v3/how-to-guides/cloud/manage-users/api-keys.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=\"light\"}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=\"Create an API key to access Prefect Cloud from a local execution environment.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Prefect\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_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=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"How to manage API keys - Prefect\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create an API key to access Prefect Cloud from a local execution environment.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Prefect\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://prefect-bd373955.mintlify.site/docs/_mintlify/api/og/v2?division=Manage+accounts\u0026amp;title=How+to+manage+API+keys\u0026amp;description=Create+an+API+key+to+access+Prefect+Cloud+from+a+local+execution+environment.\u0026amp;theme=ce2957f9cdece17b41396978\u0026amp;signature=95d22ad797fb23eb1ff89c74e55f807fd5853e494b32ff95325b9ca87451be31\">\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=\"How to manage API keys - Prefect\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create an API key to access Prefect Cloud from a local execution environment.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://prefect-bd373955.mintlify.site/docs/_mintlify/api/og/v2?division=Manage+accounts\u0026amp;title=How+to+manage+API+keys\u0026amp;description=Create+an+API+key+to+access+Prefect+Cloud+from+a+local+execution+environment.\u0026amp;theme=ce2957f9cdece17b41396978\u0026amp;signature=95d22ad797fb23eb1ff89c74e55f807fd5853e494b32ff95325b9ca87451be31\">\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=\"/docs/mintlify-assets/_mintlify/favicons/prefect-bd373955/QsizguCJ7nwtgDte/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Prefect\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2D6DF6\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/v3/how-to-guides/cloud/manage-users/api-keys.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.prefect.io/#organization\",\"name\":\"Prefect\",\"url\":\"https://www.prefect.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/prefect-bd373955/2_4m_dDmEdgqK7r9/logos/logo-wordmark-dark.svg?fit=max\u0026auto=format\u0026n=2_4m_dDmEdgqK7r9\u0026q=85\u0026s=076c95a93dbe29192ba9129faefcc878\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.prefect.io/docs#website\",\"name\":\"Prefect\",\"url\":\"https://www.prefect.io/docs\",\"publisher\":{\"@id\":\"https://www.prefect.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys#webpage\",\"url\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys\",\"name\":\"How to manage API keys\",\"description\":\"Create an API key to access Prefect Cloud from a local execution environment.\",\"dateModified\":\"2026-05-26T17:17:09.532Z\",\"isPartOf\":{\"@id\":\"https://www.prefect.io/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Prefect Cloud\",\"item\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/connect-to-cloud\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Manage accounts\",\"item\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/index\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to manage API keys\",\"item\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys#article\",\"headline\":\"How to manage API keys\",\"name\":\"How to manage API keys\",\"description\":\"Create an API key to access Prefect Cloud from a local execution environment.\",\"url\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys\",\"mainEntityOfPage\":{\"@id\":\"https://www.prefect.io/docs/v3/how-to-guides/cloud/manage-users/api-keys#webpage\"},\"dateModified\":\"2026-05-26T17:17:09.532Z\",\"keywords\":\"API key, authentication, token, Prefect Cloud, access\",\"publisher\":{\"@id\":\"https://www.prefect.io/#organization\"},\"isPartOf\":{\"@id\":\"https://www.prefect.io/docs#website\"}}]}\u003c/script>","siteName":"Prefect","nav":{"global":null,"tabs":[{"tab":"Getting Started","pages":[{"title":"Getting Started","href":"/v3/get-started"}]},{"tab":"Concepts","pages":[{"title":"Concepts","href":"/v3/concepts"}]},{"tab":"How-to Guides","pages":[{"title":"How-to Guides","sidebarTitle":"Overview","icon":"bars","href":"/v3/how-to-guides"},{"group":"Workflows","pages":[{"title":"How to write and run a workflow","sidebarTitle":"Write and run a workflow","href":"/v3/how-to-guides/workflows/write-and-run"},{"title":"How to use assets to track workflow outputs","sidebarTitle":"Use assets to track workflow outputs","href":"/v3/how-to-guides/workflows/assets"},{"title":"How to automatically rerun your workflow when it fails","sidebarTitle":"Automatically rerun a workflow when it fails","href":"/v3/how-to-guides/workflows/retries"},{"title":"How to manually retry a flow run","sidebarTitle":"Manually retry a flow run","href":"/v3/how-to-guides/workflows/retry-flow-runs"},{"title":"How to customize a workflow's metadata","sidebarTitle":"Customize workflow metadata","href":"/v3/how-to-guides/workflows/custom-metadata"},{"title":"How to pass inputs to a workflow","sidebarTitle":"Pass inputs to a workflow","href":"/v3/how-to-guides/workflows/pass-inputs"},{"title":"How to add logging to a workflow","sidebarTitle":"Add logging","href":"/v3/how-to-guides/workflows/add-logging"},{"title":"How to access runtime information","sidebarTitle":"Access runtime information","href":"/v3/how-to-guides/workflows/access-runtime-info"},{"title":"How to run work concurrently","sidebarTitle":"Run work concurrently","href":"/v3/how-to-guides/workflows/run-work-concurrently"},{"title":"How to cache workflow step outputs","sidebarTitle":"Cache workflow step outputs","href":"/v3/how-to-guides/workflows/cache-workflow-steps"},{"title":"How to run background tasks","sidebarTitle":"Run background tasks","href":"/v3/how-to-guides/workflows/run-background-tasks"},{"title":"How to respond to state changes","sidebarTitle":"Respond to state changes","href":"/v3/how-to-guides/workflows/state-change-hooks"},{"title":"How to produce workflow artifacts","sidebarTitle":"Create Artifacts","href":"/v3/how-to-guides/workflows/artifacts"},{"title":"How to test workflows","sidebarTitle":"Test workflows","href":"/v3/how-to-guides/workflows/test-workflows"},{"title":"How to apply global concurrency and rate limits","sidebarTitle":"Apply global concurrency and rate limits","href":"/v3/how-to-guides/workflows/global-concurrency-limits"},{"title":"How to limit concurrent task runs with tags","sidebarTitle":"Limit concurrent task runs with tags","href":"/v3/how-to-guides/workflows/tag-based-concurrency-limits"}]},{"group":"Deployments","pages":[{"title":"How to create deployments","sidebarTitle":"Create Deployments","href":"/v3/how-to-guides/deployments/create-deployments"},{"title":"Trigger ad-hoc deployment runs","href":"/v3/how-to-guides/deployments/run-deployments"},{"title":"How to create schedules","sidebarTitle":"Create Deployment Schedules","href":"/v3/how-to-guides/deployments/create-schedules"},{"title":"Manage Deployment schedules","sidebarTitle":"Manage Deployment schedules","href":"/v3/how-to-guides/deployments/manage-schedules"},{"title":"How to deploy flows with Python","sidebarTitle":"Deploy via Python","href":"/v3/how-to-guides/deployments/deploy-via-python"},{"title":"How to define deployments with YAML","sidebarTitle":"Define deployments with YAML","href":"/v3/how-to-guides/deployments/prefect-yaml"},{"title":"How to retrieve code from storage","sidebarTitle":"Retrieve code from storage","href":"/v3/how-to-guides/deployments/store-flow-code"},{"title":"How to version deployments","sidebarTitle":"Version Deployments","href":"/v3/how-to-guides/deployments/versioning"},{"title":"How to override job variables","sidebarTitle":"Override Job Variables","href":"/v3/how-to-guides/deployments/customize-job-variables"}]},{"group":"Configuration","pages":[{"title":"How to store secrets","sidebarTitle":"Store secrets","href":"/v3/how-to-guides/configuration/store-secrets"},{"title":"How to share configuration between workflows","sidebarTitle":"Share configuration between workflows","href":"/v3/how-to-guides/configuration/variables"},{"title":"How to manage settings","sidebarTitle":"Manage settings","href":"/v3/how-to-guides/configuration/manage-settings"}]},{"group":"Automations","pages":[{"title":"How to create automations","sidebarTitle":"Create Automations","href":"/v3/how-to-guides/automations/creating-automations"},{"title":"Custom notifications","href":"/v3/how-to-guides/automations/custom-notifications"},{"title":"How to create deployment triggers","sidebarTitle":"Create Deployment Triggers","href":"/v3/how-to-guides/automations/creating-deployment-triggers"},{"title":"How to chain deployments with events","sidebarTitle":"Chain Deployments with Events","href":"/v3/how-to-guides/automations/chaining-deployments-with-events"},{"title":"How to access deployment and flow run parameters","sidebarTitle":"Access parameters in templates","href":"/v3/how-to-guides/automations/access-parameters-in-templates"},{"title":"How to pass event payloads to flows","sidebarTitle":"Pass event payloads to flows","href":"/v3/how-to-guides/automations/passing-event-payloads-to-flows"}]},{"group":"Workflow Infrastructure","pages":[{"title":"How to manage work pools","sidebarTitle":"Manage Work Pools","href":"/v3/how-to-guides/deployment_infra/manage-work-pools"},{"title":"How to run flows in local processes","sidebarTitle":"Run Flows in Local Processes","href":"/v3/how-to-guides/deployment_infra/run-flows-in-local-processes"},{"group":"Managed Infrastructure","expanded":false,"pages":[{"title":"How to run flows on Prefect Managed infrastructure","sidebarTitle":"Run flows on Prefect Managed infrastructure","href":"/v3/how-to-guides/deployment_infra/managed"},{"title":"Using cloud workload identity with Prefect Managed work pools","sidebarTitle":"Using cloud workload identity","href":"/v3/how-to-guides/deployment_infra/managed-aws-federated-identity"}]},{"title":"How to run flows on serverless compute","sidebarTitle":"Run flows on serverless compute","href":"/v3/how-to-guides/deployment_infra/serverless"},{"title":"How to run flows in Docker containers","sidebarTitle":"Run flows in Docker containers","href":"/v3/how-to-guides/deployment_infra/docker"},{"title":"How to run flows in a long-lived Docker container","sidebarTitle":"Run flows in a static container","href":"/v3/how-to-guides/deployment_infra/serve-flows-docker"},{"title":"How to run flows on Kubernetes","sidebarTitle":"Run flows on Kubernetes","href":"/v3/how-to-guides/deployment_infra/kubernetes"},{"title":"How to run flows on Modal","sidebarTitle":"Run flows on Modal","href":"/v3/how-to-guides/deployment_infra/modal"},{"title":"How to run flows on Coiled","sidebarTitle":"Run flows on Coiled","href":"/v3/how-to-guides/deployment_infra/coiled"}]},{"group":"Prefect Cloud","pages":[{"title":"How to connect to Prefect Cloud","sidebarTitle":"Connect to Prefect Cloud","href":"/v3/how-to-guides/cloud/connect-to-cloud"},{"group":"Manage accounts","pages":[{"title":"How to manage user accounts","sidebarTitle":"Manage user accounts","href":"/v3/how-to-guides/cloud/manage-users/index"},{"title":"How to manage service accounts","sidebarTitle":"Manage service accounts","href":"/v3/how-to-guides/cloud/manage-users/service-accounts"},{"title":"How to manage teams","sidebarTitle":"Manage teams","href":"/v3/how-to-guides/cloud/manage-users/manage-teams"},{"title":"How to manage account roles","sidebarTitle":"Manage account roles","description":"Configure user workspace roles in Prefect Cloud.","href":"/v3/how-to-guides/cloud/manage-users/manage-roles"},{"title":"How to manage API keys","sidebarTitle":"Manage API keys","href":"/v3/how-to-guides/cloud/manage-users/api-keys"},{"title":"How to configure single sign-on","sidebarTitle":"Configure single sign-on","description":"Configure single sign-on (SSO) for your Prefect Cloud users.","href":"/v3/how-to-guides/cloud/manage-users/configure-sso"},{"title":"How to audit Cloud activity","sidebarTitle":"Audit Cloud activity","href":"/v3/how-to-guides/cloud/manage-users/audit-logs"},{"title":"How to manage Access Control Lists (ACLs)","sidebarTitle":"Access Control Lists (ACLs)","href":"/v3/how-to-guides/cloud/manage-users/object-access-control-lists"},{"title":"How to secure access by IP address","sidebarTitle":"Secure access by IP address","href":"/v3/how-to-guides/cloud/manage-users/secure-access-by-ip-address"},{"title":"How to secure access over PrivateLink","sidebarTitle":"Secure access over PrivateLink","href":"/v3/how-to-guides/cloud/manage-users/secure-access-by-private-link"}]},{"title":"How to manage workspaces","sidebarTitle":"Manage Workspaces","href":"/v3/how-to-guides/cloud/workspaces"},{"title":"How to create a webhook","sidebarTitle":"Create a Webhook","href":"/v3/how-to-guides/cloud/create-a-webhook"},{"title":"How to troubleshoot Prefect Cloud","sidebarTitle":"Troubleshoot Prefect Cloud","href":"/v3/how-to-guides/cloud/troubleshoot-cloud"},{"title":"Prefect scope of support","sidebarTitle":"Scope of support","href":"/v3/how-to-guides/cloud/scope-of-support"}]},{"group":"Prefect Self-hosted","pages":[{"title":"How to run a local Prefect server","sidebarTitle":"Run a local Prefect server","href":"/v3/how-to-guides/self-hosted/server-cli"},{"title":"How to run the Prefect server in Docker","sidebarTitle":"Run the Prefect server in Docker","href":"/v3/how-to-guides/self-hosted/server-docker"},{"title":"How to run Prefect on Windows","sidebarTitle":"Run Prefect on Windows","href":"/v3/how-to-guides/self-hosted/server-windows"},{"title":"How to run the Prefect Server via Docker Compose","sidebarTitle":"Run the Prefect Server via Docker Compose","href":"/v3/how-to-guides/self-hosted/docker-compose"}]},{"group":"AI","pages":[{"title":"AI assistants with Prefect MCP","sidebarTitle":"Overview","icon":"robot","href":"/v3/how-to-guides/ai/index"},{"title":"How to use the Prefect MCP server","sidebarTitle":"Use the Prefect MCP server","href":"/v3/how-to-guides/ai/use-prefect-mcp-server"},{"title":"AI log summaries","sidebarTitle":"AI log summaries","href":"/v3/how-to-guides/ai/flow-run-log-summaries"}]},{"group":"Migrate","pages":[{"title":"How to Migrate from Airflow","sidebarTitle":"Migrate from Airflow","href":"/v3/how-to-guides/migrate/airflow"},{"title":"How to upgrade to Prefect 3.0","sidebarTitle":"Upgrade to Prefect 3.0","href":"/v3/how-to-guides/migrate/upgrade-to-prefect-3"},{"title":"How to upgrade from agents to workers","sidebarTitle":"Upgrade from agents to workers","href":"/v3/how-to-guides/migrate/upgrade-agents-to-workers"},{"title":"How to transfer resources between Prefect environments","sidebarTitle":"Transfer resources between environments","href":"/v3/how-to-guides/migrate/transfer-resources"}]}]},{"tab":"Advanced","pages":[{"title":"Advanced","href":"/v3/advanced"}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/v3/examples"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations/integrations"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/v3/api-ref"}]},{"tab":"Contribute","pages":[{"title":"Contribute","href":"/contribute"}]},{"tab":"Release Notes","pages":[{"title":"Release Notes","href":"/v3/release-notes"}]}]},"basePath":"","title":"How to manage API keys - Prefect","buildId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","deploymentId":"dpl_ATnXPMW25DMPUr9VBw6kL6MfBt6T","dynamics":[],"chunks":[]}