Skip to content Skip to sidebar Skip to footer

Mailgun Post /messages Api Always Throw 401 Forbidden

I am trying to send Mailgun POST /messages API request in Android using retrofit library. Following is retrofit request: HTTP POST https://api:key-xxx/v3/sandboxxxx/messages Cache-

Solution 1:

I added following authorization header with Base64 encoded string of API key to the request, it started working.

request.addHeader("Authorization", "Basic "+getBase64String("api:key-xxxYOUR-API-KEY>"));

@Selvin: Thanks so much for sending wiki link :).

Solution 2:

you need to specify your mailgun region: mg.SetAPIBase(mailgun.APIBaseEU)

// Create an instance of the Mailgun Client
mg := mailgun.NewMailgun(yourDomain, privateAPIKey)
mg.SetAPIBase(mailgun.APIBaseEU)

Post a Comment for "Mailgun Post /messages Api Always Throw 401 Forbidden"