-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1305 lines (1238 loc) · 40.2 KB
/
Copy pathopenapi.yaml
File metadata and controls
1305 lines (1238 loc) · 40.2 KB
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.1.0
info:
title: mailtrap-local API
version: 0.1.0
summary: Local email sandbox + catcher for individual developers — JSON `/api/v1/*`.
description: |
mailtrap-local is a local email sandbox: it runs on a developer's
machine, catches every message their app sends, and exposes the
sandbox over a JSON API at `/api/v1/*`. Field names use snake_case
on the wire (`from`, `to`, `message_id`, `tags`) — the same
convention used across the rest of the Mailtrap toolchain (sandbox
API, `mailtrap-cli`).
Notable features:
- **Single-string categories.** mailtrap-local stores one `category`
string per message (read at ingest from `X-MT-Category` — Mailtrap's
SMTP header convention — with `Category` as a fallback). The wire
format exposes this as `tags: string[]`, but the array is always
0 or 1 element (the category).
- **Mailtrap cloud + SMTP-relay extensions.** Endpoints under
`/cloud_connection` and `/relay_connection` configure forwarding to
a Mailtrap cloud sandbox (`POST /message/:id/send_to_cloud`) or a
generic SMTP relay (`POST /message/:id/release`).
Default bind is loopback only — `127.0.0.1:3550` for the API. There is no
auth: this is a single-user local tool.
contact:
name: Mailtrap
url: https://mailtrap.io
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://127.0.0.1:3550
description: Local mailtrap-local binary (default port)
tags:
- name: messages
description: Browse, fetch, search, delete, mark-as-read messages in the local sandbox.
- name: cloud_connection
description: Configure forwarding to a Mailtrap cloud sandbox.
- name: relay_connection
description: Configure forwarding through a generic SMTP relay (release-to-production).
- name: webhook_connection
description: Configure outbound webhook delivery on every captured message.
- name: internal
description: Endpoints consumed only by the bundled Go smtpd sidecar — not part of the public surface.
- name: meta
description: Build identity and other non-domain metadata.
paths:
# ---- Messages list / bulk operations ---------------------------------
/api/v1/messages:
get:
tags: [messages]
summary: List messages
description: |
Returns messages from the sandbox ordered newest-first. The `tags` field in
the envelope lists distinct **categories** across the
*unfiltered* sandbox — useful for rendering a category picker without a
second roundtrip.
operationId: listMessages
parameters:
- $ref: '#/components/parameters/Start'
- $ref: '#/components/parameters/Limit'
- name: category
in: query
description: |
**mailtrap-local extension.** Narrows the result set to messages whose
stored category equals this value (exact match). The envelope's `tags`
still reports the unfiltered distinct list so a picker stays populated.
required: false
schema:
type: string
example: welcome
responses:
'200':
description: Paginated list of message summaries.
content:
application/json:
schema:
$ref: '#/components/schemas/MessagesResponse'
put:
tags: [messages]
summary: Mark messages as read or unread
description: |
Toggles read state in bulk. With `ids` set, marks just those messages;
without `ids`, marks **all** messages.
operationId: updateMessagesRead
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [read]
properties:
read:
type: boolean
description: True = mark as read, false = mark as unread.
ids:
type: array
description: Optional. When omitted, applies to all messages.
items:
type: string
example:
read: true
ids: ["abc123", "def456"]
responses:
'200':
description: '"ok" plain-text body.'
content:
text/plain:
schema:
type: string
example: ok
delete:
tags: [messages]
summary: Delete messages
description: |
Two shapes are accepted:
- `{ "ids": ["abc", "def"] }` — delete those specific messages.
- `{ "all": true }` — wipe the entire sandbox.
Anything else (empty body, `{}`, `{"ids":[]}`, malformed JSON,
`{"all":false}`) is rejected. Wiping the sandbox has to be
explicit so a malformed body never silently truncates the
mailbox.
operationId: deleteMessages
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- type: object
required: [ids]
properties:
ids:
type: array
minItems: 1
items:
type: string
- type: object
required: [all]
properties:
all:
type: boolean
enum: [true]
examples:
byId:
summary: Delete specific messages
value:
ids: ["abc123", "def456"]
wipe:
summary: Wipe the entire sandbox
value:
all: true
responses:
'200':
description: '"ok" plain-text body.'
content:
text/plain:
schema:
type: string
example: ok
'400':
description: Body wasn't decodable JSON.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Body was decodable but didn't carry `ids` or `all`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ---- Search ----------------------------------------------------------
/api/v1/search:
get:
tags: [messages]
summary: Search messages
description: |
Free-words search across `subject`, `from_name`, `from_address`,
recipient addresses (denormalized), `snippet`, and `text_body`.
Whitespace splits the query into tokens; results AND across
tokens (each token must appear in at least one searchable field).
Case-insensitive.
A query DSL with operators (`from:`, `subject:`, `is:read`, `has:attachment`,
etc.) is **intentionally not parsed in v1** — ship the 80% use
case (just type a word) first and add the DSL when users ask.
Response shape mirrors `/api/v1/messages`. `total` /
`messages_count` reflect the *matched* set (not the entire
sandbox). The envelope's `tags` field still lists distinct
categories across the unfiltered sandbox so a caller can render
a category picker without a second roundtrip.
Empty / whitespace-only queries return an empty `messages`
array with zero counts — use `/api/v1/messages` for unfiltered
listing.
operationId: searchMessages
parameters:
- name: query
in: query
required: true
description: Whitespace-separated search tokens (ANDed).
schema:
type: string
example: welcome reset
- $ref: '#/components/parameters/Start'
- $ref: '#/components/parameters/Limit'
- name: category
in: query
required: false
description: Optionally narrow to a single category.
schema:
type: string
responses:
'200':
description: Paginated list of matching message summaries.
content:
application/json:
schema:
$ref: '#/components/schemas/MessagesResponse'
# ---- Per-message reads -----------------------------------------------
/api/v1/message/{id}:
parameters:
- $ref: '#/components/parameters/MessageID'
get:
tags: [messages]
summary: Get message detail
description: |
Returns the full parsed message including bodies and attachment metadata.
**Side effect:** marks the message as read (matches the documented behavior).
Pass the literal `latest` as `id` to fetch the most recent message
(convention).
operationId: getMessage
responses:
'200':
description: Full message detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'404':
$ref: '#/components/responses/NotFound'
/api/v1/message/{id}/raw:
parameters:
- $ref: '#/components/parameters/MessageID'
get:
tags: [messages]
summary: Get raw RFC822 source
description: |
Returns the full RFC822 source as `text/plain`. Pass `?dl=1` to receive a
`Content-Disposition: attachment` header for download in a browser.
operationId: getMessageRaw
parameters:
- name: dl
in: query
required: false
schema:
type: string
description: Any non-empty value forces a download response.
responses:
'200':
description: RFC822 source.
content:
text/plain:
schema:
type: string
'404':
$ref: '#/components/responses/NotFound'
/api/v1/message/{id}/headers:
parameters:
- $ref: '#/components/parameters/MessageID'
get:
tags: [messages]
summary: Get message headers
description: |
Returns parsed headers as a `{ "Header-Name": ["value", ...] }` map,
alphabetized by name.
operationId: getMessageHeaders
responses:
'200':
description: Headers map.
content:
application/json:
schema:
type: object
additionalProperties:
type: array
items:
type: string
example:
from: ["Sender <s@example.com>"]
to: ["r@example.com"]
subject: ["Welcome"]
'404':
$ref: '#/components/responses/NotFound'
/api/v1/message/{id}/part/{part_id}:
parameters:
- $ref: '#/components/parameters/MessageID'
- name: part_id
in: path
required: true
schema:
type: string
description: MIME part identifier (matches `part_id` in Attachment).
get:
tags: [messages]
summary: Download a message part
description: |
Returns attachment bytes with the original `Content-Type`. Used both for
downloadable attachments and for inline parts (e.g. `cid:` images).
operationId: getMessagePart
responses:
'200':
description: Raw attachment bytes.
content:
application/octet-stream:
schema:
type: string
format: binary
'404':
$ref: '#/components/responses/NotFound'
# ---- Per-message actions ---------------------------------------------
/api/v1/message/{id}/release:
parameters:
- $ref: '#/components/parameters/MessageID'
post:
tags: [messages]
summary: Release a message through the configured SMTP relay
description: |
Forwards the stored RFC822 source to the recipients in the `to` body field
through the configured generic SMTP relay (`/relay_connection`).
Returns 503 when no relay is configured. Distinct from `send_to_cloud`,
which targets Mailtrap's Send API.
operationId: releaseMessage
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [to]
properties:
to:
type: array
items:
type: string
description: One or more recipient addresses.
example:
to: ["external@example.com"]
responses:
'200':
description: '"ok" plain-text body.'
content:
text/plain:
schema:
type: string
example: ok
'404':
$ref: '#/components/responses/NotFound'
'422':
description: Empty `to` list.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'502':
description: SMTP relay rejected the message.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: No SMTP relay configured.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/v1/message/{id}/send_to_cloud:
parameters:
- $ref: '#/components/parameters/MessageID'
post:
tags: [messages]
summary: Forward a message to the connected Mailtrap cloud sandbox
description: |
**mailtrap-local extension.** Posts the stored message to the Mailtrap Sandbox
Send API at the sandbox configured via `/cloud_connection`. The message's
`category` (if any) is promoted to the top-level `category` field in the
Send API payload — same analytics dimension locally and in cloud.
Returns 503 when no cloud sandbox is connected.
operationId: sendMessageToCloud
responses:
'200':
description: '"ok" plain-text body.'
content:
text/plain:
schema:
type: string
example: ok
'404':
$ref: '#/components/responses/NotFound'
'502':
description: Mailtrap Sandbox API returned an error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: No cloud sandbox connected.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# ---- Cloud connection ------------------------------------------------
/api/v1/cloud_connection:
get:
tags: [cloud_connection]
summary: Read the cloud sandbox connection state
description: |
Returns the singleton cloud connection record (or a `connected: false`
stub when nothing is configured). The API token is **never** returned —
only its presence is reflected via `connected: true`.
operationId: getCloudConnection
responses:
'200':
description: Connection state.
content:
application/json:
schema:
$ref: '#/components/schemas/CloudConnectionState'
put:
tags: [cloud_connection]
summary: Configure the cloud sandbox connection
description: |
Creates or updates the singleton cloud connection. Pass the API token and
sandbox ID; toggle `mirror_enabled: true` to auto-forward every newly
ingested message to the sandbox.
operationId: updateCloudConnection
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CloudConnectionInput'
responses:
'200':
description: Updated connection state.
content:
application/json:
schema:
$ref: '#/components/schemas/CloudConnectionState'
'422':
description: Validation failure (missing/invalid token, sandbox id, or field locked by config).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags: [cloud_connection]
summary: Remove the cloud sandbox connection
operationId: deleteCloudConnection
responses:
'200':
description: Disconnected.
content:
application/json:
schema:
$ref: '#/components/schemas/CloudConnectionState'
# ---- Relay connection ------------------------------------------------
/api/v1/relay_connection:
get:
tags: [relay_connection]
summary: Read the SMTP relay connection state
description: |
Returns the singleton SMTP relay record (or a stub when nothing is
configured). The password is **never** returned — only its presence
is reflected via `connected: true`.
operationId: getRelayConnection
responses:
'200':
description: Relay state.
content:
application/json:
schema:
$ref: '#/components/schemas/RelayConnectionState'
put:
tags: [relay_connection]
summary: Configure the SMTP relay
operationId: updateRelayConnection
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RelayConnectionInput'
responses:
'200':
description: Updated relay state.
content:
application/json:
schema:
$ref: '#/components/schemas/RelayConnectionState'
'422':
description: Validation failure (missing host, or field locked by config).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags: [relay_connection]
summary: Remove the SMTP relay configuration
operationId: deleteRelayConnection
responses:
'200':
description: Disconnected.
content:
application/json:
schema:
$ref: '#/components/schemas/RelayConnectionState'
# ---- Relay test ------------------------------------------------------
/api/v1/relay_connection/test:
post:
tags: [relay_connection]
summary: Probe SMTP relay reachability + auth
description: |
Opens a connection, runs STARTTLS / AUTH per the supplied
config, and closes cleanly. Sends no real mail. Used by the
relay-config dialog's "Send test" button. Empty `password`
falls back to the saved value (so the dialog can probe without
forcing the user to retype).
operationId: testRelayConnection
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RelayConnectionInput'
responses:
'200':
description: Probe result.
content:
application/json:
schema:
type: object
properties:
ok: { type: boolean }
message: { type: string }
error: { type: string }
# ---- Webhook connection ----------------------------------------------
/api/v1/webhook_connection:
get:
tags: [webhook_connection]
summary: Read the outbound webhook configuration
operationId: getWebhookConnection
responses:
'200':
description: Webhook configuration state.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConnectionState'
put:
tags: [webhook_connection]
summary: Configure the outbound webhook
operationId: updateWebhookConnection
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConnectionInput'
responses:
'200':
description: Updated webhook state.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConnectionState'
'422':
description: Validation failure (missing/invalid URL, or field locked by config).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags: [webhook_connection]
summary: Remove the webhook configuration
operationId: deleteWebhookConnection
responses:
'200':
description: Disconnected.
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConnectionState'
/api/v1/webhook_connection/test:
post:
tags: [webhook_connection]
summary: Send a synthetic ping to the webhook URL
description: |
POSTs a fixed test payload (`Event: "test"`) to the supplied
URL with the same headers and HMAC signing scheme the real
delivery job uses. Empty `secret` falls back to the saved
value.
operationId: testWebhookConnection
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookConnectionInput'
responses:
'200':
description: Probe result.
content:
application/json:
schema:
type: object
properties:
ok: { type: boolean }
message: { type: string }
error: { type: string }
# ---- HTML Check ------------------------------------------------------
/api/v1/message/{id}/html_check:
parameters:
- $ref: '#/components/parameters/MessageID'
get:
tags: [messages]
summary: HTML email-client compatibility check
description: |
Runs a rule engine over the message HTML and returns issues
with caniemail.com client/version data plus market-share
weighted support stats. Cached per-message (HTML is immutable).
Status values:
- `success` — report ready (see schema)
- `no_html` — message has no HTML body
- `size_limit_exceeded` — HTML exceeds the size cap
- `error` — validator hit an unexpected error
operationId: htmlCheck
responses:
'200':
description: Report (or status placeholder).
content:
application/json:
schema:
type: object
additionalProperties: true
# ---- Build identity --------------------------------------------------
/api/v1/version:
get:
tags: [meta]
summary: Build identity
description: Returns the running binary's version, source commit, and build timestamp.
operationId: getVersion
responses:
'200':
description: Build metadata for the running server.
content:
application/json:
schema:
$ref: '#/components/schemas/VersionResponse'
# ---- Internal ingest -------------------------------------------------
/api/v1/ingest:
post:
tags: [internal]
summary: '[internal] Receive a parsed message from the in-process SMTP server'
description: |
**Internal endpoint.** Consumed by the in-process SMTP server after
it parses an SMTP delivery with `enmime`. Also useful in tests as a
way to drive ingest without speaking SMTP. **Not intended for
third-party use** — wire format and validation may change between
releases.
operationId: ingestMessage
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/IngestPayload'
responses:
'201':
description: Message and any attachments persisted.
content:
application/json:
schema:
type: object
properties:
id:
type: string
'422':
description: Validation failure — the entire transaction is rolled back.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
# =====================================================================
# Reusable components
# =====================================================================
components:
parameters:
Start:
name: start
in: query
description: Pagination offset. Clamped to `[0, 1_000_000]`.
required: false
schema:
type: integer
format: int64
minimum: 0
default: 0
Limit:
name: limit
in: query
description: Page size. Clamped to `[1, 200]`. Default 50.
required: false
schema:
type: integer
format: int64
minimum: 1
maximum: 200
default: 50
MessageID:
name: id
in: path
required: true
description: |
Message database ID, or the literal string `latest` for the newest message.
schema:
type: string
responses:
NotFound:
description: Message not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Address:
type: object
description: Email address with optional display name.
properties:
name:
type: string
description: Display name (may be empty).
address:
type: string
format: email
example:
name: Sender
address: sender@example.com
AttachmentSummary:
type: object
description: Attachment metadata. Bytes are fetched via `/message/{id}/part/{part_id}`. Matches `Attachment` (response shape).
properties:
part_id:
type: string
file_name:
type: string
content_type:
type: string
content_id:
type: string
size:
type: integer
format: uint64
checksums:
type: object
properties:
md5: { type: string }
sha1: { type: string }
sha256: { type: string }
ListUnsubscribe:
type: object
description: |
Parsed `List-Unsubscribe` / `List-Unsubscribe-Post` headers, when present.
Empty stub when the message has none.
properties:
header:
type: string
links:
type: array
items:
type: string
errors:
type: string
header_post:
type: string
MessageSummary:
type: object
description: |
List-row shape returned by `GET /messages`.
**Note on `tags`:** the array is always 0 or 1 element (the message's
category). mailtrap-local stores a single category per message — see
the API description for rationale.
properties:
id:
type: string
description: Database ID.
message_id:
type: string
description: RFC 5322 Message-ID header.
read:
type: boolean
from:
$ref: '#/components/schemas/Address'
to:
type: array
items:
$ref: '#/components/schemas/Address'
cc:
type: array
items:
$ref: '#/components/schemas/Address'
bcc:
type: array
items:
$ref: '#/components/schemas/Address'
reply_to:
type: array
items:
$ref: '#/components/schemas/Address'
subject:
type: string
created:
type: string
format: date-time
description: Received RFC3339Nano date & time.
username:
type: string
description: Always empty in mailtrap-local — there is no SMTP AUTH (single-user local tool).
tags:
type: array
maxItems: 1
items:
type: string
description: 0- or 1-element array containing the message's category .
size:
type: integer
format: uint64
attachments:
type: integer
format: uint64
description: Count of non-inline attachments.
snippet:
type: string
description: Up to 250 characters of the text body.
Message:
type: object
description: |
Full message detail returned by `GET /message/{id}`. Includes two
mailtrap-local extensions documented at the bottom (`envelope_from`
and `envelope_to`); clients should ignore unknown keys.
properties:
id:
type: string
message_id:
type: string
from:
$ref: '#/components/schemas/Address'
to:
type: array
items:
$ref: '#/components/schemas/Address'
cc:
type: array
items:
$ref: '#/components/schemas/Address'
bcc:
type: array
items:
$ref: '#/components/schemas/Address'
reply_to:
type: array
items:
$ref: '#/components/schemas/Address'
return_path:
type: string
subject:
type: string
list_unsubscribe:
$ref: '#/components/schemas/ListUnsubscribe'
date:
type: string
format: date-time
description: Header `Date` if parseable, otherwise ingest time.
tags:
type: array
maxItems: 1
items:
type: string
description: 0- or 1-element array containing the message's category .
username:
type: string
text:
type: string
html:
type: string
size:
type: integer
format: uint64
inline:
type: array
items:
$ref: '#/components/schemas/AttachmentSummary'
attachments:
type: array
items:
$ref: '#/components/schemas/AttachmentSummary'
envelope_from:
type: string
description: '**mailtrap-local extension.** SMTP `MAIL FROM` envelope sender. Surfaced in the Tech Info tab.'
envelope_to:
type: array
items:
type: string
description: '**mailtrap-local extension.** SMTP `RCPT TO` envelope recipients.'
MessagesResponse:
type: object
description: Envelope returned by `GET /messages`.
properties:
total:
type: integer
format: int64
description: Total messages matching the current filter (e.g. `?category=`).
unread:
type: integer
format: int64
count:
type: integer
format: int64
description: Number of summaries in this page.
messages_count:
type: integer
format: int64
description: Mirror of `total` .
messages_unread:
type: integer
format: int64
description: Mirror of `unread` .
start:
type: integer
format: int64
tags:
type: array
items:
type: string