<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKDatabase/fetch(withRecordID:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKDatabase(im)fetchRecordWithID:completionHandler:"
  },
  "title" : "fetch(withRecordID:completionHandler:)"
}
-->

# fetch(withRecordID:completionHandler:)

Fetches a specific record.

```
func fetch(withRecordID recordID: CKRecord.ID, completionHandler: @escaping @Sendable (CKRecord?, (any Error)?) -> Void)
```

## Parameters

`recordID`

The identifier of the record to fetch.

`completionHandler`

The closure to execute with the fetch results.

## Discussion

The completion handler takes the following parameters:

- The requested record, or `nil` if CloudKit can’t provide that record.
- An error if a problem occurs, or `nil` if the fetch completes successfully.

For information on a more convenient way to fetch specific records, see [`records(for:desiredKeys:)`](/documentation/CloudKit/CKDatabase/records(for:desiredKeys:)).

---

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)