> For the complete documentation index, see [llms.txt](https://docs.podplay.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podplay.app/api/api-keys-vs-bearer-tokens.md).

# API Keys vs Bearer Tokens

When starting to consume our API, one of the most common sources of confusion is the authentication method to use.

There are two types of tokens you may encounter:

* API keys
* Bearer tokens

Although both are used in HTTP requests, they serve different purposes.

### API Keys (Recommended for Integrations)

The correct way to authenticate server-to-server integrations with our API is by using an **API Key**.

To obtain an API key, please request one from an administrator of the Podplay application you are integrating with.

An API key is a long string of characters, for example:

```
eyJhbGci...KHxazjNpg
```

API keys:

* Do not expire
* Are intended for backend integrations
* Should be stored securely (e.g., environment variables, secrets manager)
* Must never be exposed in frontend code

Because API keys do not expire, it is important to follow security best practices to keep them safe.

### Bearer Tokens (Not for integrations)

Bearer tokens are typically used for authenticating users within the Podplay application.

You may see these tokens in your browser’s developer tools while using the application. However, these tokens:

* Are short-lived
* Expire after a limited time
* Are meant for user session authentication

They are **not suitable for long-running integrations**.

If you attempt to use a bearer token for an integration, it may work temporarily but will fail once the token expires.

For integrations, always use an API key.


---

# 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.podplay.app/api/api-keys-vs-bearer-tokens.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.
