Bugfender exposes an API so that you can make your own queries programmatically instead of using our dashboard.

Here are some ideas on how our customers are using our API:

  • Build custom reports on business metrics
  • Copy logs over to an Elasticsearch instance to correlate them with other events in the internal network
  • Download all logs for archiving purposes
  • Display logs of a user in their customer support portal
  • Build security analytics

API access request

To use our API, you will need a Client ID and Client Secret. Please contact customer support to get yours. You will need to provide the redirect_uri to your server (more on that in the next section).

Please note the API access is only available in some plans.

Authentication

Bugfender uses OAuth 2.0 for authentication. Here is a quick summary on how to get started:

  • User authorization: to access a user's account, you'll need permission from them. Give them a URL like this, you will need to replace your client_id and redirect_uri:
https://dashboard.bugfender.com/auth/authorize?response_type=code&client_id=xxx&redirect_uri=urn:ietf:wg:oauth:2.0:oob

When the user authorizes your application, you will receive a callback with an authorization code to the redirect_uri. You can use the special URI urn:ietf:wg:oauth:2.0:oob to display the authorization code on screen instead.

  • Access token: once the user gave you a authorization code, you'll need to exchange it for an access token. Bugfender also automatically provides a refresh token. You can use the authorization code with your client_id and client_secret to obtain an access token like this:
curl -i -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=authorization_code&code=xxx&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client_id=xxx&client_secret=xxx" https://dashboard.bugfender.com/auth/token

This will produce an output like this:

{"access_token":"9e885e76-c0dc-4c09-bad6-f700b41ffd05","token_type":"bearer","refresh_token":"b83a5520-ce88-4010-a4f3-b0c09c37ffb5","expires_in":3600}
  • Refreshing the access token: access tokens will eventually expire. If you store the refresh_token, you can use it to get a new access_token and refresh_token to continue using the API without requesting authorization again:
curl -i -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token=b83a5520-ce88-4010-a4f3-b0c09c37ffb5&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client_id=xxx&client_secret=xxx" https://dashboard.bugfender.com/auth/token
  • Call the API: the access token can be used to call the API like this:
curl -i -H "Content-Type: application/json" -H "Authorization: Bearer 9e885e76-c0dc-4c09-bad6-f700b41ffd05" https://dashboard.bugfender.com/api/app/

Using the API

You can see all the things you can do with our API in the API documentation.


Questions?

If you've got any questions, please feel free to contact us!

Did this answer your question?