In this guide, you’ll learn how to set up your app integration and generate your set of Mautic API keys to connect and authorize your Mautic account. Follow these steps to generate your API keys:
- Navigate to Mautic Settings
- Go to Configuration > API Settings.
- Click on API Enabled and Enable HTTP basic auth toggle button and enable both.
Note: If you don’t enable these options, the API Credentials setting won’t appear in your Mautic CRM.
- After enabling those toggles, go to the API Credentials section to start with new APP.
- Click on New to create a fresh APP in Mautic
Start creating a new APP by filling valid credentials. Select OAuth2 for authorization protocol. Enter a new Name for the APP and Redirect URI.
- Your Redirection URL will be: https://your-site-url/wp-admin/admin.php
- Save the APP and you will get the keys for the connection. Use the keys as shown in the image.
- The refresh token is by default good for 14 days in which the user will need to reauthorize the application with Mautic. However, the refresh token’s expiration time is configurable through Mautic’s Configuration.
- You can set the Access token lifetime and Refresh token lifetime from Mautic Settings > Configuration > API Settings section.
- Increasing the lifetime for an access token and refresh token before connecting the extension to Mautic will be preferred. This will also avoid the manual reauthorization with Mautic app after refresh token expiration.
- Now you have your set of API keys, you only need mautic base URL for connection.
To get your mautic base URL
- Navigate to Mautic Settings > Configuration > General Settings
- Your Site URL is your Mautic Basic URL
Now you have all the details required for connecting your plugin to mautic. Enter all the details and save the settings.
After that, you will be all set for authorizing your mautic application. Click on Authorize.
On clicking the Authorize button, you will be redirected to your mautic and will be asked for permission to access your app. Click on Accept.
After providing the access to your application you will be redirected back to your plugin dashboard and your plugin will be successfully connected to your mautic account.
Before moving to the further steps please make sure all details ( connection status, account email and token renewal ) are present in provided boxes. If any of those details are missing you will need to clear your mautic cache and set up the connection again. For more information about clearing cache please refer to the troubleshooting guide.