Chat API tutorial: Generating an OAuth token (integrated Chat accounts)

Return to top
Have more questions? Submit a request


  • Hanlin Chen

    I can see if I don't use the code quick enough, I get an invalid_grant error

    However, I always get an access_denied error otherwise... Can anyone suggest which step I could have missed? (I am the admin of both Zendesk chat and support)


  • Niall Colfer
    Zendesk Team Member

    Hi Hanlin,

    Thanks for letting us know. I see you have an open ticket with my colleague to troubleshoot further, we'll gather some details from you regarding your issue there.

  • Jan Marowski

    Hi Niall,


    I have problem with final step. I'm getting:

    {{"description": "The method is not allowed for the requested URL.", "error": "Method Not Allowed"}}

    Can you tell me if this is some setting that I can set or this is what you have mentioned in beginning of this article in conditions?



  • Ruth Anne Dilig


    I understand that this procedure is for authorization code grant type. Can you also provide a tutorial on how I can get an access token with client_credentials grant type? I am using the curl command below which I found in and I am getting an error: "invalid_client". Thanks

    curl \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d 'grant_type=client_credentials&client_id={your_client_id}&client_secret={your_client_secret}' \
      -X POST
  • Ruth Anne Dilig

    Hello, I already solved this issue. I just wanna share the solution if grant_type is client_credentials. The client_type must be set to confidential to be able to get the access token

  • ★Panayiotis Georgiou


    I have tried to connect to the api and still getting CORS problems

    Failed to load Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

    Can you tell me if this is some setting that I can avoid the CORS problems ?




  • Logan McNiece

    I am in the same boat as Hanlin Chen. I can get the the auth code via step #3, but no matter what I do I get "access_denied" for step #4. I also am an admin of both Zendesk chat and support. What could be causing this?

    Also, I'd advise updating your documentation at to highlight this different authentication pattern. It is super confusing for anyone on an integrated Zopim-Zendesk account. I spent three hours trying to get this to work until accidentally stumbling on this thread via a google search.

  • Logan McNiece

    Just a call out. I figured out the issue for my instance of the "access_denied", not sure if it was the same for Chen. I was not specifying localhost:8080 as my redirect.

  • Hani Tanna

    hello... i got error that unsupported_grant_type


  • Jim Williams

    I found this process was a little easier when I modified it as such:

    Step 1 - Request a token rather than a code using this URL:

    Step 2 - Skipped.

    Step 3 - Get the token from the URL bar in the browser.  The URL in the bar will look similar to:


    Only grab the value for access_token.

    Step 4 - Skipped.

    Step 5 - Use the access_token from Step 3 directly.


    Hopefully this will help to simplify the process.

  • Yusuf Khan

    can anyone help me I am trying call

    curl{resource} \
      -H "Authorization: Bearer {API access token}"

    initially, I tried with basic auth (adding id : password in the request) response was unauthorized


    then I generate access token with postman like in below screenshot

    and when call API with that access token then the response is 403 forbidden

    thanks you

  • Antonino Tocco

    Hi all, I'm trying to get all my chats with /api/v2/chats. I have tried also endpoints and {subdomain} endpoint.

    Zopim give me cors error for header authorization and subdomain give me 404 for path /api/v2/chats.


    Can you please help me?

  • Devan - Community Manager
    Zendesk Community Team

    Hello Antonino Tocco,

    I'll see if I can get a bit more visibility on this for you within the community. In the meantime, I've linked an article that goes into Chat API in more depth.

    Chat API Developer

    Best regards.

  • Bryan - Community Manager
    Zendesk Developer Support

    Hi Antonino Tocco -- you definitely need to use the as your domain prefix when calling Chat APIs.

    Can you give more context as to where you're making the API call from (examples: a Chat app inside the agent interface, a custom web page, etc).

    Also, can you make the call from the command line using cURL or from a tool such as Postman?

  • Emile Cohen

    Hi everyone,

    I am deploying an OAuth2 flow for Zendesk Chat but I get a "unsupported_grant_type" error while requesting an authorisation_code in part 4. I made sure to respect the syntax grant_type= "authorisation_code". I do not know how to bypass this issue. Maybe there is something to activate when creating the client, but I do not see anything on Zendesk Chat interface. 

    Thanks !

  • Bryan - Community Manager
    Zendesk Developer Support

    You might have a typo there Emile. Make sure it's "authorization_code" and not "authorisation_code" — the spelling is part of the OAuth standard and doesn't reflect regional spelling differences.

  • Jayashankar R

    Hi, I have the same issue getting access token after getting authorization_code. I'm using this doc. Getting 401 {"error": "access_denied"}. Is there any issues with this API nowadays ?

  • Bryan - Community Manager
    Zendesk Developer Support

    Hello Jayashankar R — the above article has the most detailed methods for obtaining Chat OAuth tokens. The above sections "Create the OAuth API client" and "Complete the OAuth implicit grant flow to get the token" are the easiest ways to get an access token manually. There have been no changes to these steps or APIs.

    If you're still running into issues, please contact Zendesk Customer Support, as there may be specifics of your personal account that need to be discussed.

  • Lev

    hi, i followed the steps in the article and got an access token with no errors :D 

    but I seems cannot use this token to access the Conversation APi, i got invalid scope error, 

    I added a screen shot here for the error of scope 

    also this is how i get the access token 

    when i did this cURL call, I tried with scope = chat / scope= read write, i could get token no problem, but I always end up with same invalid scope error when I try to access the conversation API, 

    Any suggestion is appreciated

    thank you!

  • Remi Saumet
    Zendesk Customer Advocate

    Hi Lev,

    Thank you for your post, hope you are doing well today!

    According to the requests / calls you want to make through the conversation API you will need more than the Chat scope and have to set the scope of the token to readwrite, and chat.

    Please refer to the section Authentication in Chat Conversations API for a better understanding.

    For instance, retrieve the Token with :

    I would also encourage you to have a look at the following documentation : Getting started with the Chat Conversations API, that should point you in the right direction.

    Hope this helps!

    Have a great rest of your day.

    Best regards,

  • Matt Schembri

    I've got an access token generated through "Implicit grant flow" detailed at

    How can my Zendesk support app use this token?

    Is there a clear cut way to get chat data into a zendesk support app?

  • John Espina

    Hi Matt,

    In regards to your concern, you can use OAuth 2 to authenticate all your application's API requests to Zendesk. OAuth provides a secure way for your application to access Zendesk data without having to store and use the passwords of Zendesk users, which is sensitive information.

    Please check this article:

    John Espina | Customer Advocate


Please sign in to leave a comment.

Powered by Zendesk