## Complete setup sign-in with code

`$client->app->setup->response(string response, string setupRequestID): SetupResponseResponse`

**post** `/v1/app/setup/response`

Finish setup sign-in with the code sent to the user email address. If the user needs a new account, the response includes account creation copy and username suggestions.

### Parameters

- `response: string`

  Sign-in code from the user email.

- `setupRequestID: string`

  Setup request ID returned by the start step.

### Returns

- `SetupResponseResponse`

  - `AppSetupCompleteResponse`

    - `Matrix matrix`

      Account credentials for first-party app setup.

    - `Session session`

      Current app sign-in and encrypted messaging setup state after sign-in.

  - `AppSetupRegistrationRequiredResponse`

    - `Copy copy`

      Copy to display during account creation.

    - `string leadToken`

      Registration token returned by Beeper.

    - `true registrationRequired`

      Indicates that the user needs to create a Beeper account.

    - `string setupRequestID`

      Setup request ID to use when creating the account.

    - `?list<string> usernameSuggestions`

      Suggested usernames for the new account.

### Example

```php
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(accessToken: 'My Access Token');

$response = $client->app->setup->response(
  response: 'response', setupRequestID: 'setupRequestID'
);

var_dump($response);
```

#### Response

```json
{
  "matrix": {
    "accessToken": "accessToken",
    "deviceID": "deviceID",
    "homeserver": "homeserver",
    "userID": "userID"
  },
  "session": {
    "e2ee": {
      "crossSigning": true,
      "firstSyncDone": true,
      "hasBackedUpRecoveryKey": true,
      "initialized": true,
      "keyBackup": true,
      "secrets": {
        "masterKey": true,
        "megolmBackupKey": true,
        "recoveryKey": true,
        "selfSigningKey": true,
        "userSigningKey": true
      },
      "secretStorage": true,
      "verified": true,
      "recoveryKeyGeneratedAt": 0
    },
    "state": "needs-login",
    "matrix": {
      "deviceID": "deviceID",
      "homeserver": "homeserver",
      "userID": "userID"
    },
    "verification": {
      "id": "id",
      "availableActions": [
        "accept"
      ],
      "direction": "incoming",
      "methods": [
        "qr"
      ],
      "purpose": "login",
      "state": "requested",
      "error": {
        "code": "code",
        "reason": "reason"
      },
      "otherDevice": {
        "id": "id",
        "name": "name"
      },
      "otherUserID": "otherUserID",
      "qr": {
        "data": "data"
      },
      "sas": {
        "emojis": "emojis",
        "decimals": "decimals"
      }
    }
  }
}
```
