# KlaviyoAPI::AccountsApi All URIs are relative to *https://a.klaviyo.com* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**get_account**](AccountsApi.md#get_account) | **GET** /api/accounts/{id}/ | Get Account | | [**get_accounts**](AccountsApi.md#get_accounts) | **GET** /api/accounts/ | Get Accounts | ## get_account > Hash<String, Object> get_account(id, opts) Get Account Retrieve a single account object by its account ID. You can only request the account by which the private API key was generated.

*Rate limits*:
Burst: `1/s`
Steady: `15/m` **Scopes:** `accounts:read` ### Examples ```ruby require 'time' require 'klaviyo-api-sdk' # setup authorization KlaviyoAPI.configure do |config| # Configure API key authorization: Klaviyo-API-Key config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer' end api_instance = KlaviyoAPI::AccountsApi.new id = 'AbC123' # String | The ID of the account opts = { fields_account: ['test_account'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets } begin # Get Account result = api_instance.get_account(id, opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling AccountsApi->get_account: #{e}" end ``` #### Using the get_account_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_account_with_http_info(id, opts) ```ruby begin # Get Account data, status_code, headers = api_instance.get_account_with_http_info(id, opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling AccountsApi->get_account_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The ID of the account | | | **fields_account** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] | ### Return type **Hash<String, Object>** ### Authorization [Klaviyo-API-Key](../README.md#Klaviyo-API-Key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ## get_accounts > Hash<String, Object> get_accounts(opts) Get Accounts Retrieve the account(s) associated with a given private API key. This will return 1 account object within the array. You can use this to retrieve account-specific data (contact information, timezone, currency, Public API key, etc.) or test if a Private API Key belongs to the correct account prior to performing subsequent actions with the API.

*Rate limits*:
Burst: `1/s`
Steady: `15/m` **Scopes:** `accounts:read` ### Examples ```ruby require 'time' require 'klaviyo-api-sdk' # setup authorization KlaviyoAPI.configure do |config| # Configure API key authorization: Klaviyo-API-Key config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer' end api_instance = KlaviyoAPI::AccountsApi.new opts = { fields_account: ['test_account'] # Array | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets } begin # Get Accounts result = api_instance.get_accounts(opts) p result rescue KlaviyoAPI::ApiError => e puts "Error when calling AccountsApi->get_accounts: #{e}" end ``` #### Using the get_accounts_with_http_info variant This returns an Array which contains the response data, status code and headers. > get_accounts_with_http_info(opts) ```ruby begin # Get Accounts data, status_code, headers = api_instance.get_accounts_with_http_info(opts) p status_code # => 2xx p headers # => { ... } p data # => Hash<String, Object> rescue KlaviyoAPI::ApiError => e puts "Error when calling AccountsApi->get_accounts_with_http_info: #{e}" end ``` ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **fields_account** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets | [optional] | ### Return type **Hash<String, Object>** ### Authorization [Klaviyo-API-Key](../README.md#Klaviyo-API-Key) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json