0

I am attempting to build a sales platform with sendgrid integration, currently due to cost limitations I want to limit email transactions to sendgrid's free plan of 400 emails/day.

Is there a way I can retrieve the remaining email quota programmatically in PHP?

I have seen this question (link) but I am not familiar with ruby, i believe that this is a workaround.

Community
  • 1
  • 1
David Passmore
  • 6,089
  • 4
  • 46
  • 70
  • 1
    Looks like you could create a subuser and use this API: https://sendgrid.com/docs/API_Reference/Customer_Subuser_API/account_limits.html – ceejayoz Mar 19 '15 at 23:47

3 Answers3

1

You would need to set up the user as a subuser of the main account, and then use the Customer Subuser API to check/limit the credits. However, the Customer Subuser API is only available to customers on SendGrid's Silver plan and higher, so if you're on the free plan, you won't be able to do this.

Martyn Davies
  • 1,493
  • 9
  • 12
  • Thanks, appreciate the clarification, I have now moved onto the pay as you go lite plan so i can build reputation and allow for overusage. – David Passmore Mar 20 '15 at 11:23
0

There is not a way to retrieve the quota; it can be inferred by knowing how many you get a day (resets at 00:00 PT), and subtract what you've sent.

jacobmovingfwd
  • 2,185
  • 14
  • 11
0

You can't retrieve the credit quota, but SendGrid will error out and the response will say that you've exceeded your credits.

Just keep sending and stop when it errors out.

Dylan Moore
  • 530
  • 2
  • 8