---
title: fetchRecords
framework: CloudKit JS
role: symbol
role_heading: Instance Method
platforms: [cloudkit js 1.0+]
path: cloudkitjs/cloudkit.database/fetchrecords
---

# fetchRecords

Fetches one or more records.

## Declaration

```data
Promise<CloudKit.RecordsResponse, CloudKit.CKError> fetchRecords(
	CloudKit.Record|CloudKit.Record[]|String|String[] records,
	optional Object options
);
```

## Parameters

- `records`: Possible values are: | | | | |
- `options`: A dictionary containing options to use when fetching records. Possible dictionary keys are: | | | |

## Return Value

Return Value A Promise object that resolves to a CloudKit.RecordsResponse object if the operation succeeds; otherwise, a CKError object.

## Discussion

Discussion To get the fetched record, use the records property in the CloudKit.RecordsResponse class. database.fetchRecords('115').then(function(response) {     if (response.hasErrors) {         // Insert error handling         throw response.errors[0];     } else {         // Insert successfully fetched record         var fetchedRecord = response.records[0];     } }); Similar to the saveRecords method, if you don’t specify a zone ID in the options parameter, the records are fetched from the default zone. To fetch records from a specific zone, pass a dictionary with the zoneID key set to the name of your zone. database.fetchRecords('115', { zoneID: 'myZone' }).then(function(response) {     // … }

## See Also

### Accessing Records

- [saveRecords](cloudkitjs/cloudkit.database/saverecords.md)
- [deleteRecords](cloudkitjs/cloudkit.database/deleterecords.md)
- [performQuery](cloudkitjs/cloudkit.database/performquery.md)
- [newRecordsBatch](cloudkitjs/cloudkit.database/newrecordsbatch.md)
