-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
2650 lines (2505 loc) · 86.1 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
version: 1.0.6
title: mailsac API Specification
x-logo:
url: "/img/mailsac-logo-v2.png"
altText: 'mailsac logo'
description: |
## About the API
The Mailsac API allows for interacting with Mailsac services, including checking email,
email validations, setting up forwarding addresses, receiving web socket email messages,
and sending outbound mail.
[**Get a free API key**](https://mailsac.com/api-keys)
Test the Mailsac API online:
* [**Swagger UI Explorer** →](https://mailsac.com/docs/swagger)
**Base API Endpoint**:
* `https://mailsac.com/api/`
* _All API documentation is relative to this endpoint._
**OpenAPI Spec**:
* [Download JSON](https://mailsac.com/openapi.json)
* [Download YAML](https://mailsac.com/openapi.yml)
### Support and Resources
* [npm Node.js and Browser library - @mailsac/api](https://www.npmjs.com/package/@mailsac/api)
* [Full Documentation and Guides](https://docs.mailsac.com)
* [Community Support and Discussion Forums](https://forum.mailsac.com/forums/)
* [Web socket example in Node.js - ruffrey](https://github.com/ruffrey/mailsac-node-websocket-example)
Paid Email Support, Pre-Sales
[Terms of Service](https://docs.mailsac.com/en/latest/about/terms_of_service.html)
[Privacy Policy](https://docs.mailsac.com/en/latest/about/privacy_policy.html)
# servers: section will be automatically replaced by backend
servers:
- url: https://mailsac.com/api
description: Mailsac API
tags:
# Authentication section is just at the top of the API, but is not really a tag.
- name: 'Authentication Guide'
description: |
[API keys](https://mailsac.com/api-keys) are used to establish your identity with the Mailsac API.
Keys can be passed as a header, querystring parameter, or request body json field.
### API Key Format
Example Key:
> `k_eoj1mn7x5y61w0egs25j6xrv`
API keys are alphanumeric, cryptographically-random tokens.
## Get an API Key
[All subscription levels, including free accounts, may create API keys.](https://mailsac.com/v2/credentials/keys)
API keys cannot be managed by other API keys.
Go to the [Credentials > API Keys & Users](https://mailsac.com/v2/credentials/keys) from the Dashboard to manage your account's API keys.
### Multiple Keys
The Free and Indie tiers allow just one API key. That works fine for an individual developer or QA tester.
[Some subscription tiers](https://mailasc.com/pricing) can create multiple API keys, and name each one - useful for managing many apps, users, and deployment environments.
There's no limit on the number of API credentials which can be generated for the tiers allowing more than one to be created.
### API Website Logins
[Some subscription tiers](https://mailasc.com/pricing) also allow API credentials to be used to log into the website user interface.
## Auth Option 1: HTTP Header
Use the API key as a request header named `Mailsac-Key`.
```
HTTP/1.x 200 OK
GET /api/addresses/[email protected]/messages
Host: mailsac.com
Mailsac-Key: k_eoj1mn7x5y61w0egs25j6xrv
```
Check that your API key is working:
```bash
curl --header "Mailsac-Key: k_eoj1mn7x5y61w0egs25j6xrv" https://mailsac.com/api/me
```
which will return a JSON object with your account details.
```json
{
"_id": "myaccount_name_here",
"email": "[email protected]"
/* more props */
}
```
## Auth Option 2: Query String Parameter
In the query section of the URL (after `?`) add a parameter for `_mailsacKey`.
```bash
curl https://mailsac.com/api/addresses/[email protected]/messages?_mailsacKey=k_eoj1mn7x5y61w0egs25j6xrv
```
Note: this is the least secure option. We recommend using Option 1: HTTP Header.
## Auth Option 3: Request JSON Body
During a POST, PATCH, or PUT request, add a JSON field for `_mailsacKey`.
```json
{
"_mailsacKey": "k_eoj1mn7x5y61w0egs25j6xrv",
/* more POST, PUT props etc. */
}
```
- x-displayName: Email Messages API
name: Messages
description: |
This section of the API deals with email messages. Mailsac parses messages into many formats,
and can return various bits of metadata, like the sender, recipients, subject, headers, and
even all the external links.
#### Permissions and Disposability
By default, all emails sent to Mailsac are accepted and public. They are recycled regularly unless starred.
Setting up a _custom domain_ or _private forwarding address_ means only you can see messages sent to it.
Anyone can make API requests to view messages on a public (non-owned) inbox. Anyone can also delete messages from public inboxes.
Throttling is frequently an issue on public inboxes. We strongly recommend using a custom domain or private forwarding address.
- x-displayName: Email Addresses API
name: Addresses
description: |
This section contains APIs for creating and deleting enhanced private addresses, and configuring
message routing.
It is not always necessary to create an email address
using these APIs. Mailsac will accept nearly any email. Creating an email address allows it to
kept private. Its mail can be automatally routed to another email address, web sockets, webhooks,
and Slack.
- x-displayName: Email Validations API
name: emailValidation
description: |
This setion contains APIs to help determine is an email address is a valid format, whether
it is a disposable address, and the domains or IP addresses it is associated with (in case
you want to do your own additional lookups or restrictions).
There are two routes for validating email addresses.
The GET route is for quickly testing in a web browser, or for testing one email address at a
time. The GET route will return a JSON object.
The POST route accepts an array of up to 50 email addresses and will return an array.
- x-displayName: Domains API
name: Domains
description: |
This section contains APIs for managing custom domains. It is not complete and will be updated
with more endpoints soon.
- x-displayName: Email Message Attachments
name: Attachments
description: |
This section contains APIs for finding and downloading email message attachments.
- x-displayName: User Account API
name: Account
description: |
This section contains APIs related to the current user and account.
- x-displayName: Email Stats API
name: messageStats
description: |
This section contains APIs for researching public disposable email. It may be most relevant for
email security researchers.
paths:
'/addresses':
get:
operationId: ListAddresses
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: List all enhanced email addresses
description: |
Get an array of enhanced private inbox address objects for the account.
These addresses must be setup ("reserved") using `POST /api/addresses/:email`, or
[on the Add Email Address page](https://mailsac.com/private-address).
responses:
'200':
description: List of enhanced address objects
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddressList'
'401':
$ref: '#/components/responses/UnauthorizedError'
'/addresses/{email}':
parameters:
- $ref: '#/components/parameters/EmailString'
get:
operationId: GetAddress
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: "Fetch an address or check if it is reserved"
responses:
'200':
description: 'Returns an object if owned by the current account, OR is not owned. Includes the `encryptedInbox` field. If not owned, will omit the `owner` key.'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddress'
'401':
description: 'Returns 401 if owned by another account.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
post:
operationId: CreateAddress
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Reserve (create/own) a private email address'
description: |
Sets the email address private and "owned" by the account. All messages which already exist,
and any future messages which are received, will be private to this account only.
An email address must be reserved to be able to forward messages to another email address,
Slack, web sockets, or webhooks. Public email addresses, and private email addresses under
a custom domain, are not routeable.
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePrivateAddressForwarding'
responses:
'200':
description: 'Returns the newly created email address'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddress'
'400':
description: 'Already reserved by the current user'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
'401':
description: 'Owned by another account'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
put:
operationId: UpdateAddress
tags:
- Addresses
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
summary: Update private email address forwarding and metadata
description: |
For a private email address, set it to forward to another place.
It can be forwarded to another email (with `via mailsac` indicator), to a websocket, to a webhook,
or to a Slack channel.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePrivateAddressForwarding'
responses:
'200':
description: 'email forwarding successfully configured'
'401':
$ref: '#/components/responses/UnauthorizedError'
delete:
operationId: DeleteAddress
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
parameters:
- $ref: '#/components/parameters/DeleteAddressMessagesFlag'
summary: 'Release an enhanced email address'
description: |
Removes this enhanced private address from ownership by the account. Any email received to the
address's inbox will be public in the future, unless the address was under a custom domain
which is set private.
responses:
'200':
description: 'successfully released address'
'400':
description: 'Not currently owned by the current account, or already deleted.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
'401':
description: 'Owned by another account.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
'/addresses/{email}/availability':
parameters:
- $ref: '#/components/parameters/EmailString'
get:
operationId: CheckAvailability
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Check address ownership'
responses:
'200':
$ref: '#/components/responses/EmailAddressAvailability'
'/private-addresses-bulk':
post:
operationId: CreateAddresses
tags:
- Addresses
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Reserve multiple enhanced addresses'
description: |
Reserves multiple enhanced private addresses. The max addresses per request is 100.
It is not necessary to create enhanced addresses before receiving email. Enhanced addresses
are only necessary to forward messages to another email address, Slack, web sockets, webhooks,
or fetch messages over POP3.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
addresses:
$ref: '#/components/schemas/EmailStringList'
responses:
'200':
description: 'Returns the newly created email addresses'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddressList'
'400':
description: 'Not enough enhanced address credits'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponseBody'
'401':
$ref: '#/components/responses/UnauthorizedError'
'/validations/addresses/{email}':
parameters:
- $ref: '#/components/parameters/EmailString'
get:
operationId: ValidateAddress
tags:
- emailValidation
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Validate an email address and if it is disposable
description: |
Determine whether an email address is a valid format, whether it is a disposable address,
and the domains or IP addresses it is associated with.
responses:
'200':
description: EmailAddressIntegrity object
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddressIntegrity'
'/validations/addresses':
post:
operationId: ValidateAddressesBulk
tags:
- emailValidation
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Validate up to 50 email addresses
description: |
Determine whether an email address is a valid format, whether it is a disposable address,
and the domains or IP addresses it is associated with.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
emails:
$ref: '#/components/schemas/EmailStringList'
responses:
'200':
description: 'Array of EmailAddressIntegrity objects'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailAddressIntegrityList'
'/addresses/{email}/message-count':
parameters:
- $ref: '#/components/parameters/EmailString'
get:
operationId: CountMessages
tags:
- Messages
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
summary: Count messages for an email inbox
description: >-
Get the number of messages for an email inbox address.
**It is NOT necessary to reserve the address** before using this route. Whether it is
an address on a custom domain, or a public domain, or mailsac.com, the mail can be counted
as long as nobody else owns it.
responses:
'200':
description: 'Email messages'
content:
application/json:
schema:
properties:
count:
type: number
example: 3
inbox:
type: string
example: "[email protected]"
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/OwnedByAnotherUser'
'/addresses/{email}/messages':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/Until'
- $ref: '#/components/parameters/limit'
get:
operationId: ListMessages
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: List messages for an email inbox
description: >-
Get a list of messages for the email address.
Messages are always **sorted in decending order by when they were received**, with the newest message
always in the first position of the array.
The email message objects are abbreviated to provide basic meta data. To get more information about
a specific message, use `GET /api/addresses/{email}/messages/{messageId}`.
**It is NOT necessary to reserve the address** before checking mail! Whether it is
an address on a custom domain, or a public domain, or mailsac.com, the mail can be checked with
this route.
responses:
'200':
description: 'Email messages'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailMessageList'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/OwnedByAnotherUser'
delete:
operationId: DeleteAllMessages
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Delete all messages for an email inbox
description: |
This deletes all messages for a specific email address.
The address must be an owned address or an address in a owned domain.
Starred messages will not be deleted. Use `DELETE /addresses/{email}/messages/{messageId}`
to remove starred messages or unstar the messages before calling this route.
responses:
'204':
description: 'All non-starred messages deleted'
'401':
$ref: '#/components/responses/UnauthorizedError'
'/addresses/starred/messages':
get:
operationId: ListStarredMessages
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: List starred (saved) messages on the account
description: >-
Get a list of messages that have been saved and made private for the
entire account using the "star message" feature.
Messages recieved via the Capture Service will also show up as starred IF the `capturePrivate`
flag on the account is enabled.
responses:
'200':
description: 'List of email messages'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailMessageList'
'401':
$ref: '#/components/responses/UnauthorizedError'
'/addresses/{email}/messages/{messageId}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
get:
operationId: GetMessageMetadata
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Get email message metadata'
description: |
Retrieves metadata about a single email message. This route includes additional metadata
not available when listing messages, such as parsed links from the text or HTML body, and
attachment md5sums.
To get even more information about message attachments, like filenames, see the
Attachments API.
To get the entire original SMTP message, see the "raw" message route.
responses:
'200':
description: 'Email message full object'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailMessage'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
delete:
operationId: DeleteMessage
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Delete an email message
description: 'Deletes an individual email message. There is no trash or undo.'
responses:
'200':
description: 'deletes an email message'
content:
application/json:
schema:
type: object
properties:
_id:
$ref: '#/components/schemas/MessageId'
inbox:
$ref: '#/components/schemas/EmailString'
message:
type: string
example: "Message was deleted."
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/raw/{email}/{messageId}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/BrowserDownload'
get:
operationId: GetFullRawMessage
tags:
- Messages
summary: Get original SMTP message
description: |
Gets the entire original SMTP message transport - everything that was sent over the network
to Mailsac's inbound servers, plus any Mailsac-generated `Received` headers, and
special `x-mailsac-*` headers.
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
example: |
Received: from 107.174.77.77 by frontend1-172-31-29-224 via 172.31.99.99 with
HTTP id 1xyuM9Oexample for <[email protected]>; Mon Dec 24 2018 15:23:55 UTC
Received: from 107.174.66.66 by smtp-in2-172-31-42-57 via 172.31.88.88 (proxy)
with SMTP id 1xyuM9Oexample for <[email protected]>; Mon, 24 Dec 2018 15:23:55 UTC
X-Mailsac-Whitelist: [email protected],[email protected],107.174.234.77
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailsac.com;
q=dns/txt; s=mailsacrelay;
bh=QK4Dkk9a92aiAvanYe/AQdKO2djgexample=;
h=from:subject:to:mime-version:content-type:list-unsubscribe;
b=jWPuv7tyPRdH+QBKJdOX5Bxjjy82jaaVPZH5p17prXCoZQXlqg/tbqEiPeU6LiwyWfnWsQZV
vpeh1taqZq4EqiM+5tjmF7W/exampleo=
Content-Type: multipart/alternative;
boundary="----sinikael-?=_1-1545665044444.8772521444444"
Received: from frontend2-172-31-99-99 ([54.190.149.200]) with HTTP by
cranberry; Mon Dec 24 2018 10:23:46 GMT-0500 (Eastern Standard Time)
Received: from ruffrey ([email protected]) ([98.208.22.74]) with HTTP id
fe-zi5dp0gwhaa by frontend2-172-31-37-24 ([54.190.149.200]); Mon Dec 24
2018 15:23:46 GMT+0000 (Coordinated Universal Time)
From: [email protected]
Subject: test
Message-ID: <[email protected]>
List-Unsubscribe: <mailto:[email protected]>
Date: Mon, 24 Dec 2018 15:23:54 +0000
MIME-Version: 1.0
------sinikael-?=_1-15456650346550.8772521546394454
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
hi testing
let's go
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/addresses/{email}/messages/{messageId}/headers':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/BrowserDownload'
get:
operationId: GetHeaders
tags:
- Messages
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
summary: Get parsed message headers
description: |
Returns pre-parsed message headers in one of 3 formats - `json`, `json-ordered`, or `plain`.
If no querystring parameter is provided, the default format will be `json`.
Every email is different; fields in the below examples are not guaranteed to exist.
parameters:
- name: messageHeadersFormat
in: query
required: false
schema:
type: string
enum:
- json
- json-ordered
- plain
responses:
'200':
$ref: '#/components/responses/MessageHeaders'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/dirty/{email}/{messageId}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/BrowserDownload'
get:
operationId: GetBodyDirty
tags:
- Messages
summary: Get message HTML body (dirty)
description: |
Get a message's HTML content.
Attached images are inlined and nothing has been stripped.
When no HTML body was sent in the original message, a simple HTML body will be created.
Use the querystring param ?download=1 to trigger file download in browser.
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
responses:
'200':
description: OK
content:
text/html:
schema:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/body/{email}/{messageId}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/BrowserDownload'
get:
operationId: GetBodySanitized
tags:
- Messages
summary: Get the message HTML body (sanitized)
description: |
Get safe HTML from an email message. Scripts, images and links are stripped out. This HTML
is safer to render than the potentially "dirty" original HTML.
When no HTML body was sent in the original message, a simple HTML body will be created.
Use the querystring param ?download=1 to trigger file download in browser.
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
responses:
'200':
description: OK
content:
text/html:
schema:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/text/{email}/{messageId}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/BrowserDownload'
get:
operationId: GetBodyPlainText
tags:
- Messages
summary: 'Get message plaintext'
description: |
Get a message's text content. If the original message only contained HTML, a simple plain
text body will be generated.
HTTP links in the plain text email will be available when fetching the message's metadata
at the `message.links[]` property.
Use the querystring param ?download=1 to trigger file download in browser.
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/addresses/{email}/messages/{messageId}/star':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
put:
operationId: ToggleMessageStar
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Star (save) a message
description: |
Toggle a message's *starred* status so it will not be automatically recycled when the account's
message storage limit is reached.
There is no PUT body.
It returns only the message metadata.
responses:
'200':
description: 'Toggle starred status to protect from deletion'
content:
application/json:
schema:
$ref: '#/components/schemas/EmailMessageShort'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/addresses/{email}/messages/{messageId}/labels/{label}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/Label'
put:
operationId: AddMessageLabel
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Add a label to a message
description: |
To help organize messages and group messages together, add a label to a message. Labels
are used in the Inbox UI to group messages.
When successful, returns 200 with a subset of the message object.
When the label already exists on the message, the message is not modified and the API
endpoint returns 200.
No PUT body is needed.
responses:
'200':
description: 'Sets the specified label on a message.'
content:
application/json:
schema:
type: object
properties:
_id:
$ref: '#/components/schemas/MessageId'
labels:
$ref: '#/components/schemas/MessageLabels'
'401':
$ref: '#/components/responses/UnauthorizedError'
delete:
operationId: DeleteMessageLabel
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: Remove a label from a message
description: |
Removes a label from a message. Returns 200 with a subset of the message object when successful.
When the label did not exists on the message, the message is not modified and the API endpoint returns 200.
responses:
'200':
description: 'Removes the label from a message.'
content:
application/json:
schema:
type: object
properties:
_id:
$ref: '#/components/schemas/MessageId'
labels:
$ref: '#/components/schemas/MessageLabels'
'401':
$ref: '#/components/responses/UnauthorizedError'
404:
$ref: '#/components/responses/MessageNotFound'
'/addresses/{email}/messages/{messageId}/folder/{folder}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/MessageFolder'
put:
operationId: SetMessageFolder
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Move a message into a folder'
description: |
Move the message to a different mail folder.
No new folders can be added. To organize mail, use labels.
No PUT body is needed.
responses:
'200':
description: 'Moved message to folder'
content:
application/json:
schema:
type: object
properties:
_id:
$ref: '#/components/schemas/MessageId'
folder:
$ref: '#/components/schemas/MessageFolder'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/addresses/{email}/messages/{messageId}/read/{readBoolean}':
parameters:
- $ref: '#/components/parameters/EmailString'
- $ref: '#/components/parameters/messageId'
- $ref: '#/components/parameters/readBoolean'
put:
operationId: SetMessageReadStatus
tags:
- Messages
security:
- APIKeyQueryParam: []
- APIKeyHeader: []
summary: 'Set message read/unread status'
description: |
Change the read state of a message.
Pass `readBoolean` as `true` to mark the message as read, and `false` to mark it as unread.
The default for any new message `false` (unread).
No PUT body is needed.
responses:
'200':
description: 'Set read/unread status'
content:
application/json:
schema:
type: object
properties:
_id:
$ref: '#/components/schemas/MessageId'
folder:
$ref: '#/components/schemas/readBoolean'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
$ref: '#/components/responses/MessageNotFound'
'/inbox':
parameters:
- $ref: '#/components/parameters/limit'
- name: since
in: query
description: 'Only fetch messages since this date'
required: false
schema:
$ref: '#/components/schemas/Date'
- $ref: '#/components/parameters/skip'
get:
operationId: ListInboxMessages
tags:
- Messages
security:
- APIKeyQueryParam: [ ]
- APIKeyHeader: [ ]
summary: Get all account messages paginated
description: |
Used by the Inbox UI to display all messages for the account, across all domains and private
addresses.
Returns email message short metadata, paginated, with the global account unread message count.
responses: