For more information about Subusers, visit the longform Subusers documentation. You can also manage Subusers in the SendGrid console.
This endpoint allows you to update the Credits for a Subuser.
Bearer <<YOUR_API_KEY_HERE>>
The username of the Subuser.
application/json
Type determines how credits are reset for a Subuser. unlimited
indicates that there is no limit to the Subuser's credits. recurring
indicates that the credits for the Subuser are reset according to the frequency determined by reset_frequency
. nonrecurring
indicates that there is no recurring schedule to reset credits and resets must be done on an ad hoc basis.
unlimited
recurring
nonrecurring
Optional
The frequency with which a Subuser's credits are reset if type
is set to recurring
. Do not include reset_frequency
if you choose a reset type
value of unlimited
or nonrecurring
.
monthly
weekly
daily
Optional
Total number of credits to which the Subuser is to be reset. If type
is nonrecurring
then the Subuser's credits will be reset to total
on a one-time basis. If type
is recurring
then the Subuser's credits will be reset to total
every time a reset is scheduled in accordance with the reset_frequency
. Do not include total
if you choose a reset type
value of unlimited
.
1
Type determines how credits are reset for a Subuser. unlimited
indicates that there is no limit to the Subuser's credits. recurring
indicates that the credits for the Subuser are reset according to the frequency determined by reset_frequency
. nonrecurring
indicates that there is no recurring schedule to reset credits and resets must be done on an ad hoc basis.
unlimited
recurring
nonrecurring
The frequency with which a Subuser's credits are reset if type
is set to recurring
, otherwise null
.
monthly
weekly
daily
Total number of remaining credits. remain
is null
if the reset type
for the Subuser's credits is set to unlimited
.
0
Total number of allowable credits. total
is null
if the reset type
for the Subuser's credits is set to unlimited
or nonrecurring
.
0
Total number of used credits. used
is null
if the reset type
for the Subuser's credits is set to unlimited
or nonrecurring
.
0
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const subuser_name = "some_one";5const data = {6type: "recurring",7reset_frequency: "monthly",8total: 100,9};1011const request = {12url: `/v3/subusers/${subuser_name}/credits`,13method: "PUT",14body: data,15};1617client18.request(request)19.then(([response, body]) => {20console.log(response.statusCode);21console.log(response.body);22})23.catch((error) => {24console.error(error);25});
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const subuser_name = "some_one";5const data = {6type: "nonrecurring",7total: 100,8};910const request = {11url: `/v3/subusers/${subuser_name}/credits`,12method: "PUT",13body: data,14};1516client17.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch((error) => {23console.error(error);24});
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const subuser_name = "some_one";5const data = {6type: "unlimited",7};89const request = {10url: `/v3/subusers/${subuser_name}/credits`,11method: "PUT",12body: data,13};1415client16.request(request)17.then(([response, body]) => {18console.log(response.statusCode);19console.log(response.body);20})21.catch((error) => {22console.error(error);23});