File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,27 @@ client.setApiKey(process.env.SENDGRID_API_KEY);
37
37
* [ USER] ( #user )
38
38
* [ WHITELABEL] ( #whitelabel )
39
39
40
+ # On behalf of subusers
41
+
42
+ Most API calls will accept an ` on-behalf-of ` header
43
+ in order to make API calls as a given subuser:
44
+
45
+ ``` javascript
46
+ // create an API key for the given subuser
47
+ const data = {
48
+ name: ' subuser API key' ,
49
+ scopes: [' mail.send' ],
50
+ };
51
+ request .body = data;
52
+ request .method = ' POST' ;
53
+ request .url = ' /v3/api_keys' ;
54
+ request .headers = { ' On-Behalf-Of' : ' subuser username' };
55
+ client .request (request)
56
+ .then (([response , body ]) => {
57
+ console .log (response .statusCode );
58
+ console .log (response .body );
59
+ });
60
+ ```
40
61
41
62
<a name =" access-settings " ></a >
42
63
# ACCESS SETTINGS
You can’t perform that action at this time.
0 commit comments