@capacitor/contacts
Access, search, pick, create, update and remove device contacts.
Install
To use npm
npm install @capacitor/contacts
To use yarn
yarn add @capacitor/contacts
Sync native files
npx cap sync
iOS
Add the NSContactsUsageDescription key to your app's Info.plist and
describe why the app accesses the user's contacts; iOS crashes on first
contacts access without it:
<key>NSContactsUsageDescription</key>
<string>We need access to contacts to search, save and remove them.</string>
Notes:
- The plugin uses the modern Contacts framework (
CNContactStore, never the deprecated AddressBook APIs), so it fully supports iOS 18+ Limited Access:find,saveandremoveoperate on the subset the user shared with the app, andpickContactpresents the system picker (which needs no permission and always shows the full contact list). - The
notefield is not supported on iOS: reading or writing it requires Apple's restrictedcom.apple.developer.contacts.notesentitlement. The field is omitted on read and ignored on save. - Contact
ids are opaqueCNContactidentifiers; ids persisted by the legacy AddressBook-based Cordova plugin do not resolve after migration.
Android
The plugin declares READ_CONTACTS and WRITE_CONTACTS in its own
manifest; Gradle manifest merging adds them to your app automatically. Each
method requests the runtime permission it needs the first time it runs;
read for find/pickContact, read + write for save/remove.
Permission model
This plugin intentionally exposes no checkPermissions() /
requestPermissions() methods: permissions are requested implicitly by each
method, matching the legacy cordova-plugin-contacts behavior. A call
rejects with OS-PLUG-CONT-0020 when the user denies access.
Errors
Every rejection carries a structured code + message:
| Code | Meaning |
|---|---|
OS-PLUG-CONT-0000 | Unknown error |
OS-PLUG-CONT-0001 | Invalid argument (e.g. unknown id) |
OS-PLUG-CONT-0002 | Timeout (reserved, currently unused) |
OS-PLUG-CONT-0003 | Pending operation (e.g. picker already open) |
OS-PLUG-CONT-0004 | I/O error |
OS-PLUG-CONT-0005 | Not supported |
OS-PLUG-CONT-0006 | Operation cancelled (picker closed) |
OS-PLUG-CONT-0020 | Permission denied |