SSO / Client / list_accounts



Lists all AWS accounts assigned to the user. These AWS accounts are assigned by the administrator of the account. For more information, see Assign User Access in the IAM Identity Center User Guide. This operation returns a paginated response.

See also: AWS API Documentation

Request Syntax

response = client.list_accounts(
  • nextToken (string) – (Optional) When requesting subsequent pages, this is the page token from the previous response output.

  • maxResults (integer) – This is the number of items clients can request per page.

  • accessToken (string) –


    The token issued by the CreateToken API call. For more information, see CreateToken in the IAM Identity Center OIDC API Reference Guide.

Return type:



Response Syntax

    'nextToken': 'string',
    'accountList': [
            'accountId': 'string',
            'accountName': 'string',
            'emailAddress': 'string'

Response Structure

  • (dict) –

    • nextToken (string) –

      The page token client that is used to retrieve the list of accounts.

    • accountList (list) –

      A paginated response with the list of account information and the next token if more results are available.

      • (dict) –

        Provides information about your AWS account.

        • accountId (string) –

          The identifier of the AWS account that is assigned to the user.

        • accountName (string) –

          The display name of the AWS account that is assigned to the user.

        • emailAddress (string) –

          The email address of the AWS account that is assigned to the user.


  • SSO.Client.exceptions.InvalidRequestException

  • SSO.Client.exceptions.UnauthorizedException

  • SSO.Client.exceptions.TooManyRequestsException

  • SSO.Client.exceptions.ResourceNotFoundException