<?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: ishanbassi</title>
    <description>The latest articles on DEV Community by ishanbassi (@ishanbassi).</description>
    <link>https://dev.to/ishanbassi</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%2F1470321%2F47b23663-3014-444b-b708-8a5ef2e03f3e.png</url>
      <title>DEV Community: ishanbassi</title>
      <link>https://dev.to/ishanbassi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ishanbassi"/>
    <language>en</language>
    <item>
      <title>Trademarx - A free public API for Indian Trademarks</title>
      <dc:creator>ishanbassi</dc:creator>
      <pubDate>Mon, 24 Aug 2026 13:00:43 +0000</pubDate>
      <link>https://dev.to/ishanbassi/trademarx-a-free-public-api-for-indian-trademarks-3d55</link>
      <guid>https://dev.to/ishanbassi/trademarx-a-free-public-api-for-indian-trademarks-3d55</guid>
      <description>&lt;p&gt;We run an IP law practice. At some point our internal tooling needed to search the Indian Trade Marks Registry programmatically, so we scraped it — 3.3M+ records, going back to Trade Marks Journal issue 1703. Someone building a brand-clearance tool asked if that data was available as an API. It wasn't, so we shipped one.&lt;/p&gt;

&lt;p&gt;This isn't a "look at our product" post. It's what the underlying data source actually does to you when you try to read it at scale, plus the API we ended up with.&lt;/p&gt;

&lt;h2&gt;
  
  
  The registry does not want to be scraped
&lt;/h2&gt;

&lt;p&gt;A few specific things broke us, in no particular order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inconsistent filenames across journal issues.&lt;/strong&gt; The Trade Marks Journal (currently in the 2200s) uses two different filename conventions depending roughly on when the issue was published — no documented boundary, no changelog. Guess wrong and you get a &lt;code&gt;500&lt;/code&gt; with an HTML error page, not a &lt;code&gt;404&lt;/code&gt;. If you're not checking &lt;code&gt;content-type&lt;/code&gt; before parsing, that HTML silently becomes garbage input to your parser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A silent truncation bug that looked like a livelock.&lt;/strong&gt; Our journal backfill stopped advancing one day. We spent real time assuming a deadlock in the crawler's concurrency logic. The actual cause: our HTTP client capped response bodies at 2MB, and the listing page for certain issues needed ~2.3MB. No error, no crash — just fewer rows than existed, forever, until someone diffed the counts against the portal manually.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A "captcha" that's just a JSON endpoint.&lt;/strong&gt; The live trademark-status lookup gates behind what looks like a captcha challenge. Read what the frontend actually calls, though, and it's a plain JSON request-response — no headless browser, no image solving needed. Worth remembering before you reach for Selenium as a default.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The takeaway if you're scraping any government portal: it won't fail loudly. It'll hand you 90% of the data and let you find out about the missing 10% on your own time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we shipped
&lt;/h2&gt;

&lt;p&gt;Two read-only &lt;code&gt;GET&lt;/code&gt; endpoints. Deliberately not more than that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Search by name / class&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-API-Key: &lt;/span&gt;&lt;span class="nv"&gt;$TRADEMARX_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"https://admin.trademarx.in/api/public/v1/trademarks/search?name=chai&amp;amp;class=30"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Pull one Trade Marks Journal issue&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-API-Key: &lt;/span&gt;&lt;span class="nv"&gt;$TRADEMARX_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"https://admin.trademarx.in/api/public/v1/trademarks/journal?journalNo=2145"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both return a JSON array, no envelope object. Pagination metadata lives in headers, not the body:&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="err"&gt;X-Total-Count: 4213
Link: &amp;lt;...&amp;amp;page=1&amp;gt;; rel="next", &amp;lt;...&amp;amp;page=49&amp;gt;; rel="last"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A minimal Python client, stdlib only:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TRADEMARX_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://admin.trademarx.in/api/public/v1/trademarks/search?name=nike&amp;amp;class=25&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-API-Key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; results, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;X-Total-Count&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; total&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Response shape, and where it'll bite you
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"NIKE SWIFT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tmClass"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"applicationNo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6765007&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"proprietorName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"NIKE INNOVATE C.V."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"trademarkStatus"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Registered"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"imgUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://admin.trademarx.in/files/2145-41-6303904.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://trademarx.in/trademarks/nike-swift-class-25-6765007"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only three fields are guaranteed non-null: &lt;code&gt;applicationNo&lt;/code&gt;, &lt;code&gt;tmClass&lt;/code&gt;, &lt;code&gt;url&lt;/code&gt;. Everything else can be null, and that's not a formality:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;name&lt;/code&gt; is null for a real chunk of the register — device/figurative marks with no word element. &lt;strong&gt;Key on &lt;code&gt;applicationNo&lt;/code&gt;, not &lt;code&gt;name&lt;/code&gt;.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;trademarkStatus&lt;/code&gt; is null for most records, because the registry hasn't published a status, not because we dropped it. Don't render that as &lt;code&gt;"Unknown"&lt;/code&gt; in a UI where someone might read it as a legal fact.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;trademarkStatus&lt;/code&gt; is free text with no fixed vocabulary — &lt;code&gt;"Registered"&lt;/code&gt;, &lt;code&gt;"Abandoned"&lt;/code&gt;, &lt;code&gt;"Formalities Chk Pass"&lt;/code&gt;, whatever the registry typed that day. Match loosely, don't switch on exact strings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limits, on purpose
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Thing&lt;/th&gt;
&lt;th&gt;Limit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requests/day, per endpoint group&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Page size&lt;/td&gt;
&lt;td&gt;20 (capped, even if you ask for more)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max pages&lt;/td&gt;
&lt;td&gt;50 (&lt;code&gt;page&lt;/code&gt; 0–49)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deepest reachable record&lt;/td&gt;
&lt;td&gt;1,000 (narrow your query instead of paging past this)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No bulk export, no &lt;code&gt;POST&lt;/code&gt;. That's deliberate — a free tier that also does bulk dumps just becomes someone else's dataset business subsidized by us. If you need bulk, email us.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auth is boringly simple
&lt;/h2&gt;

&lt;p&gt;One header, no expiry, no OAuth dance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;X-API-Key: tmx_live_xxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CORS is open on &lt;code&gt;/api/public/v1/**&lt;/code&gt;, so it works straight from browser JS for a demo. Don't ship a production app with the key in client-side code, though — anyone with devtools open can read it. Proxy through your own backend once it's real.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one condition
&lt;/h2&gt;

&lt;p&gt;It's free in exchange for an attribution link staying visible on your registered domain — checked weekly, warns before it suspends. Every response also carries a &lt;code&gt;url&lt;/code&gt; field pointing at the canonical page for that record, which doubles as a natural per-result attribution link if you'd rather do it that way than a single site-wide badge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spec + getting a key
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;OpenAPI 3.1 spec, generated from the live controllers so it can't drift: &lt;code&gt;https://trademarx.in/openapi.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Keys, instant, no approval queue: &lt;code&gt;https://trademarx.in/developers&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Curious if anyone here has dealt with similarly inconsistent government data sources — the filename-scheme-changes-with-no-notice thing feels like it can't be unique to Indian trademark filings.&lt;/p&gt;

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