Why are my Mailgun domain registration API requests failing?

My API call for domain registration fails with an invalid parameters error, even with a correct API key. Must I predefine SMTP credentials? See revised code:

$apiHandler = new MailAPI(fetchToken());
$domainInfo = retrieveDomain();
$response = $apiHandler->execute('register-domain', [
    'domain_name' => 'exampletest.org',
    'password' => 'newSecureKey'
]);

hey, i had a similiar issue – try setting full smtp creds not just a password, check docs too. might be missing username in the call. good luck

Based on my experience, the issue was related to the fact that Mailgun expects a complete set of SMTP credentials. Although the documentation might not clearly indicate it, I found that just providing a password is insufficient. In my case, specifying both the username and password resolved the error, as Mailgun then accepted the parameters as valid. I recommend revisiting the API documentation and ensuring that each required field, including the SMTP username, is explicitly defined in your API request.

In my own experience, the root of the issue was that Mailgun expects a full set of SMTP parameters rather than just a password. I hit a similar obstacle when my domain registration kept failing and it turned out that omitting the SMTP username from my request was the problem. After updating my code to include the complete credentials, everything worked as expected. It’s important to double-check that each mandatory field is properly filled out in your API call, as the error message may not clearly indicate what’s missing.