> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.addPhoneContact

> Add a contact to the user's phone.

Use this API to add a new contact to the user's phone contact list. The user will see a confirmation dialog before the contact is added.

## Parameters

| Property              | Type     | Required | Description                   |
| --------------------- | -------- | -------- | ----------------------------- |
| photoFilePath         | String   | No       | Local file path of avatar     |
| nickName              | String   | No       | Nickname                      |
| lastName              | String   | No       | Surname                       |
| middleName            | String   | No       | Middle name                   |
| firstName             | String   | No       | First name                    |
| remark                | String   | No       | Remarks                       |
| mobilePhoneNumber     | String   | No       | Cell number                   |
| addressCountry        | String   | No       | Country in contact address    |
| addressState          | String   | No       | Province in contact address   |
| addressCity           | String   | No       | City in contact address       |
| addressStreet         | String   | No       | Street in contact address     |
| addressPostalCode     | String   | No       | Postcode in contact address   |
| organization          | String   | No       | Company                       |
| title                 | String   | No       | Title                         |
| workFaxNumber         | String   | No       | Work fax                      |
| workPhoneNumber       | String   | No       | Work phone number             |
| hostNumber            | String   | No       | Company phone number          |
| email                 | String   | No       | Email                         |
| url                   | String   | No       | Website                       |
| workAddressCountry    | String   | No       | Country in work address       |
| workAddressState      | String   | No       | Province in work address      |
| workAddressCity       | String   | No       | City in work address          |
| workAddressStreet     | String   | No       | Street in work address        |
| workAddressPostalCode | String   | No       | Postcode in work address      |
| homeFaxNumber         | String   | No       | Home fax                      |
| homePhoneNumber       | String   | No       | Home phone                    |
| homeAddressCountry    | String   | No       | Country in home address       |
| homeAddressState      | String   | No       | Province in home address      |
| homeAddressCity       | String   | No       | City in home address          |
| homeAddressStreet     | String   | No       | Street in home address        |
| homeAddressPostalCode | String   | No       | Postcode in home address      |
| success               | Function | No       | Callback on success           |
| fail                  | Function | No       | Callback on failure           |
| complete              | Function | No       | Callback that always executes |

## Error Codes

| Error | Message         | Description                                             |
| ----- | --------------- | ------------------------------------------------------- |
| 11    | fail cancel     | The user cancels the operation.                         |
| 3     | fail \${detail} | Call failure, detail includes the detailed information. |

## Code Example

### Basic Usage

```javascript theme={null}
my.addPhoneContact({
  firstName: 'John',
  lastName: 'Doe',
  mobilePhoneNumber: '+1234567890',
  success() {
    my.showToast({ content: 'Contact added' });
  }
});
```

### Business Contact

```javascript theme={null}
my.addPhoneContact({
  firstName: 'Jane',
  lastName: 'Smith',
  mobilePhoneNumber: '+1234567890',
  workPhoneNumber: '+1987654321',
  email: 'jane.smith@example.com',
  organization: 'Acme Corporation',
  title: 'Sales Manager',
  workAddressStreet: '123 Business Ave',
  workAddressCity: 'New York',
  workAddressState: 'NY',
  workAddressPostalCode: '10001',
  workAddressCountry: 'USA',
  success() {
    my.showToast({ content: 'Contact saved successfully' });
  },
  fail(err) {
    my.showToast({ content: 'Failed to save contact', type: 'fail' });
  }
});
```

### Add Store Contact

```javascript theme={null}
Page({
  data: {
    store: {
      name: 'Downtown Store',
      phone: '+1234567890',
      address: '456 Main Street',
      city: 'Los Angeles'
    }
  },

  saveStoreContact() {
    const { store } = this.data;
    my.addPhoneContact({
      firstName: store.name,
      mobilePhoneNumber: store.phone,
      workAddressStreet: store.address,
      workAddressCity: store.city,
      remark: 'Added from Mini Program',
      success() {
        my.showToast({ content: 'Store contact saved' });
      }
    });
  }
});
```

<Tip>
  The user will always see a system confirmation dialog before the contact is actually added. This protects user privacy and prevents unwanted contacts.
</Tip>

## Related APIs

<CardGroup cols={2}>
  <Card title="my.choosePhoneContact" icon="address-book" href="/jsapi/ui/contact/my.choosePhoneContact">
    Choose from contacts
  </Card>

  <Card title="my.makePhoneCall" icon="phone" href="/jsapi/device/phone-call/my.makePhoneCall">
    Make phone call
  </Card>
</CardGroup>
