<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CloudKitJS",
  "identifier" : "/documentation/CloudKitJS/CloudKit",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CloudKit JS"
    ],
    "preciseIdentifier" : "cl/CloudKit"
  },
  "title" : "CloudKit"
}
-->

# CloudKit

Use the `CloudKit` namespace to configure CloudKit JS, and to access app containers and global constants.

```
interface CloudKit
```

## Overview

Set up CloudKit JS by passing container and authentication information to the [`configure`](/documentation/CloudKitJS/CloudKit/configure) method. Also, specify whether to use the development or production environment. You’ll need the container ID and API token to configure CloudKit JS. (Use CloudKit Dashboard to create an API token, as described in [Accessing CloudKit Using an API Token](https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/SettingUpWebServices.html#//apple_ref/doc/uid/TP40015240-CH24-SW2).) Some operations require users to enter their Apple ID credentials. Apple presents the sign-in dialog, but you can customize the position and theme of the sign-in and sign-out buttons.

After configuring CloudKit JS, use the container methods to get the app’s container objects ([`CloudKit.Container`](/documentation/CloudKitJS/CloudKit.Container)), and from the container objects, get the database objects ([`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database)).

## Topics

### Configuring CloudKit JS

[`configure`](/documentation/CloudKitJS/CloudKit/configure)

Configures CloudKit JS.

### Accessing Containers

[`getDefaultContainer`](/documentation/CloudKitJS/CloudKit/getDefaultContainer)

Returns the default container.

[`getContainer`](/documentation/CloudKitJS/CloudKit/getContainer)

Returns the container with the specified container ID.

[`getAllContainers`](/documentation/CloudKitJS/CloudKit/getAllContainers)

Returns all the containers that were configured.

### Constants

[CloudKit Build Version and Status](/documentation/CloudKitJS/cloudkit-build-version-and-status)

Constants describing the environment that stores the containers.

[Environments](/documentation/CloudKitJS/environments)

Constants to use when configuring the environment of containers.

### Enumerations

[`CloudKit.AppleIDButtonTheme`](/documentation/CloudKitJS/CloudKit.AppleIDButtonTheme)

Specifies the look of the Apple ID button.

[`CloudKit.DatabaseScope`](/documentation/CloudKitJS/CloudKit.DatabaseScope)

Available database scopes.

[`CloudKit.QueryFilterComparator`](/documentation/CloudKitJS/CloudKit.QueryFilterComparator)

The comparators you use to create queries.

[`CloudKit.ReferenceAction`](/documentation/CloudKitJS/CloudKit.ReferenceAction)

The delete action for a reference object.

[`CloudKit.ShareParticipantAcceptanceStatus`](/documentation/CloudKitJS/CloudKit.ShareParticipantAcceptanceStatus)

The status of a participant accepting a share invitation.

[`CloudKit.ShareParticipantPermission`](/documentation/CloudKitJS/CloudKit.ShareParticipantPermission)

The status of a participant accepting a share invitation.

[`CloudKit.ShareParticipantType`](/documentation/CloudKitJS/CloudKit.ShareParticipantType)

Determines whether a participant can modify the list of participants of a shared record.

[`CloudKit.SubscriptionType`](/documentation/CloudKitJS/CloudKit.SubscriptionType)

The type of subscription.

### Properties

[`CKError`](/documentation/CloudKitJS/CloudKit/CKError)

Property to access the error codes.

[`DatabaseScope`](/documentation/CloudKitJS/CloudKit/DatabaseScope)

Property to access the enumeration.

[`Promise`](/documentation/CloudKitJS/CloudKit/Promise)

Represents an operation that hasn’t completed yet, but is expected in the future.

[`QueryFilterComparator`](/documentation/CloudKitJS/CloudKit/QueryFilterComparator)

Property to access the enumeration.

[`ReferenceAction`](/documentation/CloudKitJS/CloudKit/ReferenceAction)

Property to access the enumeration.

[`ShareParticipantAcceptanceStatus`](/documentation/CloudKitJS/CloudKit/ShareParticipantAcceptanceStatus)

Property to access the enumeration.

[`ShareParticipantPermission`](/documentation/CloudKitJS/CloudKit/ShareParticipantPermission)

Property to access the enumeration.

[`ShareParticipantType`](/documentation/CloudKitJS/CloudKit/ShareParticipantType)

Property to access the enumeration.

[`ShareRecordType`](/documentation/CloudKitJS/CloudKit/ShareRecordType)

Property to access the class instance.

[`SubscriptionType`](/documentation/CloudKitJS/CloudKit/SubscriptionType)

Property to access the enumeration.

### Classes

[`CloudKit.CKError`](/documentation/CloudKitJS/CloudKit.CKError)

A [`CloudKit.CKError`](/documentation/CloudKitJS/CloudKit.CKError) object encapsulates an error that may occur when you use CloudKit JS. This includes CloudKit server errors and local errors.

[`CloudKit.Container`](/documentation/CloudKitJS/CloudKit.Container)

A [`CloudKit.Container`](/documentation/CloudKitJS/CloudKit.Container) object provides access to an app container, and through the app container, access to its databases. It also contains methods for authenticating and fetching users.

[`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database)

A [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database) object represents a public or private database in an app container.

[`CloudKit.DatabaseChangesResponse`](/documentation/CloudKitJS/CloudKit.DatabaseChangesResponse)

A [`CloudKit.DatabaseChangesResponse`](/documentation/CloudKitJS/CloudKit.DatabaseChangesResponse) object encapsulates the results of fetching changed record zones in a database.

[`CloudKit.Notification`](/documentation/CloudKitJS/CloudKit.Notification)

A [`CloudKit.Notification`](/documentation/CloudKitJS/CloudKit.Notification) object represents a push notification that was sent to your app. Notifications are triggered by subscriptions that you save to the database. To subscribe to record changes and handle push notifications, see the `saveSubscription` method in [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database).

[`CloudKit.QueryNotification`](/documentation/CloudKitJS/CloudKit.QueryNotification)

A [`CloudKit.QueryNotification`](/documentation/CloudKitJS/CloudKit.QueryNotification) object represents a push notification that was generated by a subscription object. A query notification is triggered by subscriptions where the `subscriptionType` key is `query`. Use a [`CloudKit.QueryNotification`](/documentation/CloudKitJS/CloudKit.QueryNotification) object to get information about the record that changed. To create query subscriptions and handle push notifications, see the [`saveSubscriptions`](/documentation/CloudKitJS/CloudKit.Database/saveSubscriptions) method in [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database).

[`CloudKit.QueryResponse`](/documentation/CloudKitJS/CloudKit.QueryResponse)

A [`CloudKit.QueryResponse`](/documentation/CloudKitJS/CloudKit.QueryResponse) object encapsulates the results of using a query to fetch records

[`CloudKit.RecordInfosResponse`](/documentation/CloudKitJS/CloudKit.RecordInfosResponse)

A [`CloudKit.RecordInfosResponse`](/documentation/CloudKitJS/CloudKit.RecordInfosResponse) object encapsulates the results of fetching information about records in general and shared records in particular.

[`CloudKit.RecordsBatchBuilder`](/documentation/CloudKitJS/CloudKit.RecordsBatchBuilder)

A [`CloudKit.RecordsBatchBuilder`](/documentation/CloudKitJS/CloudKit.RecordsBatchBuilder) object encapsulates the results of changes to multiple records in a single database operation.

[`CloudKit.RecordsResponse`](/documentation/CloudKitJS/CloudKit.RecordsResponse)

A [`CloudKit.RecordsResponse`](/documentation/CloudKitJS/CloudKit.RecordsResponse) object encapsulates the results of fetching records.

[`CloudKit.RecordZoneChangesResponse`](/documentation/CloudKitJS/CloudKit.RecordZoneChangesResponse)

The [`CloudKit.RecordZoneChangesResponse`](/documentation/CloudKitJS/CloudKit.RecordZoneChangesResponse) object encapsulates the results of fetching changes to one or more record zones.

[`CloudKit.RecordZoneNotification`](/documentation/CloudKitJS/CloudKit.RecordZoneNotification)

A [`CloudKit.RecordZoneNotification`](/documentation/CloudKitJS/CloudKit.RecordZoneNotification) object represents a push notification that was caused by changes to the contents of a record zone. A zone notification is triggered by subscriptions where the `subscriptionType` key is `zone`. Use a [`CloudKit.RecordZoneNotification`](/documentation/CloudKitJS/CloudKit.RecordZoneNotification) object to get information about the record that changed. To create zone subscriptions and handle push notifications, see the [`saveSubscriptions`](/documentation/CloudKitJS/CloudKit.Database/saveSubscriptions) method in [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database).

[`CloudKit.RecordZonesResponse`](/documentation/CloudKitJS/CloudKit.RecordZonesResponse)

A [`CloudKit.RecordZonesResponse`](/documentation/CloudKitJS/CloudKit.RecordZonesResponse) object encapsulates the results of database operations on a record zone.

[`CloudKit.Response`](/documentation/CloudKitJS/CloudKit.Response)

The [`CloudKit.Response`](/documentation/CloudKitJS/CloudKit.Response) class is an abstract superclass for subclasses that encapsulate the response from server requests. Don’t create instances of this class. Instances of subclasses are returned by methods in the [`CloudKit.Container`](/documentation/CloudKitJS/CloudKit.Container) and [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database) classes. Most of these methods return a `Promise` object that resolves to a subclass of [`CloudKit.Response`](/documentation/CloudKitJS/CloudKit.Response) if the operation is successful.

[`CloudKit.ShareRecordType`](/documentation/CloudKitJS/CloudKit.ShareRecordType)

Display information about the record type of a shared record.

[`CloudKit.SubscriptionsResponse`](/documentation/CloudKitJS/CloudKit.SubscriptionsResponse)

A [`CloudKit.SubscriptionsResponse`](/documentation/CloudKitJS/CloudKit.SubscriptionsResponse) object encapsulates the results of database operations on subscriptions.

[`CloudKit.UserIdentitiesResponse`](/documentation/CloudKitJS/CloudKit.UserIdentitiesResponse)

A [`CloudKit.UserIdentitiesResponse`](/documentation/CloudKitJS/CloudKit.UserIdentitiesResponse) object encapsulates the results of fetching user identities.

### Structures

[`CloudKit.CloudKitConfig`](/documentation/CloudKitJS/CloudKit.CloudKitConfig)

Dictionary used to configure the CloudKit environment.

[`CloudKit.ContainerConfig`](/documentation/CloudKitJS/CloudKit.ContainerConfig)

A configuration for a container.

[`CloudKit.NameComponents`](/documentation/CloudKitJS/CloudKit.NameComponents)

The parts of the user’s name.

[`CloudKit.NotificationInfo`](/documentation/CloudKitJS/CloudKit.NotificationInfo)

Information about a notification.

[`CloudKit.Query`](/documentation/CloudKitJS/CloudKit.Query)

Search parameters to use when fetching records from the database.

[`CloudKit.Record`](/documentation/CloudKitJS/CloudKit.Record)

A record in the database.

[`CloudKit.RecordField`](/documentation/CloudKitJS/CloudKit.RecordField)

A field value of a record.

[`CloudKit.RecordInfo`](/documentation/CloudKitJS/CloudKit.RecordInfo)

Encapsulates the results of fetching information about a record.

[`CloudKit.RecordZone`](/documentation/CloudKitJS/CloudKit.RecordZone)

Represents a record zone.

[`CloudKit.RecordZoneChanges`](/documentation/CloudKitJS/CloudKit.RecordZoneChanges)

Represents the changes in a record zone.

[`CloudKit.RecordZoneChangesOptions`](/documentation/CloudKitJS/CloudKit.RecordZoneChangesOptions)

Options about fetching changes in a record zone.

[`CloudKit.Share`](/documentation/CloudKitJS/CloudKit.Share)

Represents a shared record.

[`CloudKit.ShareParticipant`](/documentation/CloudKitJS/CloudKit.ShareParticipant)

Represents a user who accepted a shared record.

[`CloudKit.SharingUIResult`](/documentation/CloudKitJS/CloudKit.SharingUIResult)

Represents the results of sharing a record with other users.

[`CloudKit.Subscription`](/documentation/CloudKitJS/CloudKit.Subscription)

A subscription, which is a persistent query on the server that tracks the creation, deletion, and modification of records.

[`CloudKit.UserIdentity`](/documentation/CloudKitJS/CloudKit.UserIdentity)

Information to identify a user.

[`CloudKit.UserLookupInfo`](/documentation/CloudKitJS/CloudKit.UserLookupInfo)

Information that can be used to fetch a user.

[`CloudKit.ZoneID`](/documentation/CloudKitJS/CloudKit.ZoneID)

An identifier for a zone, which is an area in a database for organizing related records.



---

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)