# API Access

Source: https://docs.autessa.com/docs/cli/api-access

> API keys, OAuth clients and single sign-on — what the CLI lists, why all three are administered in the browser, how company admins manage deploy keys from the terminal, and what to use for unattended automation.

# API Access

Three namespaces governing how systems and people authenticate into your company: `api-keys` for programmatic access, `oauth-clients` for registered applications, and `sso` for workforce identity. All 29 commands are listed by the CLI and **none are runnable** — every one is administered in the web app. [Deploy keys](#deploy-keys) are the one credential a company admin can manage from the terminal.

## Why none of this is scriptable

These namespaces mint and rotate credentials, and grant the permissions those credentials carry. Autessa keeps that behind a browser session deliberately: a credential-minting endpoint reachable from a script is a credential-minting endpoint reachable from a stolen script.

The commands still appear in the help tree so discovery tells you the capability exists and where it lives, rather than leaving you unsure whether you mistyped:

```bash
autessa api-keys create
```

```
Create a new API key (done in the web app).
```

> This is the same pattern as billing payments, SSO and payment methods — see [What stays in the browser](/docs/cli.md#what-stays-in-the-browser). Roughly 157 of the CLI's commands are listed-but-not-runnable for reasons of this kind.

## API keys

Programmatic API keys and their **per-resource** permissions — created, listed, updated, enabled/disabled and rotated, with permissions granted or revoked per resource and per type. Managed from account settings in the web app.

The namespace also carries the observability commands: `monthly-stats` for a key's usage and `transaction-history` for what it has actually done. Both are web-app views.

What matters when you are working from the terminal: an API key is the credential a **client application** uses against the [Client API](/docs/api.md), scoped by the per-resource permissions you grant it. It is not what the CLI itself uses — `autessa login` mints a separate, short-lived, tenant-scoped session credential. See [Install and sign in](/docs/cli/install.md).

## OAuth clients

Registering OAuth client applications for your company, rotating their secrets, and revoking them. Five commands, all web-app-only.

Use these when an external application needs to act on behalf of your users, rather than with a fixed company-scoped key.

## Single sign-on

Configuring the identity provider, managing verified email domains, setting the auto-join role, and toggling login enforcement.

Domain verification involves DNS records and a verification step, and enforcement changes how everyone in the company signs in — both are firmly human-confirmation territory.

## Deploy keys

`deploy-keys` manages the credential that [the Autessa CDK](/docs/cdk.md), CI and pipelines use. Unlike the namespaces above, its commands run from the terminal, because setting up a deploy is terminal work. The stance is the same: a script can't mint one.

```bash
autessa deploy-keys create --name "CI main" --scopes DEPLOY_DIFF,DEPLOY_APPLY --stageName production
autessa deploy-keys list
autessa deploy-keys rotate --keyId <keyId>
autessa deploy-keys revoke --keyId <keyId>
```

- **Company admins only.** Anyone else gets a `403` with `Only a company admin can manage deploy keys.`
- **You, or a full poweruser key.** These commands run from your own `autessa login` session or with a full [poweruser key](/docs/guide/api-management/poweruser-keys.md). Scripts, tools, agents, apps, the hosted connector, client API keys and deploy keys themselves are refused, and the `autessa.*` SDK has no such methods.
- **The secret is shown once.** `create` and `rotate` print it in the `secret` field. Save it straight away: it is never listed, can't be shown again, and is left out of request logs. `rotate` keeps the key's id, scopes and stage, and the old secret stops working at once.
- **Every call is recorded** in the company's audit trail, refused ones included.

`--stageName` is a label for your own records. It doesn't limit where the key works. A revoked key stays in the list with the time it was revoked, and can't be rotated or used again.

## What to use for unattended automation

Since you cannot mint an API key from the CLI, the question this page usually raises is: how do I run automation with no human present?

Three answers, in the order worth trying:

1. **Put the work on the platform.** [Scheduled jobs](/docs/cli/scheduled-jobs.md), [table triggers](/docs/cli/autessadb.md) and [inbound webhooks](/docs/cli/webhooks-and-queues.md) run server-side with no session to expire. Use the CLI to *create* them and let the platform run them. This is the durable answer for most cases.
2. **Use a poweruser key over HTTP.** The [Poweruser API](/docs/api/poweruser.md) covers the same operations the CLI exposes, and every CLI command has a poweruser equivalent. Keys are minted in the browser — see [Poweruser keys](/docs/guide/api-management/poweruser-keys.md).
3. **Use an API key from your application.** For a client app acting against the [Client API](/docs/api.md), with per-resource permissions scoped to exactly what it needs.

What *not* to do is wrap the `autessa` CLI in a cron job: `autessa login` mints a session that ends after the hours you chose (capped by your company's maximum), so the job will start failing when it does and the failure will look like a bug in your script.

## Related

- [Autessa CLI](/docs/cli.md) — what stays in the browser, and why
- [Install and sign in](/docs/cli/install.md) — how the CLI's own credential works
- [Poweruser API](/docs/api/poweruser.md) and [Poweruser keys](/docs/guide/api-management/poweruser-keys.md)
- [API keys](/docs/guide/api-management/api-keys.md) and [OAuth clients](/docs/guide/api-management/oauth-clients.md)
- [Company and account](/docs/cli/company.md)

