<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nikhil Gautam</title>
    <description>The latest articles on DEV Community by Nikhil Gautam (@nikhil-gautam-dev).</description>
    <link>https://dev.to/nikhil-gautam-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2379462%2Fe41fad32-c0b7-404a-8e2a-2132d6aa5cdd.png</url>
      <title>DEV Community: Nikhil Gautam</title>
      <link>https://dev.to/nikhil-gautam-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nikhil-gautam-dev"/>
    <language>en</language>
    <item>
      <title>I Wanted to Know When Groq Sends API Key Expiry Emails, So I Tested It</title>
      <dc:creator>Nikhil Gautam</dc:creator>
      <pubDate>Fri, 09 Oct 2026 18:11:00 +0000</pubDate>
      <link>https://dev.to/nikhil-gautam-dev/i-wanted-to-know-when-groq-sends-api-key-expiry-emails-so-i-tested-it-357</link>
      <guid>https://dev.to/nikhil-gautam-dev/i-wanted-to-know-when-groq-sends-api-key-expiry-emails-so-i-tested-it-357</guid>
      <description>&lt;p&gt;A few days ago, I created a Groq API key with a 7-day expiry.&lt;/p&gt;

&lt;p&gt;About an hour later, I got an email from Groq saying that the key would expire in 7 days.&lt;/p&gt;

&lt;p&gt;That felt a little weird.&lt;/p&gt;

&lt;p&gt;If the key was going to expire after 7 days, why was I getting an expiry warning almost immediately after creating it?&lt;/p&gt;

&lt;p&gt;So I started looking into it.&lt;/p&gt;

&lt;p&gt;Not by reading the source code or guessing how their backend works. I just created a few keys with different expiry dates and watched what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, I wanted a control
&lt;/h2&gt;

&lt;p&gt;I created another key, but this time I gave it a much longer expiry — 30 days.&lt;/p&gt;

&lt;p&gt;No email.&lt;/p&gt;

&lt;p&gt;That made the first case a little more interesting.&lt;/p&gt;

&lt;p&gt;It didn't look like Groq was simply sending an email whenever a new API key was created.&lt;/p&gt;

&lt;p&gt;It seemed more likely that the notification depended on &lt;strong&gt;how close the key was to its expiry date&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So I created a few more keys with a 7-day expiry.&lt;/p&gt;

&lt;p&gt;And again, I started getting the emails shortly after creating them.&lt;/p&gt;

&lt;p&gt;The exact delay wasn't always the same.&lt;/p&gt;

&lt;p&gt;Sometimes it was around 30 minutes, sometimes 40 minutes, sometimes a little longer.&lt;/p&gt;

&lt;p&gt;That also made one thing clear:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This probably isn't happening directly inside the API-key creation request.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There seems to be some background process checking for keys that are approaching expiry and sending the notification separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I noticed something else
&lt;/h2&gt;

&lt;p&gt;While looking at the expiry timestamps, I noticed that the keys created with the same expiry date were all ending at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;18:29:59.999 UTC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since I'm in India, that's:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;23:59:59.999 IST
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the expiry seems to be tied to the &lt;strong&gt;end of the selected calendar day&lt;/strong&gt;, rather than an exact number of hours from the moment the key was created.&lt;/p&gt;

&lt;p&gt;That explained another small detail.&lt;/p&gt;

&lt;p&gt;A key I created in the evening could still expire at the end of the selected expiry date, regardless of the exact time I created it.&lt;/p&gt;

&lt;h2&gt;
  
  
  But the interesting part came later
&lt;/h2&gt;

&lt;p&gt;I created another key with an expiry date only a few days away.&lt;/p&gt;

&lt;p&gt;Later, I received an email saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your Groq API key will expire in 24 hours.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I checked the actual expiry timestamp.&lt;/p&gt;

&lt;p&gt;There were still roughly &lt;strong&gt;35 hours&lt;/strong&gt; left.&lt;/p&gt;

&lt;p&gt;That was interesting.&lt;/p&gt;

&lt;p&gt;If the email literally meant "this key will expire exactly 24 hours from now", the numbers didn't match.&lt;/p&gt;

&lt;p&gt;So I started thinking that "24 hours" might not actually mean a strict 24-hour threshold.&lt;/p&gt;

&lt;p&gt;It could be based on the &lt;strong&gt;expiry date&lt;/strong&gt; instead.&lt;/p&gt;

&lt;p&gt;In other words, Groq may be thinking something closer to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your key expires tomorrow.
Send the "24 hours" warning.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;rather than:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Expiry time - current time &amp;lt;= 24 hours.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can't say that's definitely how their system works, but the timestamps make the second explanation harder to believe.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is actually happening?
&lt;/h2&gt;

&lt;p&gt;After playing around with different expiry dates, my current understanding is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Groq doesn't appear to send an expiry email simply because a key was created.&lt;/li&gt;
&lt;li&gt;Keys that are already close to their expiry date can trigger a notification shortly after creation.&lt;/li&gt;
&lt;li&gt;The notification seems to happen asynchronously rather than as part of key creation.&lt;/li&gt;
&lt;li&gt;The expiry date appears to represent the end of a calendar day.&lt;/li&gt;
&lt;li&gt;The "24 hours" warning doesn't necessarily mean exactly 24 hours are remaining.&lt;/li&gt;
&lt;li&gt;There also seem to be different warning points, rather than receiving an email every day as the key gets closer to expiry.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I initially thought I might find something like an hourly cron job checking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if expiry &amp;lt; now + 7 days:
     send_email()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the timings don't give enough evidence to say that.&lt;/p&gt;

&lt;p&gt;And honestly, that's the interesting part.&lt;/p&gt;

&lt;p&gt;I started with a simple question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Why did Groq email me about a key that was supposedly going to expire in 7 days?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After a few keys and a few timestamps, it turned into a small black-box investigation into how an API platform handles expiry notifications.&lt;/p&gt;

&lt;p&gt;I still don't know exactly what Groq's internal scheduler looks like.&lt;/p&gt;

&lt;p&gt;But I now have a much better idea of what the system is doing from the outside.&lt;/p&gt;

&lt;p&gt;And that's probably enough for me to stop creating API keys for now.&lt;/p&gt;

&lt;p&gt;There is one more thing I want to test though:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does changing the timezone change the actual expiry timestamp?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's a test for another day.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://nikhilgautam.me/blog/i-wanted-to-know-when-groq-sends-api-key-expiry-emails-so-i-tested-it/" rel="noopener noreferrer"&gt;my blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>backend</category>
      <category>testing</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
