Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Update the Credits for a Subuser



API Overview

api-overview page anchor

For more information about Subusers, visit the longform Subusers documentation. You can also manage Subusers in the SendGrid console(link takes you to an external page).


PUT/v3/subusers/{subuser_name}/credits

Base url: https://api.sendgrid.com

This endpoint allows you to update the Credits for a Subuser.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
subuser_namestringrequired

The username of the Subuser.

Schema
Property nameTypeRequiredDescriptionChild properties
typeenum<string>required

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.

Possible values:
unlimitedrecurringnonrecurring

reset_frequencyenum<string>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.

Possible values:
monthlyweeklydaily

totalintegerOptional

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.

Minimum: 1
200400
SchemaExample
Property nameTypeRequiredDescriptionChild properties
typeenum<string>

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.

Possible values:
unlimitedrecurringnonrecurring

reset_frequencyenum<string> or null

The frequency with which a Subuser's credits are reset if type is set to recurring, otherwise null.

Possible values:
monthlyweeklydaily

remaininteger or null

Total number of remaining credits. remain is null if the reset type for the Subuser's credits is set to unlimited.

Minimum: 0

totalinteger or null

Total number of allowable credits. total is null if the reset type for the Subuser's credits is set to unlimited or nonrecurring.

Minimum: 0

usedinteger or null

Total number of used credits. used is null if the reset type for the Subuser's credits is set to unlimited or nonrecurring.

Minimum: 0

Update the Credits for a Subuser (recurring)

update-the-credits-for-a-subuser-recurring page anchor

Reset the credits on a monthly basis

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_24
const client = require('@sendgrid/client');
_24
client.setApiKey(process.env.SENDGRID_API_KEY);
_24
_24
const subuser_name = "some_one";
_24
const data = {
_24
"type": "recurring",
_24
"reset_frequency": "monthly",
_24
"total": 100
_24
};
_24
_24
const request = {
_24
url: `/v3/subusers/${subuser_name}/credits`,
_24
method: 'PUT',
_24
body: data
_24
}
_24
_24
client.request(request)
_24
.then(([response, body]) => {
_24
console.log(response.statusCode);
_24
console.log(response.body);
_24
})
_24
.catch(error => {
_24
console.error(error);
_24
});

Update the Credits for a Subuser (non-recurring)

update-the-credits-for-a-subuser-non-recurring page anchor

Reset the credits on a one-time basis

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_23
const client = require('@sendgrid/client');
_23
client.setApiKey(process.env.SENDGRID_API_KEY);
_23
_23
const subuser_name = "some_one";
_23
const data = {
_23
"type": "nonrecurring",
_23
"total": 100
_23
};
_23
_23
const request = {
_23
url: `/v3/subusers/${subuser_name}/credits`,
_23
method: 'PUT',
_23
body: data
_23
}
_23
_23
client.request(request)
_23
.then(([response, body]) => {
_23
console.log(response.statusCode);
_23
console.log(response.body);
_23
})
_23
.catch(error => {
_23
console.error(error);
_23
});

Update the Credits for a Subuser (unlimited)

update-the-credits-for-a-subuser-unlimited page anchor

Grant the Subuser unlimited credits

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const subuser_name = "some_one";
_22
const data = {
_22
"type": "unlimited"
_22
};
_22
_22
const request = {
_22
url: `/v3/subusers/${subuser_name}/credits`,
_22
method: 'PUT',
_22
body: data
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: