> ## Documentation Index
> Fetch the complete documentation index at: https://docs.entire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Choose an own-account bearer, service account secret, plugin JWT, installation token, or plugin OAuth user access token.

Choose a credential for the operation you want to call. **User token** means a bearer for your own account, including supported service accounts. An `Authorization: Bearer` field alone does not tell you which tokens the endpoint accepts.

| Credential | Used for | Authority |
| :- | :- | :- |
| **User token** | Work under your own account, including account-authorized plugin management. | Your account's permissions; supported service accounts are included. |
| **Service account secret** | Scripts and jobs that must not act as you, such as a local agent or a cron job. | Exchanged for a service account token that lives at most 10 minutes; the service account's own grants. The secret expires in at most one year. |
| **Platform OIDC token** | Jobs on a platform that issues OIDC tokens, such as GitHub Actions or Google Cloud. | Exchanged for a service account token that lasts 45 minutes; the service account's own grants. See [OpenID Connect (OIDC)](https://docs.entire.com/guides/configuration/oidc.md). |
| **Plugin JWT** | Supported installation operations on Core, including repository discovery and token minting. | Your registered plugin key and the named installation; use a 5-minute lifetime (10-minute maximum). |
| **Plugin installation token** | Plugin runtime work on selected repositories and supported Core operations. | Entire-issued bearer, narrowed to the installation's granted permissions; about 45 minutes. |
| **Plugin OAuth user token** | Discover which of your plugin's installations and repositories a signed-in user can access. | Plugin OAuth delegation; not the user's own-account bearer or an installation token. |

## Use your own account

[Log in with the CLI](https://docs.entire.com/cli-reference/login.md), then use [`entire api`](https://docs.entire.com/cli-reference/api) to make authenticated requests. For an HTTP client, [`entire auth token`](https://docs.entire.com/cli-reference/auth#auth-token) prints the bearer for your active login context:

```bash theme={null}
curl -H "Authorization: Bearer $(entire auth token)" \
  "https://us.console.entire.io/api/v1/clusters"
```

Treat the output as a secret. If `ENTIRE_TOKEN` is set, `entire auth token` uses that bearer override after validation and trimming; check that it is the credential you intend to use. The [Go SDK](https://docs.entire.com/guides/api/sdks.md) also accepts this bearer.

Use endpoints documented to accept an own-account bearer. Where available, the **Users** badge identifies this calling context. Service accounts are included where supported; the badge does not grant permissions or promise access to every resource.

## Run as a service account

A [service account](https://docs.entire.com/guides/configuration/service-accounts.md) lets a script call the API without acting as you. To call the API as one, [create a secret](https://docs.entire.com/guides/configuration/service-accounts.md#sign-in-with-a-secret) and exchange it for a service account token. Send the secret to the auth URL for its region as the subject of an RFC 8693 token exchange, with the service account ID as the `resource`. A `us` secret goes to `https://us.auth.entire.io`:

```bash theme={null}
TOKEN=$(curl -sS -X POST "https://us.auth.entire.io/oauth/token" -u "entire-cli:" \
  --data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
  --data-urlencode "subject_token_type=urn:ietf:params:oauth:token-type:access_token" \
  --data-urlencode "subject_token=$ENTIRE_TOKEN" \
  --data-urlencode "audience=https://us.auth.entire.io" \
  --data-urlencode "resource=svc_<ULID>" \
  | jq -r '.access_token // error(.error_description)')
```

A secret has this layout. The `<region>` part shows which auth URL to use:

```text theme={null}
ent_svc_<region>_<service account ULID>_<secret ULID>_<random><checksum>
```

The service account token lives at most 10 minutes, and never past the secret's own expiry. Read its lifetime from `expires_in` rather than assuming one, and exchange the secret again when the token is close to expiry or after a `401`. Never send the secret itself as a bearer. The [Go SDK](https://docs.entire.com/guides/api/sdks.md) does this exchange for you.

To manage service accounts over the API instead of in entire.com or the CLI, call these endpoints with your own login token:

* [Create a service account](https://docs.entire.com/api-reference/control-plane/service-accounts/create-service-account.md) and [list service accounts](https://docs.entire.com/api-reference/control-plane/service-accounts/list-service-accounts-in-an-org-or-project.md).
* [Grant access on a repository or project](https://docs.entire.com/api-reference/control-plane/service-accounts/grant-service-account-access-on-a-repo-or-project.md), [list grants](https://docs.entire.com/api-reference/control-plane/service-accounts/list-service-account-grants.md), and [revoke access](https://docs.entire.com/api-reference/control-plane/service-accounts/revoke-service-account-access.md).
* [Create a secret](https://docs.entire.com/api-reference/control-plane/service-accounts/create-service-account-secret.md), [list secrets](https://docs.entire.com/api-reference/control-plane/service-accounts/list-service-account-secrets.md), and [delete a secret](https://docs.entire.com/api-reference/control-plane/service-accounts/delete-service-account-secret.md).
* [Create an OIDC binding](https://docs.entire.com/api-reference/control-plane/service-accounts/create-oidc-binding.md), [list bindings](https://docs.entire.com/api-reference/control-plane/service-accounts/list-oidc-bindings.md), and [delete a binding](https://docs.entire.com/api-reference/control-plane/service-accounts/delete-oidc-binding.md).

## Read endpoint labels

Audience labels and **Accepted credentials** details are being added to the service specifications. Use the operation and workflow guidance when those details are absent. When labels are available, read them as follows:

| Endpoint audience badge | Meaning |
| :- | :- |
| Users | Accepts own-account credentials, including supported service accounts. |
| Plugins | Accepts registered plugin-flow credentials. Read **Accepted credentials** to choose the right kind. |

An endpoint that accepts both account and plugin credentials shows both badges below its title. Each context may have different permissions and restrictions. The **Accepted credentials** details list alternatives, not tokens you must send together. These documentation labels are independent of the JWT `aud` claim and the **Experimental** marker. Older specifications may not have labels yet: an absent label does not imply access. Public, share-link and internal flows need their own documented rules.

An audience badge describes accepted credentials, not authorization success. Read the operation's permissions, repository or project scope, ownership rules and placement requirements. Plugin permissions such as `contents:read`, `discussions:write` and `repositories:create` are capabilities granted to the installation; they are distinct from OAuth sign-in scopes. Even a `GET` may require a write capability.

## Plugin management and runtime

A user managing a plugin installation still acts with their own account and its management permissions. Installing a plugin does not turn that user's bearer into a plugin credential. Your service signs a plugin JWT to obtain an installation token, then uses that Entire-issued token for repository work. Do not send the plugin JWT directly to the region API.

[Building a Plugin](https://docs.entire.com/guides/api/plugins/overview.md) covers registration, customer installation and runtime requests. Plugins remain available to selected partners only.

## Plugin JWTs

Sign a fresh JWT for each call, or reuse one for a few minutes:

| Claim | Value |
| :- | :- |
| `iss` | Your registered issuer, normally `urn:entire:plugin:{slug}`. |
| `aud` | The regional Core authentication origin, followed by `/api/authz/sts`. For example `https://us.auth.entire.io/api/authz/sts`. |
| `plugin_id` | Your slug. |
| `installation_id` | The installation you are acting for. |
| `iat` | Now, minus 30 seconds. Core allows no clock skew on this claim. |
| `exp` | Use no more than 5 minutes after `iat`. Core enforces a 10-minute maximum for both PEM and JWKS registrations. |

Header: `"alg": "EdDSA"`, and `"kid"` when you registered a JWKS URL.

## Access tokens

An installation access token is separate from both an own-account bearer and a plugin OAuth user access token. Mint one with the [access-tokens endpoint](https://docs.entire.com/guides/api/plugins/act-for-an-installation.md#mint-an-access-token). What the token can reach depends on what you ask for:

| You request | You get |
| :- | :- |
| A `repository_id` and some permissions | A token for that repository alone, with only those permissions. Prefer this. |
| No repository, and every effective permission accepted by the installation | A token for every selected repository, with those permissions, including `repositories:create` when registered and accepted. Treat it as the whole installation's authority. |
| No repository, and only `{"installations": "read"}` | A token that reaches no repository. |
| No repository, and only `{"repositories": "create"}` | A token that reaches no repository. It can only [create repositories](https://docs.entire.com/guides/api/plugins/act-for-an-installation.md#create-a-repository) in the installation's project. |
| A `repository_id` and `repositories:create` | `400 invalid_request`. Creating is never scoped to a repository. |
| No repository, and another otherwise valid permission subset | `400 repository_required`. |

Requested repository and project capabilities must be covered by the plugin's registered permissions and the installation's accepted permissions. The built-in `installations:read` permission is available to every installation. A newly registered capability awaiting customer acceptance returns `403 permission_not_accepted`; registration alone does not upgrade existing grants. `409 coverage_changed` instead describes a coverage or grant race during minting.

Hand only a token scoped to one repository to code you trust less than your service, such as a customer's build job.

Cache tokens until shortly before they expire. Entire limits how many tokens one installation can mint, and answers `429 rate_limited` with a `Retry-After` header, in seconds, when you exceed it.

Send credentials only to trusted Core origins or a repository `api_base_url` returned by Entire, with the validation appropriate to your flow. See [Regions and routing](https://docs.entire.com/guides/api/regions-and-routing.md).

## Plugin OAuth user access tokens

Use the [user OAuth flow](https://docs.entire.com/guides/api/plugins/user-oauth-flow.md) when your service needs to discover a user's accessible installations and repositories. Its access token has audience `entire:plugin-api` and is accepted on the two plugin user routes documented there. It cannot read repository contents or mint installation tokens.

For runtime work, use your plugin JWT to mint an installation token. Recheck the user's access before later actions performed for that user. OAuth client assertions, ID tokens, refresh tokens and install receipts each have their own protocol role; none substitutes for an endpoint's accepted bearer.
