POST/v1/account_sessions

Create an Account Session

Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 body fields
accountstringrequired

The identifier of the account to create an Account Session for.

componentsobjectrequired

Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not).

expandarray<string>optional

Specifies which fields in the response should be expanded.

2 status codes
200Successful response.
accountstringrequired

The ID of the account the AccountSession was created for

client_secretstringrequired

The client secret of this AccountSession. Used on the client to set up secure access to the given account.

The client secret can be used to provide access to account from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs to setup Connect embedded components and learn about how client_secret should be handled.

componentsobjectrequired
expires_atintegerrequired

The timestamp at which this AccountSession will expire.

livemodebooleanrequired

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.

objectstringrequired

String representing the object's type. Objects of the same type share the same value.

Allowed:account_session
defaultError response.
errorobjectrequired

Error handling

Any other status is an error: Error response.