Skip to content

Accessing child accounts

NowInfinity accounts can be arranged in a hierarchy: a parent account with child accounts beneath it. A practice with several offices or entities, for example, may hold one parent account and several children.

Your integration authenticates once against the parent account, then targets a specific child account per request using a header. There is no need to authorise separately for each account.

Listing available accounts

Call the accounts endpoint to see which accounts you can reach:

curl https://partnerapi.nowinfinity-test.com.au/v1/accounts \
  -H "Authorization: Bearer {access_token}"

If the authenticated account has children, the response contains the current account and its children. If it has none, the response contains just the current account.

Each account includes an AccountId, a Name, and an IsCurrentAccount flag identifying the account you authenticated as.

Targeting a child account

Add the X-NI-AccountID header to any request, with the AccountId of the child account:

curl https://partnerapi.nowinfinity-test.com.au/v1/documents \
  -H "Authorization: Bearer {access_token}" \
  -H "X-NI-AccountID: {child_account_id}"

The API treats the request as though it were made under that child account rather than the parent you authenticated as.

Omit the header, and the request applies to the account you authenticated as.

What this affects

The header applies to reads and writes alike. Requests return the child account's data, and records created during the request are created under that child account rather than the parent you authenticated as.

Because the header changes where created records land, it matters as much on writes as on reads. Set it deliberately on every request rather than relying on a default.

A practical approach

  1. Call /v1/accounts after authorising and store the account list against the customer.
  2. Let the customer choose which account or accounts your integration should work with, if more than one is returned.
  3. Send X-NI-AccountID explicitly on every subsequent request.

Account identifiers differ between Test and Production. Anything hard-coded during development will need to change before you go live. See Environments.