GetAccountsInfo Service Operation - Customer Management

Gets a list of objects that contains account identification information, for example the name and identifier of the account, for the specified customer.

Request Elements

The GetAccountsInfoRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Request Body Elements

Element Description Data Type
CustomerId The identifier of the customer who owns the accounts to get. If not set, the user's credentials are used to determine the customer. long
OnlyParentAccounts Determines whether to return only the accounts that belong to the customer or to also return the accounts that the customer manages for other customers. To return all accounts (those that belong to the customer and those that the customer manages), set this element to false; otherwise, set to true to return account information for only the specified customer. The default is false. boolean

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts. string
DeveloperToken The developer token used to access the Bing Ads API. string
Password The Bing Ads managed user's sign-in password. string
UserName The Bing Ads managed user's sign-in name. You must not set this element to a Microsoft account or email address. string

Important

The UserName and Password header elements are deprecated. In future versions of the API, Bing Ads will transition exclusively to Microsoft Account (email address) authentication. For more information, see Authentication with OAuth. UserName and Password are still required for Bing Ads managed credentials, but they are not applicable for Microsoft account authentication. To authenticate a Microsoft account, use the AuthenticationToken] header instead of UserName and Password.

Response Elements

The GetAccountsInfoResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
AccountsInfo An array of AccountInfo objects that identifies the list of accounts that the customer owns.

To get the account data for an account in the list, access the Id element of the AccountInfo object and use it to call GetAccount.

Note that there can be a delay of up to five minutes from the time that you add an account until the GetAccountsInfo returns the account in the response.
AccountInfo array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

The following template shows the order of the body and header elements for the SOAP request.

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v11">
    <Action mustUnderstand="1">GetAccountsInfo</Action>
    <ApplicationToken i:nil="false">ValueHere</ApplicationToken>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
    <Password i:nil="false">ValueHere</Password>
    <UserName i:nil="false">ValueHere</UserName>
  </s:Header>
  <s:Body>
    <GetAccountsInfoRequest xmlns="https://bingads.microsoft.com/Customer/v11">
      <CustomerId i:nil="false">ValueHere</CustomerId>
      <OnlyParentAccounts>ValueHere</OnlyParentAccounts>
    </GetAccountsInfoRequest>
  </s:Body>
</s:Envelope>

Response SOAP

The following template shows the order of the body and header elements for the SOAP response.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v11">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetAccountsInfoResponse xmlns="https://bingads.microsoft.com/Customer/v11">
      <AccountsInfo xmlns:e316="https://bingads.microsoft.com/Customer/v11/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e316:AccountInfo>
          <e316:Id>ValueHere</e316:Id>
          <e316:Name d4p1:nil="false">ValueHere</e316:Name>
          <e316:Number d4p1:nil="false">ValueHere</e316:Number>
          <e316:AccountLifeCycleStatus>ValueHere</e316:AccountLifeCycleStatus>
          <e316:PauseReason d4p1:nil="false">ValueHere</e316:PauseReason>
        </e316:AccountInfo>
      </AccountsInfo>
    </GetAccountsInfoResponse>
  </s:Body>
</s:Envelope>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads Code Examples for more examples.

public async Task<GetAccountsInfoResponse> GetAccountsInfoAsync(
    long? customerId,
    bool onlyParentAccounts)
{
    var request = new GetAccountsInfoRequest
    {
        CustomerId = customerId,
        OnlyParentAccounts = onlyParentAccounts
    };

    return (await CustomerManagementService.CallAsync((s, r) => s.GetAccountsInfoAsync(r), request));
}
static GetAccountsInfoResponse getAccountsInfo(
    java.lang.Long customerId,
    boolean onlyParentAccounts) throws RemoteException, Exception
{
    GetAccountsInfoRequest request = new GetAccountsInfoRequest();

    request.setCustomerId(customerId);
    request.setOnlyParentAccounts(onlyParentAccounts);

    return CustomerManagementService.getService().getAccountsInfo(request);
}
static function GetAccountsInfo(
    $customerId,
    $onlyParentAccounts)
{

    $GLOBALS['Proxy'] = $GLOBALS['CustomerManagementProxy'];

    $request = new GetAccountsInfoRequest();

    $request->CustomerId = $customerId;
    $request->OnlyParentAccounts = $onlyParentAccounts;

    return $GLOBALS['CustomerManagementProxy']->GetService()->GetAccountsInfo($request);
}
response=customermanagement_service.GetAccountsInfo(
    CustomerId=CustomerId,
    OnlyParentAccounts=OnlyParentAccounts)

Requirements

Service: CustomerManagementService.svc v11
Namespace: https://bingads.microsoft.com/Customer/v11