<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "watchOS: 7.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NearbyInteraction",
  "identifier" : "/documentation/NearbyInteraction/NISession/discoveryToken",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Nearby Interaction"
    ],
    "preciseIdentifier" : "c:objc(cs)NISession(py)discoveryToken"
  },
  "title" : "discoveryToken"
}
-->

# discoveryToken

A temporary, random identifier for a device.

```
@NSCopying var discoveryToken: NIDiscoveryToken? { get }
```

## Discussion

NI sets this property when an app initializes a session. The value of [`discoveryToken`](/documentation/NearbyInteraction/NINearbyObject/discoveryToken) is unique to the session and identifies the device that created the session.

To begin a session, an app shares this object with a nearby peer using a network technology that both devices agree to. For an example that shares discovery tokens using <doc://com.apple.documentation/documentation/MultipeerConnectivity>, see [Implementing interactions between users in close proximity](/documentation/NearbyInteraction/implementing-interactions-between-users-in-close-proximity).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)