---
title: "Authentication"
slug: "authentication-1523482"
abstract: "How to create API keys."
---
# Authentication

To access the [Preview](https://doc.sitecore.com/ch/en/developers/cloud-dev/preview-api.html "Preview API") and [Delivery](https://doc.sitecore.com/ch/en/developers/cloud-dev/delivery-api.html "Delivery API") APIs, you need an API key. Before you create an API key for the first time, you must:

1. [Enable content publishing](https://doc.sitecore.com/ch/en/users/content-hub/configure-the-publishing-settings.html).
2. [Publish your schema](https://doc.sitecore.com/ch/en/users/content-hub/publish-and-unpublish-an-entity-definition.html).
3. Wait for background processes to finish.

> [!note]
> An authentication key is static and does not expire, but can be revoked.

When creating an API key, you can give it a scope to limit which content a user can access.

| Scope | Description |
| --- | --- |
| Audience | This determines which API the key grants access to. Use `audience-preview` to access the Preview API, or `audience-delivery` to access the Delivery API. |
| Content | This provides top-level query access to the entity identified by the ID in the [scope parameter](https://doc.sitecore.com/ch/en/developers/cloud-dev/create.html), which is everything following the `content-` prefix. For example, accessing a content collection with the ID *fruitful* requires the scope `content-#fruitful#`. The `content-#everything#` scope allows access to all content. |

> [!important]
> When you generate an API key, you should define at least one *audience* scope and one *content* scope.

You can create an API key [using the Token API](https://doc.sitecore.com/ch/en/developers/cloud-dev/create.html "Create") or from Sitecore Content Hub. In Content Hub, you can create an API key from the:

- [**Manage** page](https://doc.sitecore.com/ch/en/developers/cloud-dev/create-an-api-key-from-the-manage-page.html "Create an API key from the Manage page"). API keys created from the **Manage** page have a `content-#everything#` scope.
- [Content collection details page](https://doc.sitecore.com/ch/en/developers/cloud-dev/create-an-api-key-for-a-content-collection.html "Create an API key for a content collection"). API keys created from a content collection details page have a `content-` scope limited to that content collection.