{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-products/nowinfinity/resources/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Accessing child accounts"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"accessing-child-accounts","__idx":0},"children":["Accessing child accounts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"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."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"listing-available-accounts","__idx":1},"children":["Listing available accounts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call the accounts endpoint to see which accounts you can reach:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl https://partnerapi.nowinfinity-test.com.au/v1/accounts \\\n  -H \"Authorization: Bearer {access_token}\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each account includes an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AccountId"]},", a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Name"]},", and an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IsCurrentAccount"]}," flag identifying the account you authenticated as."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"targeting-a-child-account","__idx":2},"children":["Targeting a child account"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-NI-AccountID"]}," header to any request, with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AccountId"]}," of the child account:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl https://partnerapi.nowinfinity-test.com.au/v1/documents \\\n  -H \"Authorization: Bearer {access_token}\" \\\n  -H \"X-NI-AccountID: {child_account_id}\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API treats the request as though it were made under that child account rather than the parent you authenticated as."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Omit the header, and the request applies to the account you authenticated as."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"what-this-affects","__idx":3},"children":["What this affects"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a-practical-approach","__idx":4},"children":["A practical approach"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v1/accounts"]}," after authorising and store the account list against the customer."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Let the customer choose which account or accounts your integration should work with, if more than one is returned."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-NI-AccountID"]}," explicitly on every subsequent request."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Account identifiers differ between Test and Production. Anything hard-coded during development will need to change before you go live. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/nowinfinity/resources/environments"},"children":["Environments"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related","__idx":5},"children":["Related"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/nowinfinity/resources/api-structure"},"children":["API structure"]}," — headers and request format."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/nowinfinity/resources/querying-with-odata"},"children":["Querying with OData"]}," — filtering the records returned."]}]}]},"headings":[{"value":"Accessing child accounts","id":"accessing-child-accounts","depth":1},{"value":"Listing available accounts","id":"listing-available-accounts","depth":2},{"value":"Targeting a child account","id":"targeting-a-child-account","depth":2},{"value":"What this affects","id":"what-this-affects","depth":2},{"value":"A practical approach","id":"a-practical-approach","depth":2},{"value":"Related","id":"related","depth":2}],"frontmatter":{"title":"Accessing child accounts","description":"Query the Partner API on behalf of accounts beneath the one you authenticated as.","seo":{"title":"Accessing child accounts"}},"lastModified":"2026-09-03T05:27:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/nowinfinity/resources/child-accounts","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}