---
title: "saveAccount(_:withCompletionHandler:)"
framework: accounts
role: symbol
role_heading: Instance Method
path: "accounts/acaccountstore/saveaccount(_:withcompletionhandler:)"
---

# saveAccount(_:withCompletionHandler:)

Saves an account to the Accounts database.

## Declaration

```swift
func saveAccount(_ account: ACAccount!, withCompletionHandler completionHandler: (@Sendable (Bool, (any Error)?) -> Void)!)
```

```swift
func saveAccount(_ account: ACAccount!) async throws -> Bool
```

## Parameters

- `account`: The account to save.
- `completionHandler`: The handler to call when the operation completes. The handler is called on an arbitrary queue.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func saveAccount(_ account: ACAccount!) async throws -> Bool For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. If the account type supports authentication and the account isn’t authenticated, the account server uses the account’s credentials to authenticate it. If the authentication is successful, the account is saved; otherwise it’s not saved.

## See Also

### Saving Accounts

- [ACAccountStoreSaveCompletionHandler](accounts/acaccountstoresavecompletionhandler.md)
