Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-contacts`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/contacts/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
Section titled “Install”bun add @capgo/capacitor-contactsbunx cap syncImport
Section titled “Import”import { CapacitorContacts } from '@capgo/capacitor-contacts';API Overview
Section titled “API Overview”countContacts
Section titled “countContacts”Count the total number of contacts on the device.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.countContacts();createContact
Section titled “createContact”Create a new contact programmatically.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createContact({} as CreateContactOptions);createGroup
Section titled “createGroup”Create a new contact group.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.createGroup({} as CreateGroupOptions);deleteContactById
Section titled “deleteContactById”Delete a contact by ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteContactById({} as DeleteContactByIdOptions);deleteGroupById
Section titled “deleteGroupById”Delete a group by ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.deleteGroupById({} as DeleteGroupByIdOptions);displayContactById
Section titled “displayContactById”Display a contact using the native contact viewer.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayContactById({} as DisplayContactByIdOptions);displayCreateContact
Section titled “displayCreateContact”Display the native create contact UI.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayCreateContact();displayUpdateContactById
Section titled “displayUpdateContactById”Display the native update contact UI for a specific contact.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.displayUpdateContactById({} as DisplayUpdateContactByIdOptions);getAccounts
Section titled “getAccounts”Get all accounts available on the device.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getAccounts();getContactById
Section titled “getContactById”Get a specific contact by ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContactById({} as GetContactByIdOptions);getContacts
Section titled “getContacts”Get all contacts from the device.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getContacts();getGroupById
Section titled “getGroupById”Get a specific group by ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroupById({} as GetGroupByIdOptions);getGroups
Section titled “getGroups”Get all contact groups.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.getGroups();isAvailable
Section titled “isAvailable”Check if contacts are available on the device.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isAvailable();isSupported
Section titled “isSupported”Check if the plugin is supported on the current platform.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.isSupported();openSettings
Section titled “openSettings”Open the device’s contacts settings.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.openSettings();pickContact
Section titled “pickContact”Pick a single contact using the native contact picker.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContact();pickContacts
Section titled “pickContacts”Pick one or more contacts using the native contact picker.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.pickContacts();updateContactById
Section titled “updateContactById”Update an existing contact by ID.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.updateContactById({} as UpdateContactByIdOptions);checkPermissions
Section titled “checkPermissions”Check the current permission status for contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.checkPermissions();requestPermissions
Section titled “requestPermissions”Request permissions to access contacts.
import { CapacitorContacts } from '@capgo/capacitor-contacts';
await CapacitorContacts.requestPermissions();Type Reference
Section titled “Type Reference”CountContactsResult
Section titled “CountContactsResult”Result from counting contacts.
export interface CountContactsResult { /** * Total number of contacts. * * @since 1.0.0 */ count: number;}CreateContactOptions
Section titled “CreateContactOptions”Options for creating a contact.
export interface CreateContactOptions { /** * Contact information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ contact: Omit<Contact, 'id'>;}CreateContactResult
Section titled “CreateContactResult”Result from creating a contact.
export interface CreateContactResult { /** * The ID of the newly created contact. * * @since 1.0.0 */ id: string;}CreateGroupOptions
Section titled “CreateGroupOptions”Options for creating a group.
export interface CreateGroupOptions { /** * Group information to create. The 'id' field will be generated automatically. * * @since 1.0.0 */ group: Omit<Group, 'id'>;}CreateGroupResult
Section titled “CreateGroupResult”Result from creating a group.
export interface CreateGroupResult { /** * The ID of the newly created group. * * @since 1.0.0 */ id: string;}DeleteContactByIdOptions
Section titled “DeleteContactByIdOptions”Options for deleting a contact by ID.
export interface DeleteContactByIdOptions { /** * The ID of the contact to delete. * * @since 1.0.0 */ id: string;}DeleteGroupByIdOptions
Section titled “DeleteGroupByIdOptions”Options for deleting a group by ID.
export interface DeleteGroupByIdOptions { /** * The ID of the group to delete. * * @since 1.0.0 */ id: string;}DisplayContactByIdOptions
Section titled “DisplayContactByIdOptions”Options for displaying a contact by ID.
export interface DisplayContactByIdOptions { /** * The ID of the contact to display. * * @since 1.0.0 */ id: string;}DisplayCreateContactOptions
Section titled “DisplayCreateContactOptions”Options for displaying the native create contact UI.
export interface DisplayCreateContactOptions { /** * Optional pre-filled contact information for the create UI. * * @since 1.0.0 */ contact?: Omit<Contact, 'id'>;}DisplayCreateContactResult
Section titled “DisplayCreateContactResult”Result from displaying the native create contact UI.
export interface DisplayCreateContactResult { /** * The ID of the created contact, if one was created. Undefined if the user cancelled. * * @since 1.0.0 */ id?: string;}DisplayUpdateContactByIdOptions
Section titled “DisplayUpdateContactByIdOptions”Options for displaying the native update contact UI.
export interface DisplayUpdateContactByIdOptions { /** * The ID of the contact to update. * * @since 1.0.0 */ id: string;}GetAccountsResult
Section titled “GetAccountsResult”Result from getting accounts.
export interface GetAccountsResult { /** * List of accounts available on the device. * * @since 1.0.0 */ accounts: Account[];}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.