<?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: Sardar Anam Ullah Shad</title>
    <description>The latest articles on DEV Community by Sardar Anam Ullah Shad (@sardaranamullahshad).</description>
    <link>https://dev.to/sardaranamullahshad</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%2F4271753%2F4f85cf42-3b74-4ffe-9378-bda259c1b20a.png</url>
      <title>DEV Community: Sardar Anam Ullah Shad</title>
      <link>https://dev.to/sardaranamullahshad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sardaranamullahshad"/>
    <language>en</language>
    <item>
      <title>A Free, No-Key JSON API for Pakistan Gold, Silver, Dollar and Petrol Rates</title>
      <dc:creator>Sardar Anam Ullah Shad</dc:creator>
      <pubDate>Sun, 29 Nov 2026 05:54:39 +0000</pubDate>
      <link>https://dev.to/sardaranamullahshad/a-free-no-key-json-api-for-pakistan-gold-silver-dollar-and-petrol-rates-1bda</link>
      <guid>https://dev.to/sardaranamullahshad/a-free-no-key-json-api-for-pakistan-gold-silver-dollar-and-petrol-rates-1bda</guid>
      <description>&lt;p&gt;Every Pakistani finance side project I looked at had the same problem: the numbers users care about most (the tola price of gold, the silver rate, the open-market dollar, the petrol price) were typed in by hand. Some apps even tell users to "update the rate from Google".&lt;/p&gt;

&lt;p&gt;So I opened up the data behind &lt;a href="https://crozax.com" rel="noopener noreferrer"&gt;CROZAX&lt;/a&gt; as one free endpoint. No key, no sign-up, and CORS is enabled so it works straight from the browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//crozax.com/api/v1/rates&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's in the response
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;gold.pkr_per_tola&lt;/code&gt; — 24K, 22K, 21K and 18K per tola in PKR, plus &lt;code&gt;pkr_per_10g_24k&lt;/code&gt; and &lt;code&gt;usd_per_oz&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;silver&lt;/code&gt; — per tola, per 10 g and USD per ounce&lt;/li&gt;
&lt;li&gt;&lt;code&gt;usd_pkr_interbank&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;open_market&lt;/code&gt; — buy/sell rates for USD, EUR, GBP, SAR, AED and more&lt;/li&gt;
&lt;li&gt;petrol and diesel prices&lt;/li&gt;
&lt;li&gt;an &lt;code&gt;updated&lt;/code&gt; timestamp and an &lt;code&gt;attribution&lt;/code&gt; string on every response&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://crozax.com/api/v1/rates"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;tola24k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gold&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pkr_per_tola&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"24k"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;silverTola&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;silver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pkr_per_tola&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Zakat nisab (silver standard = 52.5 tola, gold standard = 7.5 tola)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;nisabSilver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;52.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;silverTola&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;nisabGold&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;7.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;tola24k&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;tola24k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nisabSilver&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nisabGold&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How the gold figure is calculated
&lt;/h2&gt;

&lt;p&gt;The tola price is the international spot price converted to rupees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;24K per tola = gold_usd_per_oz / 31.1035 * 11.6638 * USD_PKR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A tola (11.6638 g) is about 0.375 troy ounce. On 29 Nov 2026: 3,650 × 0.375 × 276.53 ≈ Rs 378,500. 22K is 24K × 22/24.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caveat:&lt;/strong&gt; this is a spot-converted reference rate. The sarafa (bazaar) rate published by jewellers' associations includes a local premium and can differ, and jewellery adds making charges. Say so if you show it to buyers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fair-use rules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cache for at least 60 seconds&lt;/li&gt;
&lt;li&gt;Show "Data: CROZAX" with a link next to the numbers&lt;/li&gt;
&lt;li&gt;Don't resell it as your own feed (heavy automated use is rate-limited)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full terms: &lt;a href="https://crozax.com/press#api" rel="noopener noreferrer"&gt;crozax.com/press&lt;/a&gt;. If you'd rather not write code, there's a one-line iframe widget at &lt;a href="https://crozax.com/widgets" rel="noopener noreferrer"&gt;crozax.com/widgets&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions, bugs or a field you need? Leave a comment.&lt;/p&gt;

</description>
      <category>api</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
