How to configure API authentication between Mailgun and osTicket integration

I’m trying to set up email routing from Mailgun to my osTicket installation but running into authentication issues. The problem is that osTicket needs a proper API key for incoming requests, but I can’t figure out how to include this key when configuring Mailgun routes.

Currently my Mailgun route action looks like this:

forward("https://mysite.com/helpdesk/api/tickets.email")

When Mailgun tries to forward emails, osTicket logs show “API Error (401) Valid API key required” because the request doesn’t include authentication.

Is there a method to pass the API key along with the Mailgun forward action? Or should I consider switching to a different ticketing solution that works better with Mailgun’s routing system?

hey, you might wanna check if anonymous API access is on in your osTicket settings. also consider using the email fetching feature built-in osTicket, it could sidestep those auth issues you’re facing with Mailgun.

Had this exact problem when I set up osTicket with Mailgun about six months back. You need to add the API key as a URL parameter in your Mailgun route. Change your forward action to:

forward("https://mysite.com/helpdesk/api/tickets.email?api-key=YOUR_API_KEY")

Swap YOUR_API_KEY with the real key from osTicket admin panel (Manage > API Keys). Also check that API access for email processing is turned on in your osTicket config. This fixed our setup completely - no more 401 errors.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.