Multi-Account Reporting

Similar to other endpoints, if enabled for Multi-Account users can run queries that will retrieve data from multiple Accounts. The 2.0 version of the API does this using POST requests, so the account id filter is instead passed via the data passed with the request instead of as a URL parameter as done in GET requests.

When making any POST request to the API to generate a new report, saved report or schedule, a new account_id_filter parameter needs to be specified in filters to determine which Accounts to query. This applies to ad hoc, saved reports and schedules.

Sample POST Request

For example, multi-account users should create a request similar to the following to query across all accounts. The following object represents the data sent for a request to the /reporting/run-query resource.

{
	"view": "vendor_fee_agg",
	"fields": [
		"bid_hour",
		"account_id",
		"vendor_fee"
	],
	"filters": {
		"bid_day": "after 2020-02-01",
		"account_id_filter": ">0"
	}
}

If no account_id_filter is set then the user's default Account ID is used. This is true even if the user has masqueraded into a different Account via the API's /authenticate resource.

Non-Multi-Account users who pass this filter will still only see their own Account's data regardless of value of the account_id_filter parameter.

Accepted Filter Syntax

The account_id_filter parameter syntax can be expressed in a few different ways:

  • A single value (e.g., 2)
  • A comma-separated list of of values (e.g., 1, 4, 6)
  • Using boolean logic (e.g., NOT 36)
  • Using comparison operators (e.g., >0)

To query all accounts, we recommend using the >0 value.

🚧

Multi-Account Limitations

When accessing saved reports or schedules that are saved in a group (Account, rather than personal) context, only the Account that was most recently masqueraded in the UI's reports and schedules will be accessible. Queries can still be run across accounts.

As a result, we recommend for organizational purposes, Multi-Account API users generally should determine a single Account to save and access all saved and scheduled reports from.


What’s Next