<!--
{
  "documentType" : "article",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/obtaining-an-api-token-for-an-icloud-container",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Obtaining an API Token for an iCloud Container"
}
-->

# Obtaining an API Token for an iCloud Container

Generate an API token to access CloudKit web services or use CloudKit JS.

## Discussion

With CloudKit, you can store data in iCloud and sync it across Apple devices. To access iCloud data from the web or other platforms, you can use <doc://com.apple.documentation/documentation/CloudKitJS> or [CloudKit Web Services](https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/) after obtaining a token.

### Select API access for your container

Use your web browser to access the CloudKit Database app:

1. Sign in to the CloudKit Console at <https://icloud.developer.apple.com/>.
2. Select the CloudKit Database app.
3. In the top section, choose your app’s container from the list.
4. In the Settings section on the left, select Tokens & Keys.

![A screenshot showing a selected container in the CloudKit Database app. The screenshot highlights the Tokens & Keys menu item in the Settings section on the left.](images/com.apple.cloudkit/media-3699104@2x.png)

### Create the API token

To obtain your container’s API token:

1. From the Tokens & Keys section for your container, click the New API Token button. The detail area in the right panel shows an entry form for the new token.
2. Enter the name for the API token.
3. To specify a custom URL to load after the user signs in using their Apple ID, choose URL Redirect and http:// from the Sign in Callback field and enter a custom URL.
4. To restrict the domains that can access your app’s container using CloudKit web services, choose “Only the following domain(s) from the Allowed Origins field”, and enter a domain.
5. To add a description, type it in the Notes field.
6. Click the Save Changes button.

![A screenshot showing the CloudKit Database app API access management page the for selected container.](images/com.apple.cloudkit/media-3699263@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)