<!--
{
  "availability" : [
    "iOS: 18.1.0 -",
    "iPadOS: 18.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecureElementCredential",
  "identifier" : "/documentation/SecureElementCredential/CredentialSession/startSession()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SecureElementCredential"
    ],
    "preciseIdentifier" : "s:23SecureElementCredential0C7SessionC05startD0ACyYaKFZ"
  },
  "title" : "startSession()"
}
-->

# startSession()

Requests a session to view, manage, or use credentials in the Secure Element.

```
static func startSession() async throws -> CredentialSession
```

## Discussion

To start a session from an app, the app needs to be in the foreground.

Apps and app extensions that create credential sessions must have the  <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.secure-element-credential> entitlement. If your app or app extension lacks this entitlement, calls to [`SecureElementCredential`](/documentation/SecureElementCredential) APIs raise <doc://com.apple.documentation/documentation/Swift/fatalError(_:file:line:)>.

If you want to make your app or app extension eligible to be the system’s default contactless app, you need the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.secure-element-credential.default-contactless-app> entitlement as well.

> Note: If your app extension is an identity credential provider, use <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.identity-document-services.document-provider.mobile-document-types> to include your mobile document provider app extension in the picker when someone using the device receives a web request to present their provisioned identity credential. See <doc://com.apple.documentation/documentation/IdentityDocumentServices/Implenting-as-an-identity-document-provider> for more information about using this entitlement.

This method is asynchronous, which requires that you call it with the `await` keyword. When the system is ready to provide the session resource, the following events occur:

- The person using the app receives a GDPR privacy information sheet.
- The first time the app tries to access a credential session, the person using the app receives an alert to allow usage of the Secure Element. If they accept, the session proceeds normally. If they decline, the session invalidates and new sessions for this app fail immediately. To create a valid session, the person using the app needs to allow Secure Element access for the app in Settings.

Sessions start in the [`CredentialSession.State.management`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/management) state. An app can have only one active session at a time. When your app no longer needs the credential session, call [`invalidate()`](/documentation/SecureElementCredential/CredentialSession/invalidate()). If your app goes into the background, the system automatically invalidates your session after a short delay.

- The most common errors are:
  - [`CredentialSession.ErrorCode.resourceUnavailable`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/resourceUnavailable): The system service is temporarily unavailable.
  - [`CredentialSession.ErrorCode.accessDenied`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/accessDenied): The user declined to grant access to the Secure Element.
  - [`CredentialSession.ErrorCode.ineligible`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/ineligible): The device or user configuration doesn’t support this service.
  - [`CredentialSession.ErrorCode.conditionsNotSatisfied`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/conditionsNotSatisfied): The iCloud account or passcode conditions aren’t met.

---

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)