forked from sendgrid/sendgrid-oai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoai.yaml
18465 lines (17932 loc) · 663 KB
/
oai.yaml
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
swagger: '2.0'
info:
version: '3.0'
title: SendGrid v3 API Documentation
description: |-
# The SendGrid Web API V3 Documentation
This is the entirety of the documented v3 endpoints. We have updated all the descriptions, parameters, requests, and responses.
## Authentication
Every endpoint requires Authentication in the form of an Authorization Header:
Authorization: Bearer API_KEY
host: api.sendgrid.com
basePath: /v3
schemes:
- http
- https
securityDefinitions:
Authorization:
name: Authorization
type: apiKey
in: header
paths:
/mail/send:
post:
operationId: POST_mail-send
summary: v3 Mail Send
tags:
- Mail Send
description: |-
This endpoint allows you to send email over SendGrid’s v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
* Top level parameters are referred to as "global".
* Individual fields within the personalizations array will override any other global, or “message level”, parameters that are defined outside of personalizations.
**SendGrid provides libraries to help you quickly and easily integrate with the v3 Web API in 7 different languages: [C#](https://github.com/sendgrid/sendgrid-csharp), [Go](https://github.com/sendgrid/sendgrid-go), [Java](https://github.com/sendgrid/sendgrid-java), [Node JS](https://github.com/sendgrid/sendgrid-nodejs), [PHP](https://github.com/sendgrid/sendgrid-php), [Python](https://github.com/sendgrid/sendgrid-python), and [Ruby](https://github.com/sendgrid/sendgrid-ruby).**
For more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html).
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
schema:
type: object
properties:
personalizations:
type: array
description: An array of messages and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled.
uniqueItems: false
maxItems: 1000
items:
type: object
properties:
to:
type: array
description: 'An array of recipients. Each object within this array may contain the name, but must always contain the email, of a recipient.'
minItems: 1
maxItems: 1000
items:
$ref: '#/definitions/email_object'
cc:
type: array
description: 'An array of recipients who will receive a copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.'
maxItems: 1000
items:
$ref: '#/definitions/email_object'
bcc:
type: array
description: 'An array of recipients who will receive a blind carbon copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.'
maxItems: 1000
items:
$ref: '#/definitions/email_object'
subject:
type: string
description: 'The subject of your email. Char length requirements, according to the RFC - http://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit#answer-1592310'
minLength: 1
headers:
type: object
description: 'A collection of JSON key/value pairs allowing you to specify specific handling instructions for your email. You may not overwrite the following headers: x-sg-id, x-sg-eid, received, dkim-signature, Content-Type, Content-Transfer-Encoding, To, From, Subject, Reply-To, CC, BCC'
substitutions:
type: object
description: 'A collection of key/value pairs following the pattern "substitution_tag":"value to substitute". All are assumed to be strings. These substitutions will apply to the text and html content of the body of your email, in addition to the `subject` and `reply-to` parameters.'
maxProperties: 10000
custom_args:
type: object
description: 'Values that are specific to this personalization that will be carried along with the email and its activity data. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. May not exceed 10,000 bytes.'
send_at:
type: integer
description: A unix timestamp allowing you to specify when you want your email to be delivered. Scheduling more than 72 hours in advance is forbidden.
required:
- to
from:
$ref: '#/definitions/email_object'
reply_to:
$ref: '#/definitions/email_object'
subject:
type: string
description: 'The global, or “message level”, subject of your email. This may be overridden by personalizations[x].subject.'
minLength: 1
content:
type: array
description: 'An array in which you may specify the content of your email. You can include multiple mime types of content, but you must specify at least one mime type. To include more than one mime type, simply add another object to the array containing the `type` and `value` parameters.'
items:
type: object
properties:
type:
type: string
description: 'The mime type of the content you are including in your email. For example, “text/plain” or “text/html”.'
minLength: 1
value:
type: string
description: The actual content of the specified mime type that you are including in your email.
minLength: 1
required:
- type
- value
attachments:
type: array
description: An array of objects in which you can specify any attachments you want to include.
items:
type: object
properties:
content:
type: string
description: The Base64 encoded content of the attachment.
minLength: 1
type:
type: string
description: 'The mime type of the content you are attaching. For example, “text/plain” or “text/html”.'
minLength: 1
filename:
type: string
description: The filename of the attachment.
disposition:
type: string
default: attachment
description: 'The content-disposition of the attachment specifying how you would like the attachment to be displayed. For example, “inline” results in the attached file being displayed automatically within the message while “attachment” results in the attached file requiring some action to be taken before it is displayed (e.g. opening or downloading the file).'
enum:
- inline
- attachment
content_id:
type: string
description: 'The content id for the attachment. This is used when the disposition is set to “inline” and the attachment is an image, allowing the file to be displayed within the body of your email.'
required:
- content
- filename
template_id:
type: string
description: 'The id of a template that you would like to use. If you use a template that contains a subject and content (either text or html), you do not need to specify those at the personalizations nor message level. '
sections:
type: object
description: An object of key/value pairs that define block sections of code to be used as substitutions.
headers:
type: object
description: An object containing key/value pairs of header names and the value to substitute for them. You must ensure these are properly encoded if they contain unicode characters. Must not be one of the reserved headers.
categories:
type: array
description: 'An array of category names for this message. Each category name may not exceed 255 characters. '
uniqueItems: true
maxItems: 10
items:
type: string
maxLength: 255
custom_args:
type: object
description: 'Values that are specific to the entire send that will be carried along with the email and its activity data. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This parameter is overridden by personalizations[x].custom_args if that parameter has been defined. Total custom args size may not exceed 10,000 bytes.'
send_at:
type: integer
description: 'A unix timestamp allowing you to specify when you want your email to be delivered. This may be overridden by the personalizations[x].send_at parameter. Scheduling more ta 72 hours in advance is forbidden.'
batch_id:
type: string
description: 'This ID represents a batch of emails to be sent at the same time. Including a batch_id in your request allows you include this email in that batch, and also enables you to cancel or pause the delivery of that batch. For more information, see https://sendgrid.com/docs/API_Reference/Web_API_v3/cancel_schedule_send.html '
asm:
type: object
description: An object allowing you to specify how to handle unsubscribes.
properties:
group_id:
type: integer
description: The unsubscribe group to associate with this email.
groups_to_display:
type: array
description: An array containing the unsubscribe groups that you would like to be displayed on the unsubscribe preferences page.
maxItems: 25
items:
type: integer
required:
- group_id
ip_pool_name:
type: string
description: The IP Pool that you would like to send this email from.
minLength: 2
maxLength: 64
mail_settings:
type: object
description: A collection of different mail settings that you can use to specify how you would like this email to be handled.
properties:
bcc:
type: object
description: This allows you to have a blind carbon copy automatically sent to the specified email address for every email that is sent.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
email:
type: string
description: The email address that you would like to receive the BCC.
format: email
bypass_list_management:
type: object
description: Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
footer:
type: object
description: The default footer that you would like included on every email.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
text:
type: string
description: The plain text content of your footer.
html:
type: string
description: The HTML content of your footer.
sandbox_mode:
type: object
description: This allows you to send a test email to ensure that your request body is valid and formatted correctly.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
spam_check:
type: object
description: This allows you to test the content of your email for spam.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
threshold:
type: integer
description: 'The threshold used to determine if your content qualifies as spam on a scale from 1 to 10, with 10 being most strict, or most likely to be considered as spam.'
minimum: 1
maximum: 10
post_to_url:
type: string
description: An Inbound Parse URL that you would like a copy of your email along with the spam report to be sent to.
tracking_settings:
type: object
description: Settings to determine how you would like to track the metrics of how your recipients interact with your email.
properties:
click_tracking:
type: object
description: Allows you to track whether a recipient clicked a link in your email.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
enable_text:
type: boolean
description: Indicates if this setting should be included in the text/plain portion of your email.
open_tracking:
type: object
description: 'Allows you to track whether the email was opened or not, but including a single pixel image in the body of the content. When the pixel is loaded, we can log that the email was opened.'
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
substitution_tag:
type: string
description: Allows you to specify a substitution tag that you can insert in the body of your email at a location that you desire. This tag will be replaced by the open tracking pixel.
subscription_tracking:
type: object
description: 'Allows you to insert a subscription management link at the bottom of the text and html bodies of your email. If you would like to specify the location of the link within your email, you may use the substitution_tag.'
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
text:
type: string
description: 'Text to be appended to the email, with the subscription tracking link. You may control where the link is by using the tag <% %>'
html:
type: string
description: 'HTML to be appended to the email, with the subscription tracking link. You may control where the link is by using the tag <% %>'
substitution_tag:
type: string
description: 'A tag that will be replaced with the unsubscribe URL. for example: [unsubscribe_url]. If this parameter is used, it will override both the `text` and `html` parameters. The URL of the link will be placed at the substitution tag’s location, with no additional formatting.'
ganalytics:
type: object
description: Allows you to enable tracking provided by Google Analytics.
properties:
enable:
type: boolean
description: Indicates if this setting is enabled.
utm_source:
type: string
description: 'Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email)'
utm_medium:
type: string
description: Name of the marketing medium. (e.g. Email)
utm_term:
type: string
description: "Used to identify any paid keywords.\t"
utm_content:
type: string
description: "Used to differentiate your campaign from advertisements.\t"
utm_campaign:
type: string
description: "The name of the campaign.\t"
required:
- personalizations
- from
- subject
- content
example:
personalizations:
- to:
- email: [email protected]
name: John Doe
subject: 'Hello, World!'
from:
email: [email protected]
name: Sam Smith
reply_to:
email: [email protected]
name: Sam Smith
subject: 'Hello, World!'
content:
- type: text/html
value: '<html><p>Hello, world!</p></html>'
responses:
'202':
description: ''
schema:
type: 'null'
'400':
description: ''
schema:
$ref: '#/definitions/errors'
'401':
description: ''
schema:
$ref: '#/definitions/errors'
'413':
description: ''
schema:
$ref: '#/definitions/errors'
security:
- Authorization: []
/alerts:
post:
operationId: POST_alerts
summary: Create a new Alert
tags:
- Alerts
description: |-
**This endpoint allows you to create a new alert.**
Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. There are two types of alerts that can be created with this endpoint:
* `usage_limit` allows you to set the threshold at which an alert will be sent.
* `stats_notification` allows you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
schema:
type: object
properties:
type:
type: string
description: |-
The type of alert you want to create. Can be either usage_limit or stats_notification.
Example: usage_limit
enum:
- stats_notification
- usage_limit
email_to:
type:
- string
- 'null'
description: |-
The email address the alert will be sent to.
Example: [email protected]
frequency:
type: string
description: |-
Required for stats_notification. How frequently the alert will be sent.
Example: daily
percentage:
type: integer
description: |-
Required for usage_alert. When this usage threshold is reached, the alert will be sent.
Example: 90
required:
- type
- email_to
example:
type: stats_notification
email_to: [email protected]
frequency: daily
- name: Authorization
in: header
type: string
- name: on-behalf-of
in: header
type: string
responses:
'201':
description: ''
schema:
type: object
properties:
created_at:
type: integer
description: A Unix timestamp indicating when the alert was created.
email_to:
type: string
description: The email address that the alert will be sent to.
frequency:
type: string
description: 'If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example, "daily", "weekly", or "monthly".'
id:
type: integer
description: The ID of the alert.
type:
type: string
description: The type of alert.
updated_at:
type: integer
description: A Unix timestamp indicating when the alert was last modified.
percentage:
type: integer
description: '"If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent.'
required:
- created_at
- email_to
- id
- type
- updated_at
examples:
application/json:
created_at: 1451520930
email_to: [email protected]
frequency: daily
id: 48
type: stats_notification
updated_at: 1451520930
'400':
description: ''
schema:
type: object
properties:
field:
type: string
message:
type: string
security:
- Authorization: []
get:
operationId: GET_alerts
summary: Retrieve all alerts
tags:
- Alerts
description: |-
**This endpoint allows you to retieve all of your alerts.**
Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
* Usage alerts allow you to set the threshold at which an alert will be sent.
* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
produces:
- application/json
parameters:
- name: body
in: body
schema:
type: 'null'
- name: Authorization
in: header
type: string
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'200':
description: ''
schema:
type: array
description: The list of alerts.
items:
type: object
properties:
created_at:
type: integer
description: A Unix timestamp indicating when the alert was created.
email_to:
type: string
description: The email address that the alert will be sent to.
id:
type: integer
description: The ID of the alert.
percentage:
type: integer
description: 'If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent.'
type:
type: string
description: The type of alert.
enum:
- usage_limit
- stats_notification
updated_at:
type: integer
description: A Unix timestamp indicating when the alert was last modified.
frequency:
type: string
description: 'If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example, "daily", "weekly", or "monthly".'
required:
- created_at
- email_to
- id
- type
examples:
application/json:
- created_at: 1451498784
email_to: [email protected]
id: 46
percentage: 90
type: usage_limit
updated_at: 1451498784
- created_at: 1451498812
email_to: [email protected]
frequency: monthly
id: 47
type: stats_notification
updated_at: 1451498812
- created_at: 1451520930
email_to: [email protected]
frequency: daily
id: 48
type: stats_notification
updated_at: 1451520930
security:
- Authorization: []
'/alerts/{alert_id}':
parameters:
- name: alert_id
in: path
description: The ID of the alert you would like to retrieve.
required: true
type: integer
get:
operationId: GET_alerts-alert_id
summary: Retrieve a specific alert
tags:
- Alerts
description: |-
**This endpoint allows you to retrieve a specific alert.**
Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
* Usage alerts allow you to set the threshold at which an alert will be sent.
* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
produces:
- application/json
parameters:
- name: Authorization
in: header
type: string
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'200':
description: ''
schema:
type: object
properties:
created_at:
type: integer
description: A Unix timestamp indicating when the alert was created.
email_to:
type: string
description: The email address that the alert will be sent to.
frequency:
type: string
description: 'If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example: "daily", "weekly", or "monthly".'
id:
type: integer
description: The ID of the alert.
type:
type: string
description: The type of alert.
enum:
- usage_alert
- stats_notification
updated_at:
type: integer
description: A Unix timestamp indicating when the alert was last modified.
percentage:
type: integer
description: 'If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent.'
required:
- created_at
- email_to
- id
- type
- updated_at
examples:
application/json:
created_at: 1451520930
email_to: [email protected]
frequency: daily
id: 48
type: stats_notification
updated_at: 1451520930
security:
- Authorization: []
delete:
operationId: DELETE_alerts-alert_id
summary: Delete an alert
tags:
- Alerts
description: |-
**This endpoint allows you to delete an alert.**
Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
* Usage alerts allow you to set the threshold at which an alert will be sent.
* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
parameters:
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'204':
description: ''
schema:
type: object
properties: {}
security:
- Authorization: []
patch:
operationId: PATCH_alerts-alert_id
summary: Update an alert
tags:
- Alerts
description: |-
**This endpoint allows you to update an alert.**
Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
* Usage alerts allow you to set the threshold at which an alert will be sent.
* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
For more information about alerts, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
schema:
type: object
properties:
email_to:
type: string
description: |-
The new email address you want your alert to be sent to.
Example: [email protected]
frequency:
type: string
description: |-
The new frequency at which to send the stats_notification alert.
Example: monthly
percentage:
type: integer
description: |-
The new percentage threshold at which the usage_limit alert will be sent.
Example: 90
example:
email_to: [email protected]
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'200':
description: ''
schema:
type: object
properties:
created_at:
type: integer
description: A Unix timestamp indicating when the alert was created.
email_to:
type: string
description: The email address that the alert will be sent to.
frequency:
type: string
description: 'If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example: "daily", "weekly", or "monthly".'
id:
type: integer
description: The ID of the alert.
type:
type: string
description: The type of alert.
enum:
- usage_alert
- stats_notification
updated_at:
type: integer
description: A Unix timestamp indicating when the alert was last modified.
percentage:
type: integer
description: 'If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent.'
required:
- created_at
- email_to
- id
- type
- updated_at
examples:
application/json:
created_at: 1451520930
email_to: [email protected]
frequency: daily
id: 48
type: stats_notification
updated_at: 1451522691
security:
- Authorization: []
/api_keys:
get:
operationId: GET_api_keys
summary: Retrieve all API Keys belonging to the authenticated user
tags:
- API Keys
description: |-
**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.**
The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
produces:
- application/json
parameters:
- name: limit
in: query
type: integer
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'200':
description: ''
schema:
type: object
properties:
result:
type: array
items:
$ref: '#/definitions/api_key_name_id'
examples:
application/json:
result:
- name: API Key Name
api_key_id: some-apikey-id
- name: API Key Name 2
api_key_id: another-apikey-id
'401':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: null
message: authorization required
security:
- Authorization: []
post:
operationId: create-api-keys
summary: Create API keys
tags:
- API Keys
description: |-
**This endpoint allows you to create a new random API Key for the user.**
A JSON request body containing a "name" property is required. If number of maximum keys is reached, HTTP 403 will be returned.
There is a limit of 100 API Keys on your account.
The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
See the [API Key Permissions List](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html) for a list of all available scopes.
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
schema:
type: object
properties:
name:
type: string
description: The name you will use to describe this API Key.
scopes:
type: array
description: The individual permissions that you are giving to this API Key.
items:
type: string
sample:
type: string
required:
- name
example:
name: My API Key
scopes:
- mail.send
- alerts.create
- alerts.read
sample: data
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'201':
description: ''
schema:
type: object
properties:
api_key:
type: string
api_key_id:
type: string
name:
type: string
scopes:
type: array
items:
type: string
examples:
application/json:
api_key: SG.xxxxxxxx.yyyyyyyy
api_key_id: xxxxxxxx
name: My API Key
scopes:
- mail.send
- alerts.create
- alerts.read
'400':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: name
message: missing required argument
'401':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: null
message: authorization required
'403':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: null
message: Cannot create more than 100 API Keys
security:
- Authorization: []
'/api_keys/{api_key_id}':
parameters:
- name: api_key_id
in: path
description: The ID of the API Key for which you are requesting information.
required: true
type: string
get:
operationId: GET_api_keys-api_key_id
summary: Retrieve an existing API Key
tags:
- API Keys
description: |-
**This endpoint allows you to retrieve a single api key.**
If the API Key ID does not exist an HTTP 404 will be returned.
produces:
- application/json
parameters:
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'200':
description: ''
schema:
type: object
properties:
result:
type: array
items:
$ref: '#/definitions/api_key_name_id_scopes'
examples:
application/json:
result:
- name: API Key Name
api_key_id: some-apikey-id
- name: API Key Name 2
api_key_id: another-apikey-id
'401':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: null
message: authorization required
'404':
description: Unexpected error in API call. See HTTP response body for details.
schema:
type: object
examples:
application/json:
errors:
- field: null
message: unable to find API Key
security:
- Authorization: []
delete:
operationId: DELETE_api_keys-api_key_id
summary: Delete API keys
tags:
- API Keys
description: |-
**This endpoint allows you to revoke an existing API Key**
Authentications using this API Key will fail after this request is made, with some small propogation delay.If the API Key ID does not exist an HTTP 404 will be returned.
The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
## URI Parameters
| URI Parameter | Type | Required? | Description |
|---|---|---|---|
|api_key_id |string | required | The ID of the API Key you are deleting.|
produces:
- application/json
parameters:
- $ref: '#/parameters/trait:onBehalfOfSubuser:on-behalf-of'
responses:
'204':
description: ''
schema:
type: 'null'
examples:
application/json: null
'404':
description: ''
schema:
$ref: '#/definitions/global:ErrorResponse'
examples:
application/json:
errors:
- field: null
message: unable to find API Key
security:
- Authorization: []
patch:
operationId: PATCH_api_keys-api_key_id
summary: Update API keys
tags:
- API Keys
description: |-
**This endpoint allows you to update the name of an existing API Key.**
A JSON request body with a "name" property is required.
The API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
## URI Parameters
| URI Parameter | Type | Required? | Description |
|---|---|---|---|
|api_key_id |string | required | The ID of the API Key you are updating.|
consumes:
- application/json
produces:
- application/json