mailgun.js 12.2.0 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -210,6 +210,10 @@ The following service methods are available to instantiated clients. The example
210
210
  - [Methods](#methods)
211
211
  - [messages](#messages)
212
212
  - [create](#create)
213
+ - [retrieveStoredEmail](#retrievestoredemail)
214
+ - [resendEmail](#resendemail)
215
+ - [getMessagesQueueStatus](#getmessagesqueuestatus)
216
+ - [clearMessagesQueue](#clearmessagesqueue)
213
217
  - [domains](#domains)
214
218
  - [list](#list)
215
219
  - [get](#get)
@@ -243,6 +247,15 @@ The following service methods are available to instantiated clients. The example
243
247
  - [get](#get-2)
244
248
  - [generate](#generate)
245
249
  - [regenerate](#regenerate)
250
+ - [domain keys](#domain-keys)
251
+ - [list](#list-2)
252
+ - [listAll](#listall)
253
+ - [create](#create-3)
254
+ - [activate](#activate)
255
+ - [deactivate](#deactivate)
256
+ - [destroy](#destroy-2)
257
+ - [updateDKIMAuthority](#updatedkimauthority-1)
258
+ - [updateDKIMSelector](#updatedkimselector-1)
246
259
  - [events](#events)
247
260
  - [get](#get-3)
248
261
  - [Example with Date and *Filter field*](#example-with-date-and-filter-field)
@@ -254,7 +267,7 @@ The following service methods are available to instantiated clients. The example
254
267
  - [getAccount](#getaccount-1)
255
268
  - [getAccountUsage](#getaccountusage)
256
269
  - [suppressions](#suppressions)
257
- - [list](#list-2)
270
+ - [list](#list-3)
258
271
  - [Bounces Example](#bounces-example)
259
272
  - [Unsubscribes Example](#unsubscribes-example)
260
273
  - [Complaints Example](#complaints-example)
@@ -262,41 +275,41 @@ The following service methods are available to instantiated clients. The example
262
275
  - [Bounces Example](#bounces-example-1)
263
276
  - [Unsubscribes Example](#unsubscribes-example-1)
264
277
  - [Complaints Example](#complaints-example-1)
265
- - [create](#create-3)
278
+ - [create](#create-4)
266
279
  - [Bounces Example](#bounces-example-2)
267
280
  - [Unsubscribes Example](#unsubscribes-example-2)
268
281
  - [Unsubscribe from one tag](#unsubscribe-from-one-tag)
269
282
  - [Unsubscribe from particular tags](#unsubscribe-from-particular-tags)
270
283
  - [Complaints Example](#complaints-example-2)
271
- - [destroy](#destroy-2)
284
+ - [destroy](#destroy-3)
272
285
  - [Bounces Example](#bounces-example-3)
273
286
  - [Unsubscribes Example](#unsubscribes-example-3)
274
287
  - [Complaints Example](#complaints-example-3)
275
288
  - [webhooks](#webhooks)
276
- - [list](#list-3)
289
+ - [list](#list-4)
277
290
  - [get](#get-5)
278
- - [create](#create-4)
291
+ - [create](#create-5)
279
292
  - [update](#update-2)
280
- - [destroy](#destroy-3)
293
+ - [destroy](#destroy-4)
281
294
  - [routes](#routes)
282
- - [list](#list-4)
295
+ - [list](#list-5)
283
296
  - [get](#get-6)
284
- - [create](#create-5)
297
+ - [create](#create-6)
285
298
  - [update](#update-3)
286
- - [destroy](#destroy-4)
299
+ - [destroy](#destroy-5)
287
300
  - [validate](#validate)
288
301
  - [get](#get-7)
289
302
  - [multiple validation](#multiple-validation)
290
- - [create](#create-6)
291
- - [list](#list-5)
303
+ - [create](#create-7)
304
+ - [list](#list-6)
292
305
  - [get](#get-8)
293
- - [destroy](#destroy-5)
306
+ - [destroy](#destroy-6)
294
307
  - [mailing lists](#mailing-lists)
295
- - [list](#list-6)
308
+ - [list](#list-7)
296
309
  - [get](#get-9)
297
- - [create](#create-7)
310
+ - [create](#create-8)
298
311
  - [update](#update-4)
299
- - [destroy](#destroy-6)
312
+ - [destroy](#destroy-7)
300
313
  - [mailing list members](#mailing-list-members)
301
314
  - [listMembers](#listmember)
302
315
  - [getMember](#getmember)
@@ -305,39 +318,39 @@ The following service methods are available to instantiated clients. The example
305
318
  - [updateMember](#updatemember)
306
319
  - [destroyMember](#destroymember)
307
320
  - [subaccounts](#subaccounts)
308
- - [list](#list-7)
321
+ - [list](#list-8)
309
322
  - [get](#get-10)
310
- - [create](#create-8)
323
+ - [create](#create-9)
311
324
  - [enable](#enable)
312
325
  - [disable](#disable)
313
- - [destroy](#destroy-7)
326
+ - [destroy](#destroy-8)
314
327
  - [setMonthlySendingLimit](#setmonthlysendinglimit)
315
328
  - [getMonthlySendingLimit](#getmonthlysendinglimit)
316
329
  - [updateSubaccountFeature](#updatesubaccountfeature)
317
330
  - [inbox placements](#inbox-placements)
318
331
  - [SeedsLists](#seedslists)
319
- - [list](#list-8)
332
+ - [list](#list-9)
320
333
  - [get](#get-11)
321
- - [create](#create-9)
334
+ - [create](#create-10)
322
335
  - [update](#update-5)
323
- - [destroy](#destroy-8)
336
+ - [destroy](#destroy-9)
324
337
  - [SeedsLists Attributes](#attributes)
325
- - [list](#list-9)
338
+ - [list](#list-10)
326
339
  - [get](#get-12)
327
340
  - [SeedsLists Filters](#filters)
328
- - [list](#list-10)
341
+ - [list](#list-11)
329
342
  - [Providers](#providers)
330
- - [list](#list-11)
331
- - [Results](#results)
332
343
  - [list](#list-12)
344
+ - [Results](#results)
345
+ - [list](#list-13)
333
346
  - [get](#get-13)
334
- - [destroy](#destroy-9)
347
+ - [destroy](#destroy-10)
335
348
  - [getResultByShareId](#getresultbyshareid)
336
349
  - [Results Attributes](#attributes-1)
337
- - [list](#list-13)
350
+ - [list](#list-14)
338
351
  - [get](#get-14)
339
352
  - [Results Filters](#filters-1)
340
- - [list](#list-14)
353
+ - [list](#list-15)
341
354
  - [Sharing](#sharing)
342
355
  - [get](#get-15)
343
356
  - [update](#update-6)
@@ -362,7 +375,7 @@ The following service methods are available to instantiated clients. The example
362
375
 
363
376
  - #### create
364
377
 
365
- `mg.messages.create(domain, data)` - [api docs](https://documentation.mailgun.com/en/latest/api-sending.html)
378
+ `mg.messages.create(domain, data)` - [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/post-v3--domain-name--messages)
366
379
 
367
380
  Options:
368
381
 
@@ -501,7 +514,6 @@ The following service methods are available to instantiated clients. The example
501
514
  })
502
515
  .then(response => console.log(response))
503
516
  ```
504
-
505
517
  - Browser example of send file
506
518
 
507
519
  Before sending the file you need to somehow get the Blob of the file.
@@ -540,6 +552,153 @@ The following service methods are available to instantiated clients. The example
540
552
  }
541
553
  ```
542
554
 
555
+ - #### retrieveStoredEmail
556
+ [Link to api doc](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/get-v3-domains--domain-name--messages--storage-key-)
557
+
558
+ `mg.messages.retrieveStoredEmail(domain, storageKey)`
559
+
560
+ **storageKey** - Storage key from the email's associated events (Example: Accepted/Delivered events storage.key field). Mentioned events can be found on https://app.mailgun.com/ (Send -> logs).
561
+
562
+ *Note: Storage keys are available for the duration of your domain's message retention policy.*
563
+
564
+ Example:
565
+
566
+ ```JS
567
+ mg.messages.retrieveStoredEmail('sandbox-123.mailgun.org', 'BABEAAeEDgPUyeFqr-tATLaCfYqyqvLpbg')
568
+ .then(storedEmail => console.log(storedEmail)) // logs response data
569
+ .catch(err => console.error(err)); // logs any error
570
+ ```
571
+
572
+ Promise returns:
573
+
574
+ ```JS
575
+ {
576
+ 'Content-Type': 'multipart/alternative; boundary="boundary_12345"',
577
+ From: 'postmaster@sandbox.mailgun.org',
578
+ 'Message-Id': '<123.123@sandbox.mailgun.org>',
579
+ 'Mime-Version': '1.0',
580
+ Subject: 'Hello',
581
+ To: 'foo@example.com',
582
+ 'X-Mailgun-Deliver-By': 'Fri, 28 Nov 2025 18:02:00 +0000',
583
+ sender: 'postmaster@sandbox.mailgun.org',
584
+ recipients: 'foo@example.com',
585
+ from: 'postmaster@sandbox.mailgun.org',
586
+ subject: 'Hello',
587
+ 'body-html': '<a href="https://test.com">Test</a>',
588
+ 'body-plain': 'Testing some Mailgun awesomness!',
589
+ attachments: [],
590
+ 'content-id-map': {},
591
+ 'message-headers': [
592
+ ['Mime-Version', '1.0'],
593
+ [
594
+ 'Content-Type',
595
+ 'multipart/alternative; boundary="boundary_12345'
596
+ ],
597
+ ['Subject', 'Hello'],
598
+ ['From', 'postmaster@sandbox.mailgun.org'],
599
+ ['To', 'foo@example.com'],
600
+ ['X-Mailgun-Deliver-By', 'Fri, 28 Nov 2025 18:02:00 +0000'],
601
+ [
602
+ 'Message-Id',
603
+ '<123.123@sandbox.mailgun.org>'
604
+ ]
605
+ ],
606
+ 'stripped-html': '<a href="https://test.com">Test</a>',
607
+ 'stripped-text': 'Testing some Mailgun awesomness!',
608
+ 'stripped-signature': ''
609
+ }
610
+ ```
611
+
612
+ - ### resendEmail
613
+ [Link to api doc](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/post-v3-domains--domain-name--messages--storage-key-)
614
+
615
+ `mg.messages.resendEmail(domain, storageKey, recipient)`
616
+
617
+ **storageKey** - Storage key from the email's associated events (Example: Accepted/Delivered events storage.key field). Mentioned events can be found on https://app.mailgun.com/ (Send -> logs).
618
+
619
+ *Note: Storage keys are available for the duration of your domain's message retention policy.*
620
+
621
+ **recipient** - Email address of the recipient(s). Supports friendly name format.
622
+ Example: "Bob <bob@host.com>". Use commas to separate multiple recipients. Duplicate addresses are automatically ignored.
623
+
624
+ Example:
625
+
626
+ ```JS
627
+ mg.messages.resendEmail(
628
+ 'sandbox-123.mailgun.org',
629
+ 'BABEAAeEDgPUyeFqr-tATLaCfYqyqvLpbg',
630
+ 'foo@test.com, bar@test.com'
631
+ ).then(resendStatus => console.log(resendStatus)) // logs response data
632
+ .catch(err => console.error(err)); // logs any error
633
+ ```
634
+
635
+ Promise returns:
636
+
637
+ ```JS
638
+ {
639
+ id: '<20151025002517.117282.79817@sandbox-123.mailgun.org>',
640
+ message: 'Queued. Thank you.'
641
+ }
642
+ ```
643
+
644
+ - ### getMessagesQueueStatus
645
+ [Link to api doc](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/get-v3-domains--name--sending-queues)
646
+
647
+ `mg.messages.getMessagesQueueStatus(domain)`
648
+
649
+ Example:
650
+
651
+ ```JS
652
+ mg.messages.getMessagesQueueStatus('sandbox-123.mailgun.org')
653
+ .then(queueStatus => console.log(queueStatus)) // logs response data
654
+ .catch(err => console.error(err)); // logs any error
655
+ ```
656
+
657
+ Promise returns:
658
+
659
+ ```JS
660
+ {
661
+ regular: {
662
+ is_disabled: false,
663
+ disabled: {
664
+ until: null,
665
+ reason: ''
666
+ }
667
+ },
668
+ scheduled: {
669
+ is_disabled: true,
670
+ disabled: {
671
+ until: new Date('2025-11-28T18:02:00Z'),
672
+ reason: 'High load'
673
+ }
674
+ }
675
+ }
676
+ ```
677
+
678
+ - ### clearMessagesQueue
679
+ Deletes all scheduled and undelivered mail from the domain queue.
680
+
681
+ [Link to api doc](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/messages/delete-v3--domain-name--envelopes)
682
+
683
+ `mg.messages.getMessagesQueueStatus(domain, storageUrl)`
684
+
685
+ **storageUrl** - Mail's generated storage URL. e.g. https://storage-us-east4.api.mailgun.net/v3/example.com/envelopes. Can be found on https://app.mailgun.com/ (Send -> logs -> event). Allowed values: `storage-us-east4.api.mailgun.net`, `storage-us-west1.api.mailgun.net`, and `storage-europe-west1.api.mailgun.net`.
686
+
687
+ Example:
688
+
689
+ ```JS
690
+ mg.messages.clearMessagesQueue('sandbox-123.mailgun.org', 'storage-us-east4.api.mailgun.net')
691
+ .then(result => console.log(result)) // logs response data
692
+ .catch(err => console.error(err)); // logs any error
693
+ ```
694
+
695
+ Promise returns:
696
+ ```JS
697
+ {
698
+ message: "done"
699
+ }
700
+ ```
701
+
543
702
  ### Templates
544
703
 
545
704
  Mailgun’s templates uses a fork of the very popular template engine [handlebars](https://handlebarsjs.com/).
@@ -1059,75 +1218,10 @@ The following service methods are available to instantiated clients. The example
1059
1218
  ```
1060
1219
 
1061
1220
  - #### updateDKIMAuthority
1062
- You can delegate the domain authority to an other domain. Domain's authority is set to itself by default.
1063
-
1064
- `mg.domains.updateDKIMAuthority(domainAddress, data)` [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Domain-Keys/#tag/Domain-Keys/operation/PUT-v3-domains--name--dkim-authority)
1065
-
1066
- Example:
1067
-
1068
- ```JS
1069
- mg.domains.updateDKIMAuthority(domainAddress, {
1070
- self: true
1071
- })
1072
- .then(data => console.log(data)) // logs response data
1073
- .catch(err => console.error(err)); // logs any error
1074
- ```
1075
-
1076
- Data object accepts next properties:
1077
-
1078
- | Property | Description |
1079
- |:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
1080
- | self | Change the DKIM authority for a domain. If set to true, the domain will be the DKIM authority for itself even if the root domain is registered on the same mailgun account If set to false, the domain will have the same DKIM authority as the root domain registered on the same mailgun account |
1081
-
1082
- Promise returns:
1083
-
1084
- ```JS
1085
- {
1086
- message: 'Domain DKIM authority has been changed',
1087
- sending_dns_records: [
1088
- {
1089
- is_active: true,
1090
- cached: [],
1091
- name: 'sending_dns_record_name',
1092
- record_type: 'TXT',
1093
- valid: 'unknown',
1094
- value: 'sending_dns_record_value'
1095
- },
1096
- ...
1097
- ],
1098
- changed: true
1099
- }
1100
- ```
1221
+ `domains.updateDKIMAuthority` method is deprecated, and will be removed. Please use `domains.domainKeys.updateDKIMAuthority` instead.
1101
1222
 
1102
1223
  - #### updateDKIMSelector
1103
- Selector is the unique identifier of your key. It has to be different from other keys selector.
1104
-
1105
- `mg.domains.updateDKIMSelector(domainAddress, data)` [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Domain-Keys/#tag/Domain-Keys/operation/PUT-v3-domains--name--dkim-selector)
1106
-
1107
- Example:
1108
-
1109
- ```JS
1110
- mg.domains.updateDKIMSelector(domainAddress, {
1111
- dkimSelector: 'dkimSelector_value'
1112
- })
1113
- .then(data => console.log(data)) // logs response data
1114
- .catch(err => console.error(err)); // logs any error
1115
- ```
1116
-
1117
- Data object accepts next properties:
1118
-
1119
- | Property | Description |
1120
- |:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
1121
- | dkimSelector | Selector is the unique identifier of your key. It has to be different from other keys selector. |
1122
-
1123
- Promise returns:
1124
-
1125
- ```JS
1126
- {
1127
- message: 'DKIM selector changed',
1128
- status: 200
1129
- }
1130
- ```
1224
+ `domains.updateDKIMSelector` method is deprecated, and will be removed. Please use `domains.domainKeys.updateDKIMSelector` instead.
1131
1225
 
1132
1226
  - #### getIps
1133
1227
  **Deprecated, and will be removed in the future releases**
@@ -1821,6 +1915,280 @@ The following service methods are available to instantiated clients. The example
1821
1915
  }
1822
1916
  ```
1823
1917
 
1918
+ ### Domain Keys
1919
+
1920
+ - #### list
1921
+ List all domain keys for your domain, including active/inactive and valid/invalid ones.
1922
+
1923
+ `mg.domains.domainKeys.list(domainAddress, data)`
1924
+
1925
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/get-v4-domains--authority-name--keys)
1926
+
1927
+ Example:
1928
+
1929
+ ```JS
1930
+ mg.domains.domainKeys.list(domainAddress)
1931
+ .then(data => console.log(data)) // logs response data
1932
+ .catch(err => console.error(err)); // logs any error
1933
+ ```
1934
+
1935
+ Promise returns:
1936
+
1937
+ ```JS
1938
+ {
1939
+ items: [
1940
+ {
1941
+ signing_domain: 'authority.domain.tld',
1942
+ selector: 's1',
1943
+ dns_record: {
1944
+ is_active: true,
1945
+ cached: [],
1946
+ name: 's1._domainkey.authority.domain.tld',
1947
+ record_type: 'TXT',
1948
+ valid: 'unknown',
1949
+ value: 'expected dns value'
1950
+ }
1951
+ },
1952
+ ],
1953
+ status: 200
1954
+ }
1955
+ ```
1956
+
1957
+ - #### listAll
1958
+ List domain keys, and optionally filter by signing domain or selector. The page & limit data is only required when paging through the data.
1959
+
1960
+ `mg.domains.domainKeys.listAll(filterData)`
1961
+
1962
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/get-v1-dkim-keys)
1963
+
1964
+ Example:
1965
+
1966
+ ```JS
1967
+ mg.domains.domainKeys.listAll(
1968
+ {
1969
+ signingDomain: 'authority.domain.tld', // optional
1970
+ selector: 's1', // optional
1971
+ }
1972
+ )
1973
+ .then(data => console.log(data)) // logs response data
1974
+ .catch(err => console.error(err)); // logs any error
1975
+ ```
1976
+
1977
+ Promise returns:
1978
+
1979
+ ```JS
1980
+ {
1981
+ items: [
1982
+ {
1983
+ signing_domain: 'authority.domain.tld',
1984
+ selector: 's1',
1985
+ dns_record: {
1986
+ is_active: true,
1987
+ cached: [],
1988
+ name: 's1._domainkey.authority.domain.tld',
1989
+ record_type: 'TXT',
1990
+ valid: 'unknown',
1991
+ value: 'expected dns value'
1992
+ }
1993
+ },
1994
+ ],
1995
+ status: 200
1996
+ }
1997
+ ```
1998
+
1999
+ - #### create
2000
+ Create a domain key.
2001
+
2002
+ *Note that once private keys are created or imported they are never exported. Alternatively, you can import an existing PEM file containing a RSA private key in PKCS #1, ASn.1 DER format. Note, the pem can be passed as a file attachment or as a form-string parameter.*
2003
+
2004
+ `mg.domains.domainKeys.create(newKeyData)`
2005
+
2006
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/post-v1-dkim-keys)
2007
+
2008
+ Example:
2009
+
2010
+ ```JS
2011
+ mg.domains.domainKeys.create(
2012
+ {
2013
+ signingDomain: 'authority.domain.tld',
2014
+ selector: 's1',
2015
+ bits: '2048' // optional
2016
+ }
2017
+ )
2018
+ .then(data => console.log(data)) // logs response data
2019
+ .catch(err => console.error(err)); // logs any error
2020
+ ```
2021
+
2022
+ Promise returns:
2023
+
2024
+ ```JS
2025
+ {
2026
+ signing_domain: 'authority.domain.tld',
2027
+ selector: 's1',
2028
+ dns_record: {
2029
+ is_active: true,
2030
+ cached: [],
2031
+ name: 's1._domainkey.authority.domain.tld',
2032
+ record_type: 'TXT',
2033
+ valid: 'unknown',
2034
+ value: 'expected dns value'
2035
+ },
2036
+ status: 200
2037
+ }
2038
+ ```
2039
+
2040
+ - #### activate
2041
+ Activate a key to be used to DKIM sign emails with.
2042
+
2043
+ *Note: dns records must be valid for a domain key to be activated*
2044
+
2045
+ `mg.domains.domainKeys.activate(domainAddress, selector)`
2046
+
2047
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/put-v4-domains--authority-name--keys--selector--activate)
2048
+
2049
+ Example:
2050
+
2051
+ ```JS
2052
+ mg.domains.domainKeys.activate('authority.domain.tld', 's1')
2053
+ .then(data => console.log(data)) // logs response data
2054
+ .catch(err => console.error(err)); // logs any error
2055
+ ```
2056
+
2057
+ Promise returns:
2058
+
2059
+ ```JS
2060
+ {
2061
+ message: 'domain key activated',
2062
+ authority: 'authority.domain.tld',
2063
+ selector: 's1',
2064
+ active: true,
2065
+ status: 200,
2066
+ }
2067
+ ```
2068
+
2069
+ - #### deactivate
2070
+ Deactivating for a specified authority and/or selector means a key won't be used for signing email anymore, even if they are valid.
2071
+
2072
+ `mg.domains.domainKeys.deactivate(domainAddress, selector)`
2073
+
2074
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/put-v4-domains--authority-name--keys--selector--deactivate)
2075
+
2076
+ Example:
2077
+
2078
+ ```JS
2079
+ mg.domains.domainKeys.deactivate('authority.domain.tld', 's1')
2080
+ .then(data => console.log(data)) // logs response data
2081
+ .catch(err => console.error(err)); // logs any error
2082
+ ```
2083
+
2084
+ Promise returns:
2085
+
2086
+ ```JS
2087
+ {
2088
+ message: 'domain key deactivated',
2089
+ authority: 'authority.domain.tld',
2090
+ selector: 's1',
2091
+ active: true,
2092
+ status: 200,
2093
+ }
2094
+ ```
2095
+
2096
+ - #### destroy
2097
+ Delete a key.
2098
+
2099
+ **Domain keys are not recoverable after deletion so use with care**
2100
+
2101
+ `mg.domains.domainKeys.destroy(domainAddress, selector)`
2102
+
2103
+ [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/delete-v1-dkim-keys)
2104
+
2105
+ Example:
2106
+
2107
+ ```JS
2108
+ mg.domains.domainKeys.destroy('authority.domain.tld', 's1')
2109
+ .then(data => console.log(data)) // logs response data
2110
+ .catch(err => console.error(err)); // logs any error
2111
+ ```
2112
+
2113
+ Promise returns:
2114
+
2115
+ ```JS
2116
+ {
2117
+ message: 'success'
2118
+ }
2119
+ ```
2120
+
2121
+ - #### updateDKIMAuthority
2122
+ You can delegate the domain authority to an other domain. Domain's authority is set to itself by default.
2123
+
2124
+ `mg.domains.domainKeys.updateDKIMAuthority(domainAddress, data)` [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/put-v3-domains--name--dkim-authority)
2125
+
2126
+ Example:
2127
+
2128
+ ```JS
2129
+ mg.domains.domainKeys.updateDKIMAuthority(domainAddress, {
2130
+ self: true
2131
+ })
2132
+ .then(data => console.log(data)) // logs response data
2133
+ .catch(err => console.error(err)); // logs any error
2134
+ ```
2135
+
2136
+ Data object accepts next properties:
2137
+
2138
+ | Property | Description |
2139
+ |:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
2140
+ | self | Change the DKIM authority for a domain. If set to true, the domain will be the DKIM authority for itself even if the root domain is registered on the same mailgun account If set to false, the domain will have the same DKIM authority as the root domain registered on the same mailgun account |
2141
+
2142
+ Promise returns:
2143
+
2144
+ ```JS
2145
+ {
2146
+ message: 'Domain DKIM authority has been changed',
2147
+ sending_dns_records: [
2148
+ {
2149
+ is_active: true,
2150
+ cached: [],
2151
+ name: 'sending_dns_record_name',
2152
+ record_type: 'TXT',
2153
+ valid: 'unknown',
2154
+ value: 'sending_dns_record_value'
2155
+ },
2156
+ ...
2157
+ ],
2158
+ changed: true
2159
+ }
2160
+ ```
2161
+
2162
+ - #### updateDKIMSelector
2163
+ Selector is the unique identifier of your key. It has to be different from other keys selector.
2164
+
2165
+ `mg.domains.domainKeys.updateDKIMSelector(domainAddress, data)` [api docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys/put-v3-domains--name--dkim-selector)
2166
+
2167
+ Example:
2168
+
2169
+ ```JS
2170
+ mg.domains.domainKeys.updateDKIMSelector(domainAddress, {
2171
+ dkimSelector: 'dkimSelector_value'
2172
+ })
2173
+ .then(data => console.log(data)) // logs response data
2174
+ .catch(err => console.error(err)); // logs any error
2175
+ ```
2176
+
2177
+ Data object accepts next properties:
2178
+
2179
+ | Property | Description |
2180
+ |:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
2181
+ | dkimSelector | Selector is the unique identifier of your key. It has to be different from other keys selector. |
2182
+
2183
+ Promise returns:
2184
+
2185
+ ```JS
2186
+ {
2187
+ message: 'DKIM selector changed',
2188
+ status: 200
2189
+ }
2190
+ ```
2191
+
1824
2192
  ### Events
1825
2193
 
1826
2194
  - #### get