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

    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?


Please sign in to leave a comment.

Powered by Zendesk