This topic was merged into another on Fri, 27 Jan 2012 20:08:15 +0000 Click here to see the authoritative topic.
Jacob (Support Engineer) September 28, 2011 13:49

Credits Remaining API Call

I would like the ability to query "credits remaining" on my account. It's available for parent accounts to call on their subusers, but not for Lite or RackSpace Bronze accounts to query on themselves.
5 people like
this idea
+1
Reply

  • Jacob (Support Engineer) November 29, 2011 16:51
    As a workaround, you can use the Web API Statistics Call:
    https://sendgrid.com/api/stats.get.xm...

    Using the first of the current month of course. You get the "requests" value, and subtract it from the total allotment for your package. This number is your credits remaining.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Richard Lawson
    Hi Jacob,

    Unfortunately the api fails in one specific scenario.

    Background

    - We are based in the UK and we are 8 hours or more ahead of you.
    - Our customers are very conscious about their costs. Therefore they want to keep within their monthly credit limit.
    - Our customers send out their monthly emails at the start of the month normally at 8am UK time.

    Scenario

    8am on the first of the month the customer sends out their monthly emails. Before I allow them to send the emails I check to see if they have enough credits. So:

    I run the API call to tell me the number of credits our customer has used. As it is the first of the month the number of credits used will be zero. Therefore the customer has 40,000 credits and the emails are sent out.

    The problem

    At 8am UK time you may not have reset our monthly credits to 40,000 see http://community.sendgrid.com/sendgri... for more details. Therefore 40,000 emails have gone out which the customer will then get charged an additional $40. We then have a very unhappy customer.

    Hopefully you will see the problem.

    The only accurate way of seeing the number of available credits is by logging into the sendgrid administration screens. However our customers do not have access to them.

    Can you please:

    - Ask your developers to think again.

    or

    - Provide me a solution for this problem.

    Many thanks
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Jacob (Support Engineer) December 01, 2011 18:32
    I've talked to our Billing developers and have confirmed how this works:

    The Dashboard view takes a little while to roll over, because it queries our billing system for the package for the upcoming month, and runs as a cronjob through all of our accounts.

    However, credit usage is based on when our system received the request. So long as the request is received after 00:00:01 Central Time, it will count towards the new day & month's credits.

    TL;DR: Don't worry about that fact that the dashboard is reflecting other information, the credit allotment is based on the statistics of the "processed", and the day rolls over in Central Time.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Richard Lawson
    Hi Jacob,

    As the credits no longer seem to roll over on the 1st of each month (see http://community.sendgrid.com/sendgri...) can we have an api call to tell us how many credits we have left?

    Many thanks
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Jacob (Support Engineer) January 27, 2012 20:05
    We're working on the API call. Credits do reset at 00:00:01 PT on the 1st of each month, provided you're a direct SendGrid customer. Our reseller clients have the option to change that method.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Jacob (Support Engineer) January 27, 2012 20:09
    This is in our system as US987, though I do not currently have an ETA. As soon as I do, I'll update!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned