# getContactKey

Returns the contact key currently set on the device.

## Syntax

```javascript
MCReactModule.getContactKey() ⇒ Promise.<string?>
```

## Returns

- `Promise.<string?>` - A promise to the current contact key.

## Example

```javascript
import { MCReactModule } from "react-native-marketingcloudsdk";

const getCurrentContactKey = async () => {
  try {
    const contactKey = await MCReactModule.getContactKey();
    if (contactKey) {
      console.log("Current contact key:", contactKey);
    } else {
      console.log("No contact key set");
    }
  } catch (error) {
    console.error("Error getting contact key:", error);
  }
};
```

## See Also

- [setContactKey() Method](/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/react_setContactKey.md)
- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/MarketingCloudSdk/8.0/-marketing%20-cloud%20-s-d-k/com.salesforce.marketingcloud.registration/-registration-manager/get-contact-key.html)
- *SDK Reference for iOS*: [contactKey() Method](/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/marketingcloudsdk.md#contactkey)
