All requests to the API must be authenticated using an API Key.
Obtain your API Key
To obtain an API key, log in to the SMTP2GO App and navigate to the "Sending > API Keys" section.
On the API Keys page, click the "Add API Key" button to create an API Key. If you have an existing API Key, you can copy that or manage the settings by clicking on the API Key.
![apiKey4.png](https://files.readme.io/1fb8e14-API_Keys_-_Authentication.png)
API Key Settings and Customisation
During the setup of your API Key and at any time thereafter, you can modify the following:
- Set the Description of your API Key to show a friendly identifier.
- Set a Rate Limit for your API Key. This defaults to unlimited.
- Set the Permissions for your API Key. You can specify permissions to determine whether the key can access a particular endpoint.
- Enable the Unsubscribe Footer.
- Enable Open Tracking.
- Enable Click Tracking.
- Temporarily Disable your API Key or set it to Sandbox Mode.
- Enable Email Archiving.
- Set a BCC Address for Email Auditing.
- Enable Bounce Notifications.
Using your API Key
Every request you make to the SMTP2GO API must authenticate with an API Key by either including the api_key field or you can include an X-Smtp2go-Api-Key field in your header.
{
"api_key": "YourAPIKeyHere",
"search_subject": "Booking",
"event_types": ["opened", "clicked"],
"only_latest": true,
"limit": 1
}
{
'Content-Type': 'application/json',
'X-Smtp2go-Api-Key': 'YourAPIKeyHere'
}
Failure to supply an API Key, or supplying an API Key that is invalid or disabled, will result in a 401 - Unauthorised
error.