Create a full API key under Account Settings → API Keys, with the scopes your commands need, and copy the account ID from account settings. See API authentication.
On a terminal, the command asks for your API key and your account ID on stderr, and hides the key as you type it. When stdin is not a terminal, it reads the key and the account ID as two lines of stdin, and empty stdin cancels it with exit code 4; the auth reference shows how to pipe them in. Profiles says which name the profile gets.Before it saves anything, the command reads the account to check that the key belongs to the account ID:
A key the API rejects, or a key of another account, fails with exit code 2.
A key whose IP allow list leaves out this machine fails with exit code 6.
A key without the scope to read the account belongs to the account, and is saved.
Give both flags or neither: one alone fails with exit code 4. A key passed as a flag can end up in your shell history. Prefer the prompt on your own machine.
The CLI reads no environment variable for credentials or profiles. --api-key always uses the production API and cannot be combined with --profile. See CI credentials for the rules.
Profiles says which profile becomes the default. When a login keeps another profile as the default, its output says how to switch to the new one. To log in to a profile again, run auth login with its name; the login replaces the profile’s credentials without asking.
# Status of the default profileahasend auth status# Status of one profileahasend auth status --profile production# Names of all profilesahasend auth status --all
auth status shows the profile, its account ID, whether the API accepts its key for that account, and the account. It exits nonzero when the key cannot be verified.
# Remove one profileahasend auth logout staging# Remove every profile, after a confirmation promptahasend auth logout --all
auth logout staging removes the profile at once, without a prompt. You can also name the profile with --profile, as in ahasend auth logout --profile staging.auth logout without a profile removes the default profile. When you remove the default profile and one profile is left, that profile becomes the default. When several are left, none is the default until you run ahasend auth switch <profile>.
Profiles live in ~/.ahasend/config.yaml, which holds your API keys in plain text and is readable by your user only. No auth command prints a profile’s API key. apikeys create and subaccounts api-keys create print the new key’s secret once, so store it when you create the key. See Configuration File.
Keep your API keys secure. Never commit credentials to version control.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"AhaSend","description":"AhaSend is a European transactional email service for developers: send through a REST API, SMTP relay, CLI or the official Node.js and Go SDKs, with data stored in the EU and 1,000 free emails per month.","colors":{"primary":"#066fd1","light":"#F8FAFC","dark":"#0F172A"},"logo":{"light":"https://mintcdn.com/ahasend/F35Ozd-1GsftDpcH/logo.png?fit=max\u0026auto=format\u0026n=F35Ozd-1GsftDpcH\u0026q=85\u0026s=ca1d4c27f7c2811598e65cb25a21323c","dark":"https://mintcdn.com/ahasend/F35Ozd-1GsftDpcH/logo-dark.png?fit=max\u0026auto=format\u0026n=F35Ozd-1GsftDpcH\u0026q=85\u0026s=bb6b9068b30f93fd1ea216e2a7c1d137","href":"https://ahasend.com/"},"favicon":"https://mintcdn.com/ahasend/F35Ozd-1GsftDpcH/favicon.png?fit=max\u0026auto=format\u0026n=F35Ozd-1GsftDpcH\u0026q=85\u0026s=ac855c16b6cb74b8c5965d2e7ef3e324","appearance":{"strict":false},"navbar":{"links":[{"href":"https://dash.ahasend.com","label":"Login"}],"primary":{"type":"button","label":"Get Started","href":"https://dash.ahasend.com/user/register"}},"footer":{"socials":{"x":"https://x.com/aha_send","linkedin":"https://www.linkedin.com/company/ahasend","github":"https://github.com/ahasend"},"links":[{"header":"Resources","items":[{"label":"Pricing","href":"https://ahasend.com/pricing"},{"label":"Support","href":"mailto:support@ahasend.com"},{"label":"Status","href":"https://status.ahasend.com"},{"label":"Security","href":"https://ahasend.com/security"}]},{"header":"Company","items":[{"label":"Blog","href":"https://ahasend.com/blog"},{"label":"Feedback Board","href":"https://ahasend.sleekplan.app/"}]},{"header":"Legal","items":[{"label":"Imprint","href":"https://ahasend.com/imprint"},{"label":"Terms of Service","href":"https://ahasend.com/terms"},{"label":"Privacy Policy","href":"https://ahasend.com/privacy"},{"label":"Data Processing Agreement","href":"https://ahasend.com/dpa"}]}]},"seo":{"metatags":{"canonical":"https://ahasend.com/docs","twitter:site":"@aha_send"},"organization":{"name":"AhaSend","legalName":"AhaSend B.V.","url":"https://ahasend.com","sameAs":["https://x.com/aha_send","https://www.linkedin.com/company/ahasend","https://github.com/ahasend"]}},"integrations":{"telemetry":{"enabled":true},"cookies":{"key":"cookieConsent","value":"true"}},"errors":{"404":{"redirect":true}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"thumbnails":{"appearance":"dark","background":"https://mintcdn.com/ahasend/Gpf8BnLpzpIKQ4dU/images/social-background.svg?fit=max\u0026auto=format\u0026n=Gpf8BnLpzpIKQ4dU\u0026q=85\u0026s=df32e1edef517352b8437c75feecbf6e"},"markdown":{"instructions":["AhaSend stores all message data in the EU. See /facts.","The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.","Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.","For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes."]},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"ahasend","hasAudioNarration":false,"actualSubdomain":"ahasend","customDomains":["ahasend.com"],"gitSource":{"type":"github","owner":"ahasend","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adfc319e83fbbb268c93e4e","collectionId":"0d176591-a964-41df-9533-235282892afa","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adfc319e83fbbb268c93e4e"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6adfc319e83fbbb268c93e4e","clientVersion":"0.0.3971","searchFilterCounts":[{"language":"default","tag":"API Reference","count":148},{"language":"default","tag":"API reference","count":114},{"language":"default","tag":"Documentation","count":68},{"language":"default","tag":"Guides","count":52},{"language":"default","tag":"Integrations","count":41},{"language":"default","tag":"Webhooks","count":29},{"language":"default","tag":"CLI","count":25},{"language":"default","tag":"Commands","count":15},{"language":"default","tag":"Domain Authentication","count":13},{"language":"default","tag":"Campaigns","count":12}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"privacy":{"consentBanner":{"enabled":false}},"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#content-container table{display:table}#content-container table thead th{text-align:left}"},{"filePath":"roadmap.css","content":".rm{display:flex;flex-direction:column;gap:2.5rem;margin-top:1.5rem}.rm-head{display:flex;align-items:center;gap:.65rem;margin-bottom:1rem}.rm-badge{display:inline-flex;align-items:center;margin:0;border:0;font-size:.78rem;font-weight:600;letter-spacing:.02em;padding:.28rem .75rem;border-radius:999px;line-height:1}.rm-badge.is-active{background:#fdebd0;color:#854f0b}.rm-badge.is-planned{background:#e6f1fb;color:#0c447c}.rm-badge.is-shipped{background:#e1f5ee;color:#0f6e56}.rm-list{display:flex;flex-direction:column;gap:.65rem}.rm-card{display:flex;gap:.9rem;padding:.9rem 1.05rem;background:#fff;border:1px solid #e5e7eb;border-radius:.7rem;transition:transform .15s ease,box-shadow .15s ease}.rm-card:hover{transform:translateY(-1px);box-shadow:0 4px 14px rgba(0,0,0,.06)}.rm-accent{flex:0 0 3px;border-radius:2px}.rm-card.is-active .rm-accent{background:#ba7517}.rm-card.is-planned .rm-accent{background:#378add}.rm-card.is-shipped .rm-accent{background:#1d9e75}.rm-card.is-sub{margin-left:2rem;position:relative}.rm-card p,.rm-card.is-sub .rm-title{font-size:.9rem}.rm-card.is-sub::after,.rm-card.is-sub::before{content:\"\";position:absolute;left:-1.15rem;pointer-events:none}.rm-card.is-sub::before{top:-.65rem;height:calc(100% + .65rem);border-left:1.5px solid #d1d5db}.rm-card.is-sub::after{top:50%;width:.85rem;border-top:1.5px solid #d1d5db}.rm-card .rm-title{margin:0 0 .2rem;font-size:.97rem;font-weight:600;line-height:1.35;color:#111827}.rm-card p{margin:0;line-height:1.55;color:#4b5563}.rm-date,.rm-tag{display:inline-block}.rm-date{margin-top:.5rem;font-size:.78rem;font-weight:600;color:#0f6e56}.rm-tag{margin-left:.5rem;font-size:.66rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;padding:.16rem .5rem;border-radius:999px;vertical-align:middle;line-height:1.4;color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.15)}.rm-tag.is-new{background:#6d28d9}.rm-tag.is-product{background:#be123c}.rm-tag.is-improvement{background:#0e7490}.rm-tag.is-early{background:#1d4ed8}.rm-tag.is-bugfix{background:#c2410c}.dark .rm-card{background:rgba(255,255,255,.025);border-color:rgba(255,255,255,.09)}.dark .rm-card p{color:#9ca3af}.dark .rm-badge.is-active{background:rgba(186,117,23,.18);color:#fac074}.dark .rm-badge.is-planned{background:rgba(55,138,221,.18);color:#85b7eb}.dark .rm-badge.is-shipped{background:rgba(29,158,117,.18);color:#5dcaa5}.dark .rm-date{color:#5dcaa5}.dark .rm-card.is-sub::after,.dark .rm-card.is-sub::before{border-color:rgba(255,255,255,.18)}.rm-note{margin-top:2.5rem;font-size:.85rem;color:#6b7280}.dark .rm-note{color:#9ca3af}.dark .rm-card .rm-title{color:#e7e9ee}.rm-jump{margin:-.5rem 0 0;font-size:.88rem}.rm-jump a{color:#2296ff;text-decoration:none;font-weight:500}.rm-jump a:hover{text-decoration:underline}.rm-badge[id]{scroll-margin-top:6rem}"}],"page":{"pagePath":"cli/authentication","slug":"/cli/authentication","pageMetadata":{"title":"CLI Authentication: API Keys and Profiles","description":"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.","icon":"key","sidebarTitle":"Authentication","href":"/cli/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: \"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\"\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`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._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:`The AhaSend CLI saves your API credentials as profiles, so you can work with several accounts or environments.`}),`\n`,_jsx(Heading,{level:`2`,id:`getting-started`,children:`Getting Started`}),`\n`,_jsxs(_components.p,{children:[`Create a full API key under `,_jsx(_components.strong,{children:`Account Settings → API Keys`}),`, with the scopes your commands need, and copy the account ID from account settings. See `,_jsx(_components.a,{href:`/api-reference/authentication`,children:`API authentication`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`interactive-login`,children:`Interactive Login`}),`\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:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`On a terminal, the command asks for your API key and your account ID on stderr, and hides the key as you type it. When stdin is not a terminal, it reads the key and the account ID as two lines of stdin, and empty stdin cancels it with exit code 4; the `,_jsx(_components.a,{href:`/cli/commands/auth#command-flags`,children:`auth reference`}),` shows how to pipe them in. `,_jsx(_components.a,{href:`/cli/configuration#profiles`,children:`Profiles`}),` says which name the profile gets.`]}),`\n`,_jsx(_components.p,{children:`Before it saves anything, the command reads the account to check that the key belongs to the account ID:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A key the API rejects, or a key of another account, fails with exit code 2.`}),`\n`,_jsx(_components.li,{children:`A key whose IP allow list leaves out this machine fails with exit code 6.`}),`\n`,_jsx(_components.li,{children:`A key without the scope to read the account belongs to the account, and is saved.`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`direct-login`,children:`Direct Login`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,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:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --api-key`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` YOUR_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --account-id`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` YOUR_ACCOUNT_ID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --profile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` production`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Give both flags or neither: one alone fails with exit code 4. A key passed as a flag can end up in your shell history. Prefer the prompt on your own machine.`}),`\n`,_jsx(Heading,{level:`3`,id:`ci-credentials`,children:`CI Credentials`}),`\n`,_jsxs(_components.p,{children:[`In CI, skip `,_jsx(_components.code,{children:`auth login`}),`: store the API key and account ID as secrets and pass them with the global flags:`]}),`\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:`ahasend`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --api-key`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$AHASEND_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --account-id`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$AHASEND_ACCOUNT_ID`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ping`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The CLI reads no environment variable for credentials or profiles. `,_jsx(_components.code,{children:`--api-key`}),` always uses the production API and cannot be combined with `,_jsx(_components.code,{children:`--profile`}),`. See `,_jsx(_components.a,{href:`/cli/configuration#ci-credentials`,children:`CI credentials`}),` for the rules.`]}),`\n`,_jsx(Heading,{level:`2`,id:`profiles`,children:`Profiles`}),`\n`,_jsx(Heading,{level:`3`,id:`creating-profiles`,children:`Creating Profiles`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --profile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` production`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --profile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` staging`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/cli/configuration#profiles`,children:`Profiles`}),` says which profile becomes the default. When a login keeps another profile as the default, its output says how to switch to the new one. To log in to a profile again, run `,_jsx(_components.code,{children:`auth login`}),` with its name; the login replaces the profile’s credentials without asking.`]}),`\n`,_jsx(Heading,{level:`3`,id:`switching-profiles`,children:`Switching Profiles`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,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:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Change the default profile`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` switch`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` production`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Use a profile for a single command`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` messages`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` send`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --sandbox`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --profile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` staging`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` test@staging.example.com`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --to`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev@example.com`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --subject`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Test\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --text`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Docs test\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auth switch`}),` checks the profile’s key first. When the check fails, it prints a warning on stderr and switches anyway.`]}),`\n`,_jsx(Heading,{level:`3`,id:`check-status`,children:`Check Status`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,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:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Status of the default profile`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Status of one profile`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --profile`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` production`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Names of all profiles`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --all`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auth status`}),` shows the profile, its account ID, whether the API accepts its key for that account, and the account. It exits nonzero when the key cannot be verified.`]}),`\n`,_jsx(Heading,{level:`3`,id:`remove-profiles`,children:`Remove Profiles`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Remove one profile`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` logout`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` staging`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Remove every profile, after a confirmation prompt`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` logout`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --all`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auth logout staging`}),` removes the profile at once, without a prompt. You can also name the profile with `,_jsx(_components.code,{children:`--profile`}),`, as in `,_jsx(_components.code,{children:`ahasend auth logout --profile staging`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`auth logout`}),` without a profile removes the default profile. When you remove the default profile and one profile is left, that profile becomes the default. When several are left, none is the default until you run `,_jsx(_components.code,{children:`ahasend auth switch \u003cprofile>`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`credential-storage`,children:`Credential Storage`}),`\n`,_jsxs(_components.p,{children:[`Profiles live in `,_jsx(_components.code,{children:`~/.ahasend/config.yaml`}),`, which holds your API keys in plain text and is readable by your user only. No `,_jsx(_components.code,{children:`auth`}),` command prints a profile’s API key. `,_jsx(_components.code,{children:`apikeys create`}),` and `,_jsx(_components.code,{children:`subaccounts api-keys create`}),` print the new key’s secret once, so store it when you create the key. See `,_jsx(_components.a,{href:`/cli/configuration#configuration-file`,children:`Configuration File`}),`.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Keep your API keys secure. Never commit credentials to version control.`})}),`\n`,_jsx(Heading,{level:`2`,id:`testing-authentication`,children:`Testing Authentication`}),`\n`,_jsx(_components.p,{children:`Verify your setup:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ping`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`ahasend`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auth`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ping`}),` checks that the API can be reached and accepts your key. `,_jsx(_components.code,{children:`auth status`}),` also checks that the key belongs to the profile’s account.`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next Steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/cli/quickstart`,children:`Send your first email`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/cli/commands/domains`,children:`Manage domains`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/cli/commands/webhooks`,children:`Configure webhooks`})}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`related-guides`,children:`Related Guides`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/cli/installation`,children:`Install the CLI`}),`, `,_jsx(_components.a,{href:`/send-api/send-email`,children:`REST sending guide`}),`, `,_jsx(_components.a,{href:`/smtp`,children:`SMTP settings`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/nodejs-sdk`,children:`Node.js SDK`}),`, `,_jsx(_components.a,{href:`/guides/go-sdk`,children:`Go SDK`}),`, `,_jsx(_components.a,{href:`/cli/configuration`,children:`CLI configuration and output`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/cli/commands/auth`,children:`auth command reference`}),`, `,_jsx(_components.a,{href:`/api-reference/authentication`,children:`API authentication`}),`, `,_jsx(_components.a,{href:`/api-reference/scopes`,children:`Permission scopes`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/domains`,children:`Domain setup`}),`, `,_jsx(_components.a,{href:`/send-api/sandbox`,children:`Sandbox behavior`}),`.`]}),`\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 Authentication: API Keys and Profiles","description":"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.","icon":"key","sidebarTitle":"Authentication","href":"/cli/authentication"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Getting Started","slug":"getting-started","depth":2,"children":[{"title":"Interactive Login","slug":"interactive-login","depth":3,"children":[]},{"title":"Direct Login","slug":"direct-login","depth":3,"children":[]},{"title":"CI Credentials","slug":"ci-credentials","depth":3,"children":[]}]},{"title":"Profiles","slug":"profiles","depth":2,"children":[{"title":"Creating Profiles","slug":"creating-profiles","depth":3,"children":[]},{"title":"Switching Profiles","slug":"switching-profiles","depth":3,"children":[]},{"title":"Check Status","slug":"check-status","depth":3,"children":[]},{"title":"Remove Profiles","slug":"remove-profiles","depth":3,"children":[]}]},{"title":"Credential Storage","slug":"credential-storage","depth":2,"children":[]},{"title":"Testing Authentication","slug":"testing-authentication","depth":2,"children":[]},{"title":"Next Steps","slug":"next-steps","depth":2,"children":[]},{"title":"Related Guides","slug":"related-guides","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/ahasend/1d760da0535d9f7c/ahasend-gtm.js"],"subdomain":"ahasend","siteName":"AhaSend","title":"CLI Authentication: API Keys and Profiles - AhaSend","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-16T17:32:36.694Z","originalFileLocation":"cli/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=\"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=\"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\">\u003cmeta data-mint-head name=\"application-name\" content=\"AhaSend\">\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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_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/ahasend/4BjAcdwrGYDKJCaO/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"CLI Authentication: API Keys and Profiles - AhaSend\">\u003cmeta data-mint-head property=\"og:description\" content=\"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"AhaSend\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://ahasend.com/docs/cli/authentication\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://ahasend.mintlify.app/_mintlify/api/og/v2?division=Getting+Started\u0026amp;title=CLI+Authentication%3A+API+Keys+and+Profiles\u0026amp;description=Log+in+to+the+AhaSend+CLI+with+your+API+key+and+account+ID%2C+manage+separate+profiles+for+production+and+staging%2C+and+pass+credentials+safely+in+CI%2FCD.\u0026amp;theme=fec911c84bb9f722051c4af3\u0026amp;signature=ea429a29e44a7aaa721f7d7af4eb6b49b9af1ccd9b0be396cc79820d7c1ac67f\">\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 Authentication: API Keys and Profiles - AhaSend\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ahasend.mintlify.app/_mintlify/api/og/v2?division=Getting+Started\u0026amp;title=CLI+Authentication%3A+API+Keys+and+Profiles\u0026amp;description=Log+in+to+the+AhaSend+CLI+with+your+API+key+and+account+ID%2C+manage+separate+profiles+for+production+and+staging%2C+and+pass+credentials+safely+in+CI%2FCD.\u0026amp;theme=fec911c84bb9f722051c4af3\u0026amp;signature=ea429a29e44a7aaa721f7d7af4eb6b49b9af1ccd9b0be396cc79820d7c1ac67f\">\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/ahasend/4BjAcdwrGYDKJCaO/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"AhaSend\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#066fd1\">\u003clink data-mint-head rel=\"canonical\" href=\"https://ahasend.com/docs/cli/authentication\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/cli/authentication.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://ahasend.com/#organization\",\"name\":\"AhaSend\",\"legalName\":\"AhaSend B.V.\",\"url\":\"https://ahasend.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/ahasend/F35Ozd-1GsftDpcH/logo.png?fit=max\u0026auto=format\u0026n=F35Ozd-1GsftDpcH\u0026q=85\u0026s=ca1d4c27f7c2811598e65cb25a21323c\"},\"sameAs\":[\"https://x.com/aha_send\",\"https://www.linkedin.com/company/ahasend\",\"https://github.com/ahasend\"]},{\"@type\":\"WebSite\",\"@id\":\"https://ahasend.com/docs#website\",\"name\":\"AhaSend\",\"url\":\"https://ahasend.com/docs\",\"publisher\":{\"@id\":\"https://ahasend.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://ahasend.com/docs/cli/authentication#webpage\",\"url\":\"https://ahasend.com/docs/cli/authentication\",\"name\":\"CLI Authentication: API Keys and Profiles\",\"description\":\"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\",\"dateModified\":\"2026-10-16T17:32:36.694Z\",\"isPartOf\":{\"@id\":\"https://ahasend.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://ahasend.com/docs/cli/authentication#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://ahasend.com/docs/cli/authentication#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Getting Started\",\"item\":\"https://ahasend.com/docs/cli/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CLI Authentication: API Keys and Profiles\",\"item\":\"https://ahasend.com/docs/cli/authentication\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://ahasend.com/docs/cli/authentication#article\",\"headline\":\"CLI Authentication: API Keys and Profiles\",\"name\":\"CLI Authentication: API Keys and Profiles\",\"description\":\"Log in to the AhaSend CLI with your API key and account ID, manage separate profiles for production and staging, and pass credentials safely in CI/CD.\",\"url\":\"https://ahasend.com/docs/cli/authentication\",\"mainEntityOfPage\":{\"@id\":\"https://ahasend.com/docs/cli/authentication#webpage\"},\"dateModified\":\"2026-10-16T17:32:36.694Z\",\"publisher\":{\"@id\":\"https://ahasend.com/#organization\"},\"isPartOf\":{\"@id\":\"https://ahasend.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"AhaSend\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"AhaSend","nav":{"global":null,"tabs":[{"tab":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":""}]},{"tab":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/api-reference"}]},{"tab":"CLI","icon":"square-terminal","groups":[{"group":"Getting Started","pages":[{"title":"AhaSend CLI: Send Email from Your Terminal","icon":"book","sidebarTitle":"Overview","href":"/cli"},{"title":"Install the AhaSend CLI (macOS, Linux, Windows)","icon":"download","sidebarTitle":"Installation","href":"/cli/installation"},{"title":"CLI Quickstart: Send Email from the Terminal","description":"Send your first email from the command line with the AhaSend CLI: log in with your API key, add and verify a domain, then send test emails in sandbox mode.","icon":"play","sidebarTitle":"Quickstart","href":"/cli/quickstart"},{"title":"CLI Authentication: API Keys and Profiles","icon":"key","sidebarTitle":"Authentication","href":"/cli/authentication"},{"title":"CLI Configuration: Config File, Flags, Output","description":"Reference for the AhaSend CLI config file, profiles, global flags, output formats, JSON output, prompts and exit codes, for use in a terminal and in scripts.","icon":"gear","sidebarTitle":"Configuration","href":"/cli/configuration"},{"title":"CLI Examples: Scripts and CI/CD Automation","icon":"lightbulb","sidebarTitle":"Examples","href":"/cli/examples"}]},{"group":"Commands","pages":[{"title":"ahasend messages: Send and Track Email","icon":"envelope","sidebarTitle":"messages","href":"/cli/commands/messages"},{"title":"ahasend domains: Add and Verify Domains","icon":"globe","sidebarTitle":"domains","href":"/cli/commands/domains"},{"title":"ahasend webhooks: Manage and Test Webhooks","icon":"webhook","sidebarTitle":"webhooks","href":"/cli/commands/webhooks"},{"title":"ahasend routes: Manage Inbound Email Routes","icon":"route","sidebarTitle":"routes","href":"/cli/commands/routes"},{"title":"ahasend suppressions: Manage Suppressions","icon":"ban","sidebarTitle":"suppressions","href":"/cli/commands/suppressions"},{"title":"ahasend smtp: SMTP Credentials and Test Sends","icon":"server","sidebarTitle":"smtp","href":"/cli/commands/smtp"},{"title":"ahasend apikeys: Manage API Keys","icon":"key","sidebarTitle":"apikeys","href":"/cli/commands/apikeys"},{"title":"ahasend stats: Delivery and Bounce Reports","icon":"chart-line","sidebarTitle":"stats","href":"/cli/commands/stats"},{"title":"ahasend auth: Log In and Manage Profiles","icon":"user-shield","sidebarTitle":"auth","href":"/cli/commands/auth"},{"title":"ahasend ping: Test API Connectivity","icon":"wifi","sidebarTitle":"ping","href":"/cli/commands/ping"},{"title":"ahasend contacts: Manage Account Contacts","sidebarTitle":"contacts","icon":"address-book","href":"/cli/commands/contacts"},{"title":"ahasend lists: Manage Contact Lists","sidebarTitle":"lists","icon":"list-ul","href":"/cli/commands/lists"},{"title":"ahasend templates: Transactional Templates","sidebarTitle":"templates","icon":"file-lines","href":"/cli/commands/templates"},{"title":"ahasend campaigns: Manage Campaigns","sidebarTitle":"campaigns","icon":"bullhorn","href":"/cli/commands/campaigns"},{"title":"ahasend subaccounts: Manage Sub-Accounts","sidebarTitle":"subaccounts","icon":"building","href":"/cli/commands/subaccounts"}]},{"group":"Features","pages":[{"title":"Send Batch Emails from CSV with the CLI","icon":"layer-group","sidebarTitle":"Batch Processing","href":"/cli/batch-processing"},{"title":"Message Content and Substitutions in the CLI","icon":"file-code","sidebarTitle":"Message Content","href":"/cli/templates"},{"title":"Test Webhooks Locally with the CLI","icon":"bug","sidebarTitle":"Webhook Testing","href":"/cli/webhook-testing"},{"title":"Test Inbound Email Routes Locally with the CLI","icon":"envelopes-bulk","sidebarTitle":"Route Testing","href":"/cli/route-testing"}]}]},{"tab":"Guides","icon":"plug","pages":[{"title":"Guides","href":"/guides"}]},{"tab":"Changelog","icon":"clock-rotate-left","pages":[{"title":"Changelog","href":"/changelog"}]},{"tab":"Roadmap","icon":"map","pages":[{"title":"Roadmap","href":"/roadmap"}]}]},"title":"CLI Authentication: API Keys and Profiles - AhaSend","buildId":"dpl_GvhK4qVXq51DpfYJLCtPpYNN4YHN","deploymentId":"dpl_GvhK4qVXq51DpfYJLCtPpYNN4YHN","dynamics":[],"chunks":[]}