> For the complete documentation index, see [llms.txt](https://docs.e6data.com/query-engine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.e6data.com/query-engine/guides/security/access-tokens/pat-and-service-account-keys.md).

# Personal access tokens and service account keys

The two e6data credential types in detail - personal access tokens and service account keys - their formats and when to use each.

e6data has two credential types. This page covers each in detail; for the at-a-glance comparison, see the canonical table in [Access tokens](/query-engine/guides/security/access-tokens.md#token-types). For step-by-step creation, see [Create, use, rotate, and revoke tokens](/query-engine/guides/security/access-tokens/create-use-rotate-revoke.md).

| Type                        | Prefix   | Identity                            | Authorization               |
| --------------------------- | -------- | ----------------------------------- | --------------------------- |
| Personal Access Token (PAT) | `e6pat_` | A human user                        | The user's roles            |
| Service Account API key     | `e6sa_`  | A workspace-scoped machine identity | The service account's roles |

## Personal access tokens (`e6pat_`)

A PAT authenticates the API **as you** and inherits exactly your roles in the workspace. Use a PAT for your own scripts, notebooks, and BI tool connections.

* **When to use:** connecting a BI tool over JDBC, calling the REST API from a personal script, running a notebook. For CI/CD or shared automation, use a service account instead - a PAT is revoked when your account is deprovisioned, which would break the automation.
* **Where to create:** **User settings → Access tokens**. Set a name and an expiry; the value is shown once.
* **Use:** username = your e6data email, password = the PAT; or send `Authorization: Bearer <PAT>`.
* **Audit:** PAT-authenticated requests appear in Run History (with the PAT name as the access method).

## Service account keys (`e6sa_`)

A service account is a non-human identity **scoped to a single workspace**, authenticating with an `e6sa_` API key and governed by the same roles as users. Use it for CI/CD and scheduled jobs.

The token format is `e6sa_<workspace>_<keyId>_<secret>` - the prefix is checked before any lookup, the workspace segment scopes it, and the secret is shown once. A service account can hold multiple keys (rotate freely); deleting the account revokes all its keys and removes its bindings. Service accounts are created and managed as described in [Users, groups, and service accounts](/query-engine/guides/security/identity-and-rbac/users-groups-service-accounts.md).

Grant a service account the minimum role it needs, use one per system, and rotate keys with create-before-delete. See [Token security best practices](/query-engine/guides/security/access-tokens/token-security-best-practices.md).

## See also

* [Access tokens](/query-engine/guides/security/access-tokens.md) - the canonical token-types table.
* [Create, use, rotate, and revoke tokens](/query-engine/guides/security/access-tokens/create-use-rotate-revoke.md)
* [Token security best practices](/query-engine/guides/security/access-tokens/token-security-best-practices.md)
* [Users, groups, and service accounts](/query-engine/guides/security/identity-and-rbac/users-groups-service-accounts.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.e6data.com/query-engine/guides/security/access-tokens/pat-and-service-account-keys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
