Retrieving all organisations in Zoho Desk is straightforward once your OAuth token carries the right scopes and you know which API endpoint to call. This article walks through the exact steps our team uses when building integrations against the Zoho Desk API.
---
Why this matters
When you connect to Zoho Desk programmatically, almost every subsequent API call — fetching tickets, contacts, or accounts — requires a valid organisation ID (orgId). Without it, requests will fail or return empty results. Calling the organisations endpoint first is the standard way to discover and store that ID automatically, especially when you cannot hard-code it in advance. [^5,6]
---
Step-by-step
Step 1. Ensure your OAuth application requests the correct scopes before authenticating. To read organisation data you need at minimum Desk.basic.READ included in your scope string. A broader integration will also want scopes such as Desk.tickets.ALL, Desk.contacts.READ, and others depending on what you plan to do, but Desk.basic.READ is the one that unlocks organisations, agents, and departments. [1]
Step 2. Obtain a valid access token. If you already have a refresh token stored, exchange it for a fresh access token using Zoho's OAuth token endpoint before making any Desk API calls. Store the resulting accesstoken alongside your apidomain so you can reuse it. [5]
Step 3. Instantiate your Desk client with the access token and your apidomain. At this stage you can pass an empty string for orgid — the whole point of this call is to discover it. [7]
Step 4. Call the organisations endpoint:
GET /api/v1/organizations
Pass an empty parameters dictionary ({}) if you have no filters to apply. The method signature looks like this in Python: [6]
def get_all_organizations(self, p: dict = None):
return self.c.request("GET", "/api/v1/organizations", p, None)
Step 5. Parse the response carefully — the shape can vary. If the response is a dict, look for a "data" key whose value is a list; the first element's "id" field is your organisation ID. If the response is directly a list, take the first element's "id" field instead. Always convert the result to a string before storing it. [^3,7]
orgs = api.get_all_organizations(p={})
org_id = ""
if isinstance(orgs, dict):
items = orgs.get("data")
if isinstance(items, list) and items:
org_id = str(items[0].get("id", ""))
elif isinstance(orgs, list) and orgs:
org_id = str(orgs[0].get("id", ""))
Step 6. Persist the discovered orgid so you do not need to repeat this lookup on every request. Store it against the user or connection record in your database (for example, in a deskorg_id column on your connections table), and update the timestamp at the same time. [3]
Step 7. Re-initialise your Desk client with the now-populated org_id and proceed with subsequent API calls. All ticket, contact, and account endpoints will require this value to be present in the client. [7]
---
Common pitfalls
- Missing
Desk.basic.READscope. If this scope is absent from your OAuth grant, the/api/v1/organizationscall will return an authorisation error. Double-check your scope string before generating the authorisation URL. [1] - Assuming a fixed response shape. The organisations endpoint can return either a wrapped
{"data": [...]}object or a bare list depending on API version or account configuration. Always handle both cases in your parsing logic, as shown in Step 5. [^3,7] - Passing
orgidto the initial organisations call. When auto-discovering the org ID, initialise the client with an empty string fororgid. Passing a stale or incorrect ID at this stage can cause the request to be rejected before you have a chance to discover the correct value. [7] - SQLite locking during backfill migrations. If you are running a one-time migration to associate existing users with organisations, use a single connection and transaction to avoid database locking errors. [2]
---
What to check
- Scope coverage: Confirm that
Desk.basic.READappears in the OAuth scope string used when the user authorised your application. [1] - Stored org ID: After the call completes, verify that a non-empty
deskorgidhas been written to your connection record and that subsequent API calls include it correctly. [3] - Response parsing: Log the raw response from
/api/v1/organizationsat least once during development to confirm whether your environment returns adictwith a"data"key or a bare list, and ensure your parsing branch matches. [7]
---
*Beam Help provides independent expert support for Zoho products and is not official Zoho support. Always refer to the Zoho Desk API documentation for the latest endpoint specifications.*