Skip to content

Domains

Igor Balos edited this page Oct 29, 2018 · 1 revision

With API client you can easily manage all your account domains. Check out the examples of some of the API requests you can do with the library.

For these API requests you will need to use a account API token. Once you obtain it, you will need to use account API client.

let postmark = require("postmark")
const accountToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"
let accountClient = new postmark.AccountClient(accountToken);

Retrieve all existing domains in your account

accountClient.getDomains().then(result => {
    console.log(result);
});

Retrieve single domain details

accountClient.getDomainDetails(12345).then( result => {
    console.log(result);
});

Create a new domain

accountClient.createDomain({Name: "example.com"}).then( result => {
    console.log(result);
});```

## Trigger DKIM verification for your domain

``` javascript
accountClient.verifyDomainDKIM(12345).then( result => {
    console.log(result);
});

Trigger Return Path verification for your domain

accountClient.verifyDomainReturnPath(12345).then( result => {
    console.log(result);
});

Trigger rotation of domain DKIM key

accountClient.rotateDomainDKIM(12345).then( result => {
    console.log(result);
});

Delete one of existing domains.

accountClient.deleteDomain(12345).then( result => {
    console.log(result);
});