title: REST API 500 Server error posting a message using Circuit by Unify
body: <p>I'm trying to post a message using the Client-Credentials Grant flow (<a href="https://circuit.github.io/oauth.html#client_credentials" rel="nofollow noreferrer">https://circuit.github.io/oauth.html#client_credentials</a>) But keep getting</p>
  
  <pre><code>'{"errorDescription":"n/a","errorCode":"500"}'
  </code></pre>
  
  <p>Which isn't very useful (no useful information in the headers either)</p>
  
  <p>I'm using the following python code, using the requests library</p>
  
  <pre><code>import requests
  
  conv_id = "conv-uuid-here"
  client_id = "client-id-here"
  client_secret = "client-secret-here"
  token = requests.request("POST", "https://circuitsandbox.net/rest/v2/oauth/token",
                           headers={
                               "Content-Type": "application/x-www-form-urlencoded"
                           },
                           data={
                               "grant_type": "client_credentials",
                               "scope": "ALL",
                           },
                           auth=(client_id, client_secret)
                           ).json()["access_token"]
  
  r = requests.request("POST", "https://circuitsandbox.net/rest/v2/conversations/{conv_id}/messages".format(conv_id=conv_id),
                   **{
                       "json": {
                           "content": "this is a test",
                           "convId": conv_id
                       },
                       "headers": {
                           "Authorization": "Bearer {}".format(token),
                           "Content-Type": "application/json"
                       }
                   })
  </code></pre>
  
  <p>So if you replace <code>token =</code> with a token retrieved from the swagger api docs (<a href="https://circuitsandbox.net/rest/v2/swagger/ui/index.html" rel="nofollow noreferrer">https://circuitsandbox.net/rest/v2/swagger/ui/index.html</a>)
  it works just fine (But it posts from the logged in user, not the bot).</p>
  
  <p>So are there certain endpoints that don't work when using different methods of authentication, and if so, where can I find documentation on it? (Client credentials grant vs implicit grant, I can't use an implicit grant since I do not have an redirect url)</p>
  
  <p>Is there any way to get more information back from the server on this 500 error to help debug?</p>
  
  <p>Thanks</p>