Throttle your subuser when you need them to send only a specific amount of emails at a specified interval.

Retrieve

Retrieve account limits for a specific subuser. If the API call response is empty that means the subuser has the limits removed.

Parameter Required Requirements Description
task Yes Must be set to retrieve Retrieve account limits
user Yes Subuser must be registered under your account The subuser who will have their account limits retrieved

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=retrieve

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "credit": "0",
  "credit_remain": "2000",
  "last_reset": "2011-02-21"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=retrieve

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<credits>
  <credit>0</credit>
  <credit_remain>2000</credit_remain>
  <last_reset>2011-02-21</last_reset>
</credits>

<!-- error -->

<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      <error>... error messages ...</error>
   </errors>
</result>

No Limit

Remove the limit for a subuser.

Parameter Required Requirements Description
task Yes Must be set to none Remove account limits
user Yes Subuser must be registered under your account The subuser who will have their account limits removed

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=none

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=none

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>

Recurring Reset

A recurring reset will allow you to periodically reset a subusers credits to a number you specify. This can be either daily, weekly or monthly.
Parameter Required Requirements Description
task Yes Must be set torecurring The task required to set the recurring reset
user Yes Subuser must be registered under your account The subuser you will be applying a recurring reset to
credits Yes Must be an integer and greater than 0 The number of credits the subuser will be reset to
period Yes Must be either daily, weekly, or monthly How often you want SendGrid to reset your subusers credits
startdate No Date must be in YYYY-mm-dd format The date you want to start resetting the subusers credits
enddate No Date must be in YYYY-mm-dd format The date you want to stop resetting the subusers credits
initial_credits No Must be an integer greater than 0 The number of credits you initially want the account reset to. If this is not set, the credits will be reset using the credits parameter

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=recurring&credits=200&period=daily

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=recurring&credits=200&period=daily

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="ISO-8859-1"?>

<message>
   <result>success@nodes</result>
</message>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>

Total Credits

Set a subusers credits to a specified amount.
Parameter Required Requirements Description
task Yes Must be set to total Set the credits to the specified amount
user Yes Subuser must be registered under your account The subuser who will have their credits updated
credits Yes Must be an integer and greater than 0 The total number of credits the subuser will be reset to

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=total&credits=200

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=total&credits=200

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<result><message>error</message><errors>
        ...
        <error>... error messages ...</error>
        ...
      </errors></result>

Increment Credits

Increment a subusers credits by a specified amount.
Parameter Required Requirements Description
task Yes Must be set to increment Increment the credits by the specified amount
user Yes Subuser must be registered under your account The subuser who will have their credits incremented
credits Yes Must be an integer and greater than 0 The total number of credits the subuser will be incremented by

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=increment&credits=20

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=increment&credits=20

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>

Decrement Credits

Decrement a subusers credits by a specified amount.
Parameter Required Requirements Description
task Yes Must be set to increment Decrement the credits by the specified amount
user Yes Subuser must be registered under your account The subuser who will have their credits decremented
credits Yes Must be an integer and greater than 0 The total number of credits the subuser will be decremented by

Call

POST https://api.sendgrid.com/apiv2/customer.limit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=decrement&credits=200

Response

1
2
3
4
5
6
7
8
9
10
11
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.limit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=decrement&credits=200

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
   <result>@nodes</result>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>