Beam Help
Get help now

How-to · Zoho DESK

How to get original mail content in Zoho Desk

Retrieve the original email content from a ticket thread.

Retrieving the raw, original email content for a Zoho Desk ticket thread is straightforward once you know the correct API endpoint and have the right identifiers on hand.


Why this matters


When a support ticket arrives via email, Zoho Desk stores both a processed version and the original mail payload. There are times — debugging encoding issues, auditing exact headers, or building integrations — when you need that unprocessed source rather than the rendered thread view. Knowing how to call the dedicated endpoint saves you from scraping the UI or guessing at the data structure.


Step-by-step


Step 1. Gather your identifiers.

Before making any request, locate two values: the ticketid of the ticket you are investigating, and the threadid of the specific email thread within that ticket. Both are available from the Zoho Desk ticket detail view or from a prior API call that lists threads. [1]


Step 2. Confirm your OAuth scopes are in place.

Your connected application must have at minimum Desk.tickets.READ authorised. Without this scope the request will be rejected before it reaches the thread data. Check your OAuth configuration and ensure the scope list includes Desk.tickets.READ (and ideally Desk.tickets.ALL for broader access). [4]


Step 3. Ensure your Zoho Desk client is initialised with a valid org ID.

The Zoho Desk API requires an orgId header on every call. If your integration has not yet stored the organisation ID, make a preliminary call to retrieve all organisations, take the id from the first item in the returned list, and persist it for subsequent requests. [3]


Step 4. Call the original mail content endpoint.

Issue an HTTP GET request to:


GET /api/v1/tickets/{ticket_id}/threads/{thread_id}/original

Replace {ticketid} and {threadid} with the values you collected in Step 1. An optional query parameter p can be passed to supply additional pagination or filter options. [1]


In Python, using a wrapper client, the call looks like this:


result = desk_api.get_original_mail_content(
    ticket_id="123456",
    thread_id="789012"
)

The method issues a GET to the path above and returns the raw mail payload. [1]


Step 5. Handle token refresh gracefully.

Access tokens expire. Build your integration so that when a 401 is returned, it automatically calls the token refresh flow — fetching a new accesstoken using the stored refreshtoken — and retries the original request. Store the refreshed token and its expiry timestamp so future calls succeed without user intervention. [3]


Step 6. Inspect the response.

The response body contains the original mail content for that thread. Parse it according to your use case — extracting headers, raw MIME parts, or the plain-text body as needed. [1]


---


Common pitfalls


  • Missing org ID. Zoho Desk rejects requests that lack a valid organisation ID in the request headers. Always auto-discover and cache the org ID on first connection rather than assuming it is already stored. [3]
  • Insufficient scopes. Requesting only Desk.tickets.WRITE without Desk.tickets.READ will prevent you from fetching thread content. Review your full scope string carefully — it is easy to omit read permissions when focusing on write operations. [4]
  • Wrong thread ID. The thread_id is not the same as the ticket ID. Passing the ticket ID in both fields is a common mistake; always retrieve the thread list first to confirm the correct value. [1]
  • Stale access tokens. If your integration does not implement a token refresh callback, calls will silently fail after the token expires. Implement the refresh logic described in Step 5 before going to production. [3]

---


What to check


  • Verify both IDs are correct — confirm that ticketid and threadid each resolve to real records in your Zoho Desk portal before calling the endpoint. [1]
  • Confirm active OAuth scopes — open your OAuth app settings and validate that Desk.tickets.READ (or Desk.tickets.ALL) appears in the authorised scope list. [4]
  • Test token refresh end-to-end — deliberately expire or revoke an access token in a staging environment and confirm your integration successfully refreshes and retries without manual intervention. [3]

---


*Beam Help is an independent expert support resource for Zoho users — we are not official Zoho support. For platform-level issues, always cross-reference the official Zoho Desk API documentation.*

Sources cited

  1. [1] GET /api/v1/tickets/{ticket_id}/threads/{thread_id}/original
  2. [2] server.py: chat
  3. [3] server.py: get_zoho_api
  4. [4] config.py
  5. [5] server.py: chat_stream
  6. [6] server.py: build_zoho_links
  7. [7] server.py: chat_plan
Get Original Mail Content | Beam Help — Beam Help