---
title: discoveryToken
framework: nearbyinteraction
role: symbol
role_heading: Instance Property
path: nearbyinteraction/nisession/discoverytoken
---

# discoveryToken

A temporary, random identifier for a device.

## Declaration

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

## Mentioned in

Initiating and maintaining a session Discovering peers with Multipeer Connectivity

## Discussion

Discussion NI sets this property when an app initializes a session. The value of 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 Multipeer Connectivity, see Implementing interactions between users in close proximity.

## See Also

### Connecting to a peer device

- [NIDiscoveryToken](nearbyinteraction/nidiscoverytoken.md)
- [run(_:)](nearbyinteraction/nisession/run(_:).md)
- [configuration](nearbyinteraction/nisession/configuration.md)
- [delegateQueue](nearbyinteraction/nisession/delegatequeue.md)
