---
title: "saveCredentialIdentities(_:completion:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/ascredentialidentitystore/savecredentialidentities(_:completion:)-5vs4m"
---

# saveCredentialIdentities(_:completion:)

Saves the given credential identities to the store.

## Declaration

```swift
func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity], completion: (@Sendable (Bool, (any Error)?) -> Void)? = nil)
```

```swift
func saveCredentialIdentities(_ credentialIdentities: [ASPasswordCredentialIdentity]) async throws
```

## Parameters

- `credentialIdentities`: An array of doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASPasswordCredentialIdentity objects to save to the store.
- `completion`: An optional completion handler to be called after adding the credential identities. If the operation fails, an error with domain doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASCredentialIdentityStoreErrorDomain will be provided and none of the objects in credentialIdentities are saved to the store.

## Discussion

Discussion If the store supports incremental updates, call this method to add new credential identities since the last time the store was updated. Otherwise, call this method to pass all credential identities. If some credential identities in credentialIdentities already exist in the store, they will be replaced by those from credentialIdentities.

## See Also

### Deprecated methods

- [replaceCredentialIdentities(with:completion:)](authenticationservices/ascredentialidentitystore/replacecredentialidentities(with:completion:).md)
- [removeCredentialIdentities(_:completion:)](authenticationservices/ascredentialidentitystore/removecredentialidentities(_:completion:)-2ygnf.md)
