## Create account for setup

`$client->app->setup->register(true acceptTerms, string leadToken, string setupRequestID, string username): SetupRegisterResponse`

**post** `/v1/app/setup/register`

Create a Beeper account after the user chooses a username and accepts the Terms of Use.

### Parameters

- `acceptTerms: true`

  Confirms that the user agreed to our [terms of use](https://www.beeper.com/terms-onboarding) and has read our [privacy policy](https://www.beeper.com/privacy).

- `leadToken: string`

  Registration token returned by Beeper.

- `setupRequestID: string`

  Setup request ID returned by the start step.

- `username: string`

  Username selected by the user.

### Returns

- `SetupRegisterResponse`

  - `Matrix matrix`

    Account credentials for first-party app setup.

  - `Session session`

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

### Example

```php
<?php

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

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

$response = $client->app->setup->register(
  acceptTerms: true,
  leadToken: 'leadToken',
  setupRequestID: 'setupRequestID',
  username: 'x',
);

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"
      }
    }
  }
}
```
