@smtpcom/smtpcom

SMTP.com API V4 client

Usage no npm install needed!

<script type="module">
  import smtpcomSmtpcom from 'https://cdn.skypack.dev/@smtpcom/smtpcom';
</script>

README

Tests codecov

SMTP.com API

JavaScript client for SMTP.com API V4

Installation

npm install smtpcom 

Getting Started

Please follow the installation instruction and execute the following JS code:

var SmtpComApi = require('@smtpcom/smtpcom');

var defaultClient = SmtpComApi.ApiClient.instance;
// Configure API key authorization: apiID
var apiID = defaultClient.authentications['apiID'];
apiID.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiID.apiKeyPrefix['api_key'] = "Token"
// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix['X-SMTPCOM-API'] = "Token"
// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR USERNAME'
basicAuth.password = 'YOUR PASSWORD'

var api = new SmtpComApi.APIKeysApi()
var apiKey = "apiKey_example"; // {String} API Key Identificator.
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getAPIKey(apiKey, callback);

Documentation for API Endpoints

All URIs are relative to https://api.smtp.com

Class Method HTTP request Description
SmtpComApi.APIKeysApi getAPIKey GET /v4/api_keys/{api_key} Get API Key Details
SmtpComApi.APIKeysApi v4ApiKeysApiKeyDelete DELETE /v4/api_keys/{api_key} Delete an API Key
SmtpComApi.APIKeysApi v4ApiKeysApiKeyPatch PATCH /v4/api_keys/{api_key} Update API Key
SmtpComApi.APIKeysApi v4ApiKeysGet GET /v4/api_keys/ List All API Keys
SmtpComApi.APIKeysApi v4ApiKeysPost POST /v4/api_keys/ Create a New API Key
SmtpComApi.AccountApi v4AccountContactPatch PATCH /v4/account/contact Update Account Details
SmtpComApi.AccountApi v4AccountGet GET /v4/account/ Get Account Details
SmtpComApi.AlertsApi v4AlertsAlertIdDelete DELETE /v4/alerts/{alert_id} Delete Alert
SmtpComApi.AlertsApi v4AlertsAlertIdGet GET /v4/alerts/{alert_id} Get Alert Details
SmtpComApi.AlertsApi v4AlertsAlertIdPatch PATCH /v4/alerts/{alert_id} Update Alert Details
SmtpComApi.AlertsApi v4AlertsGet GET /v4/alerts/ List All Allerts
SmtpComApi.AlertsApi v4AlertsPost POST /v4/alerts/ Create New Alert
SmtpComApi.CallbacksApi v4CallbacksDelete DELETE /v4/callbacks/ Delete All Callbacks
SmtpComApi.CallbacksApi v4CallbacksEventDelete DELETE /v4/callbacks/{event} Delete Callback
SmtpComApi.CallbacksApi v4CallbacksEventGet GET /v4/callbacks/{event} Get Callback Details
SmtpComApi.CallbacksApi v4CallbacksEventPatch PATCH /v4/callbacks/{event} Update Callback Details
SmtpComApi.CallbacksApi v4CallbacksEventPost POST /v4/callbacks/{event} Create Callback
SmtpComApi.CallbacksApi v4CallbacksGet GET /v4/callbacks/ List All Callbacks
SmtpComApi.CallbacksApi v4CallbacksLogGet GET /v4/callbacks/log View Callback Logs
SmtpComApi.ChannelsApi getSender GET /v4/channels/{name} Get Channel Details
SmtpComApi.ChannelsApi v4ChannelsGet GET /v4/channels/ Get All Channels
SmtpComApi.ChannelsApi v4ChannelsNameDelete DELETE /v4/channels/{name} Delete a Channel
SmtpComApi.ChannelsApi v4ChannelsNamePatch PATCH /v4/channels/{name} Update Channel Details
SmtpComApi.ChannelsApi v4ChannelsPost POST /v4/channels/ Create a New Channel
SmtpComApi.DKIMsApi v4DomainsDomainNameDelete DELETE /v4/domains/{domain_name} Delete Domain
SmtpComApi.DKIMsApi v4DomainsDomainNameDkimKeysDelete DELETE /v4/domains/{domain_name}/dkim_keys Delete DKIM for Domain
SmtpComApi.DKIMsApi v4DomainsDomainNameDkimKeysGet GET /v4/domains/{domain_name}/dkim_keys Get DKIM for Domain
SmtpComApi.DKIMsApi v4DomainsDomainNameDkimKeysPatch PATCH /v4/domains/{domain_name}/dkim_keys Update DKIM Key Details
SmtpComApi.DKIMsApi v4DomainsDomainNameDkimKeysPost POST /v4/domains/{domain_name}/dkim_keys Add DKIM for Domain
SmtpComApi.DKIMsApi v4DomainsDomainNameGet GET /v4/domains/{domain_name} Get Domain Details
SmtpComApi.DKIMsApi v4DomainsDomainNamePatch PATCH /v4/domains/{domain_name} Update Domain Details
SmtpComApi.DKIMsApi v4DomainsGet GET /v4/domains/ Get All Registered Domains
SmtpComApi.DKIMsApi v4DomainsPost POST /v4/domains/ Register a Domain
SmtpComApi.MessagesApi v4MessagesGet GET /v4/messages Get Detailed Messages Info
SmtpComApi.MessagesApi v4MessagesMimePost POST /v4/messages/mime Send MIME Message
SmtpComApi.MessagesApi v4MessagesPost POST /v4/messages Send a Message
SmtpComApi.ReportsApi v4ReportsGet GET /v4/reports/ Get All Reports
SmtpComApi.ReportsApi v4ReportsOndemandPost POST /v4/reports/ondemand Create On-Demand Report
SmtpComApi.ReportsApi v4ReportsPeriodicPost POST /v4/reports/periodic Create Periodic Report
SmtpComApi.ReportsApi v4ReportsPeriodicReportIdDelete DELETE /v4/reports/periodic/{report_id} Delete a Periodic Report
SmtpComApi.ReportsApi v4ReportsPeriodicReportIdPatch PATCH /v4/reports/periodic/{report_id} Update Periodic Report
SmtpComApi.ReportsApi v4ReportsReportIdGet GET /v4/reports/{report_id} Get Report Details
SmtpComApi.StatisticsApi v4StatsDurationSliceSliceSpecifierGroupByGet GET /v4/stats/{duration}/{slice}/{slice_specifier}/{group_by} Return event aggregates for the specified slices and duration. Slices can be chained.

Documentation for Models

Documentation for Authorization

apiID

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

apiKey

  • Type: API key
  • API key parameter name: X-SMTPCOM-API
  • Location: HTTP header

basicAuth

  • Type: HTTP basic authentication