## Create account for setup `client.App.Login.Register(ctx, body) (*AppLoginRegisterResponse, error)` **post** `/v1/app/setup/register` Create a Beeper account after the user chooses a username and accepts the Terms of Use. ### Parameters - `body AppLoginRegisterParams` - `AcceptTerms param.Field[bool]` 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). - `const AppLoginRegisterParamsAcceptTermsTrue AppLoginRegisterParamsAcceptTerms = true` - `LeadToken param.Field[string]` Registration token returned by Beeper. - `SetupRequestID param.Field[string]` Setup request ID returned by the start step. - `Username param.Field[string]` Username selected by the user. ### Returns - `type AppLoginRegisterResponse struct{…}` - `Matrix AppLoginRegisterResponseMatrix` Account credentials for first-party app setup. - `AccessToken string` Beeper account access token. Returned once for first-party app setup. - `DeviceID string` Current device ID. - `Homeserver string` Beeper homeserver URL for this account. - `UserID string` Signed-in Beeper user ID. - `Session AppLoginRegisterResponseSession` Current app sign-in and encrypted messaging setup state after sign-in. - `E2EE AppLoginRegisterResponseSessionE2EE` Encrypted messaging setup status. - `CrossSigning bool` Whether this account can verify trusted devices. - `FirstSyncDone bool` Whether the first encrypted message sync is complete. - `HasBackedUpRecoveryKey bool` Whether the user confirmed that they saved their recovery key. - `Initialized bool` Whether encrypted messaging setup has started. - `KeyBackup bool` Whether encrypted message backup is available. - `Secrets AppLoginRegisterResponseSessionE2EESecrets` Encrypted messaging keys available on this device. - `MasterKey bool` Whether the account identity key is available. - `MegolmBackupKey bool` Whether the encrypted message backup key is available. - `RecoveryKey bool` Whether a recovery key is available. - `SelfSigningKey bool` Whether the device trust key is available. - `UserSigningKey bool` Whether the user trust key is available. - `SecretStorage bool` Whether secure key storage is available. - `Verified bool` Whether this device is trusted for encrypted messages. - `RecoveryKeyGeneratedAt float64` Unix timestamp for when the recovery key was created. - `State string` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `const AppLoginRegisterResponseSessionStateNeedsLogin AppLoginRegisterResponseSessionState = "needs-login"` - `const AppLoginRegisterResponseSessionStateInitializing AppLoginRegisterResponseSessionState = "initializing"` - `const AppLoginRegisterResponseSessionStateNeedsCrossSigningSetup AppLoginRegisterResponseSessionState = "needs-cross-signing-setup"` - `const AppLoginRegisterResponseSessionStateNeedsVerification AppLoginRegisterResponseSessionState = "needs-verification"` - `const AppLoginRegisterResponseSessionStateNeedsSecrets AppLoginRegisterResponseSessionState = "needs-secrets"` - `const AppLoginRegisterResponseSessionStateNeedsFirstSync AppLoginRegisterResponseSessionState = "needs-first-sync"` - `const AppLoginRegisterResponseSessionStateReady AppLoginRegisterResponseSessionState = "ready"` - `Matrix AppLoginRegisterResponseSessionMatrix` Signed-in account details. Omitted until sign-in is complete. - `DeviceID string` Current device ID. - `Homeserver string` Beeper homeserver URL for this account. - `UserID string` Signed-in Beeper user ID. - `Verification AppLoginRegisterResponseSessionVerification` Trusted device verification progress. - `ID string` Verification ID to pass in verification action paths. - `AvailableActions []string` Verification actions that are valid for the current state. - `const AppLoginRegisterResponseSessionVerificationAvailableActionAccept AppLoginRegisterResponseSessionVerificationAvailableAction = "accept"` - `const AppLoginRegisterResponseSessionVerificationAvailableActionCancel AppLoginRegisterResponseSessionVerificationAvailableAction = "cancel"` - `const AppLoginRegisterResponseSessionVerificationAvailableActionQrConfirmScanned AppLoginRegisterResponseSessionVerificationAvailableAction = "qr.confirmScanned"` - `const AppLoginRegisterResponseSessionVerificationAvailableActionSASStart AppLoginRegisterResponseSessionVerificationAvailableAction = "sas.start"` - `const AppLoginRegisterResponseSessionVerificationAvailableActionSASConfirm AppLoginRegisterResponseSessionVerificationAvailableAction = "sas.confirm"` - `Direction string` Whether this device started or received the verification. - `const AppLoginRegisterResponseSessionVerificationDirectionIncoming AppLoginRegisterResponseSessionVerificationDirection = "incoming"` - `const AppLoginRegisterResponseSessionVerificationDirectionOutgoing AppLoginRegisterResponseSessionVerificationDirection = "outgoing"` - `Methods []string` Verification methods supported for this transaction. - `const AppLoginRegisterResponseSessionVerificationMethodQr AppLoginRegisterResponseSessionVerificationMethod = "qr"` - `const AppLoginRegisterResponseSessionVerificationMethodSAS AppLoginRegisterResponseSessionVerificationMethod = "sas"` - `Purpose string` Why this verification exists. - `const AppLoginRegisterResponseSessionVerificationPurposeLogin AppLoginRegisterResponseSessionVerificationPurpose = "login"` - `const AppLoginRegisterResponseSessionVerificationPurposeDevice AppLoginRegisterResponseSessionVerificationPurpose = "device"` - `State string` Current trusted-device verification state. - `const AppLoginRegisterResponseSessionVerificationStateRequested AppLoginRegisterResponseSessionVerificationState = "requested"` - `const AppLoginRegisterResponseSessionVerificationStateReady AppLoginRegisterResponseSessionVerificationState = "ready"` - `const AppLoginRegisterResponseSessionVerificationStateSASReady AppLoginRegisterResponseSessionVerificationState = "sas_ready"` - `const AppLoginRegisterResponseSessionVerificationStateQrScanned AppLoginRegisterResponseSessionVerificationState = "qr_scanned"` - `const AppLoginRegisterResponseSessionVerificationStateDone AppLoginRegisterResponseSessionVerificationState = "done"` - `const AppLoginRegisterResponseSessionVerificationStateCancelled AppLoginRegisterResponseSessionVerificationState = "cancelled"` - `const AppLoginRegisterResponseSessionVerificationStateError AppLoginRegisterResponseSessionVerificationState = "error"` - `Error AppLoginRegisterResponseSessionVerificationError` Verification error details, if verification stopped. - `Code string` Verification error code. - `Reason string` User-facing verification error message. - `OtherDevice AppLoginRegisterResponseSessionVerificationOtherDevice` Other device participating in verification. - `ID string` Other device ID. - `Name string` Other device display name, if known. - `OtherUserID string` Other Beeper user participating in verification. - `Qr AppLoginRegisterResponseSessionVerificationQr` QR verification data. - `Data string` QR code payload to display for verification. - `SAS AppLoginRegisterResponseSessionVerificationSAS` Emoji or number comparison data for verification. - `Emojis string` Emoji sequence to compare on both devices. - `Decimals string` Number sequence to compare on both devices. ### Example ```go package main import ( "context" "fmt" "github.com/beeper/desktop-api-go" "github.com/beeper/desktop-api-go/option" ) func main() { client := beeperdesktopapi.NewClient( option.WithAccessToken("My Access Token"), ) response, err := client.App.Login.Register(context.TODO(), beeperdesktopapi.AppLoginRegisterParams{ AcceptTerms: true, LeadToken: "leadToken", SetupRequestID: "setupRequestID", Username: "x", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Matrix) } ``` #### 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" } } } } ```