:doc:`SSO <../../sso>` / Client / list_accounts

*************
list_accounts
*************



.. py:method:: SSO.Client.list_accounts(**kwargs)

  

  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 <https://docs.aws.amazon.com/singlesignon/latest/userguide/useraccess.html#assignusers>`__ in the *IAM Identity Center User Guide*. This operation returns a paginated response.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sso-2019-06-10/ListAccounts>`_  


  **Request Syntax**
  ::

    response = client.list_accounts(
        nextToken='string',
        maxResults=123,
        accessToken='string'
    )
    
  :type nextToken: string
  :param nextToken: 

    (Optional) When requesting subsequent pages, this is the page token from the previous response output.

    

  
  :type maxResults: integer
  :param maxResults: 

    This is the number of items clients can request per page.

    

  
  :type accessToken: string
  :param accessToken: **[REQUIRED]** 

    The token issued by the ``CreateToken`` API call. For more information, see `CreateToken <https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html>`__ in the *IAM Identity Center OIDC API Reference Guide*.

    

  
  
  :rtype: dict
  :returns: 
    
    **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.

            
      
    
  
  **Exceptions**
  
  *   :py:class:`SSO.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`SSO.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`SSO.Client.exceptions.TooManyRequestsException`

  
  *   :py:class:`SSO.Client.exceptions.ResourceNotFoundException`

  