API call to list all sub-accounts for a parent account is not returning all sub-accounts

Jump to solution
kwade5
Community Member

Hi,

I am using the api/v1/accounts/1/sub_accounts method to return a list of all sub-accounts for account 1. A valid response is received, however, not all the sub-accounts for account 1 are returned. I recently created a new sub-account, but this new sub-account is not included in the API response.

We only have one account. All sub-accounts are under the single account.

Is there a setting for sub-accounts that would prohibit the sub-account from being included in the API response?

0 Likes
1 Solution
chriscas
Community Coach
Community Coach

Hi @kwade5,

I have not encountered a scenario where a subaccount would not be listed.  I wonder if you are perhaps running into a pagination issue?  By default, only 10 items are returned for most API requests.  If there are more than 10 things, you'd need to make another API call to retrieve the next 10 items (and so on...) or change the per_page value to something higher than 10 (100 seems to be the max value for this in most API calls right now, but it's always subject to change).  You can find more info on pagination at Pagination - Canvas LMS REST API Documentation.

Let us know if this is the issue!

-Chris

View solution in original post