<?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: IP-API.io team</title>
    <description>The latest articles on DEV Community by IP-API.io team (@ipapiio).</description>
    <link>https://dev.to/ipapiio</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%2F4281409%2F4fd51c6c-bd34-41e4-a1d5-7b58f0f43824.jpg</url>
      <title>DEV Community: IP-API.io team</title>
      <link>https://dev.to/ipapiio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ipapiio"/>
    <language>en</language>
    <item>
      <title>Fetch first, render second when collecting Markdown from public pages</title>
      <dc:creator>IP-API.io team</dc:creator>
      <pubDate>Thu, 03 Dec 2026 22:12:05 +0000</pubDate>
      <link>https://dev.to/ipapiio/fetch-first-render-second-when-collecting-markdown-from-public-pages-1n16</link>
      <guid>https://dev.to/ipapiio/fetch-first-render-second-when-collecting-markdown-from-public-pages-1n16</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I’m publishing on behalf of Oddbench, which makes the GimmePage API used below.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A docs collector hits two kinds of pages. On some, the first HTML response already contains the article. On others, it contains navigation and an empty element that JavaScript fills in. Running a browser for every URL can work, but it pays the rendering cost even for ordinary static pages.&lt;/p&gt;

&lt;p&gt;I use a content check to choose. The example below expects a known section heading from a public documentation page. If the first response has a successful origin status and is missing that heading, it asks for one rendered copy. If the origin returned a 404, or the API request failed, the job surfaces that error. Rendering is reserved for a page the fetch succeeded in retrieving but whose content is incomplete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test for the content you came for
&lt;/h2&gt;

&lt;p&gt;The check should come from the job. A minimum length can work for a fixed template, but a long navigation menu or an error banner can satisfy it. A known heading, a documentation section ID, or a marker in a page you control is more specific. Avoid using a marker that also appears in global navigation.&lt;/p&gt;

&lt;p&gt;Here’s a Node.js example with a single rendering fallback. It uses GimmePage’s plain response mode and reads the origin status and charged credits from response headers. Set the API key as an environment variable and use a URL and heading from a public page you expect to collect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hasHeading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;\&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/^&lt;/span&gt;#&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;+?&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;heading&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="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;fetch&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;endpoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://gimmepage.com/v1/fetch"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URLSearchParams&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;render&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;render&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="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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;,&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="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Bearer ${apiKey}`&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;90_000&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Fetch API returned HTTP ${response.status}`&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;siteStatus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&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="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Gimmepage-Site-Status"&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;siteStatus&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;siteStatus&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Unexpected source HTTP status: ${siteStatus || "missing"}`&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&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="n"&gt;credits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&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="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Gimmepage-Cost"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;render&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="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;collectPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;fetch&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;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&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="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;hasHeading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;first&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;rendered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&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="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;hasHeading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rendered&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;heading&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="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected heading missing after rendering"&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="k"&gt;return&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="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rendered&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;credits&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rendered&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;credits&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;p&gt;For example, call &lt;code&gt;collectPage("https://example.com/", "Example Domain", process.env.GIMMEPAGE_API_KEY)&lt;/code&gt;. The final object reports whether rendering was used and how many credits the successful path consumed. If the job throws, record charges per attempt in your request metrics. A successful fetch can cost credits even when its content fails your application’s check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure how often you fall back
&lt;/h2&gt;

&lt;p&gt;At the standard rate, a successful fetch without rendering costs one credit. A successful rendered fetch costs five. A job that gets two successful responses therefore costs six credits. If 10% of pages need both attempts, the average is 1.5 credits per page. For a known client-rendered template, it can make sense to render upfront and save the first request. The break-even point is an 80% fallback rate under these assumptions.&lt;/p&gt;

&lt;p&gt;I’d track fallback rate and cost by source hostname or template. If a batch starts rendering most pages from one source, check whether the template changed or the marker drifted before changing the default.&lt;/p&gt;

&lt;p&gt;See the &lt;a href="https://gimmepage.com/docs/markdown" rel="noopener noreferrer"&gt;Markdown output guide&lt;/a&gt; for what the converter preserves and the &lt;a href="https://gimmepage.com/pricing" rel="noopener noreferrer"&gt;pricing table&lt;/a&gt; for current request costs.&lt;/p&gt;

</description>
      <category>api</category>
    </item>
    <item>
      <title>When HTTP 200 contains a 404: track both statuses in a fetch pipeline</title>
      <dc:creator>IP-API.io team</dc:creator>
      <pubDate>Thu, 03 Dec 2026 21:41:58 +0000</pubDate>
      <link>https://dev.to/ipapiio/when-http-200-contains-a-404-track-both-statuses-in-a-fetch-pipeline-3904</link>
      <guid>https://dev.to/ipapiio/when-http-200-contains-a-404-track-both-statuses-in-a-fetch-pipeline-3904</guid>
      <description>&lt;p&gt;A URL fetcher can successfully retrieve a site’s “not found” page. Your ingestion job still needs to know that the page was missing. If you record only the outer HTTP status, that response looks like a successful import and may reach your search index. If you record only the source status, you can lose the distinction between an upstream response and a problem in your own integration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the statuses different jobs
&lt;/h2&gt;

&lt;p&gt;Use the &lt;strong&gt;fetch API status&lt;/strong&gt; to decide whether you can parse a successful response or need to handle a provider error. Use the &lt;strong&gt;source status&lt;/strong&gt; to decide whether the returned page belongs in your dataset. Keep both in the same log record, along with the provider request ID when one is available. If no source responded, leave the source status empty.&lt;/p&gt;

&lt;p&gt;Here is one decision table for a text ingestion job. The first two rows assume the provider delivers the response from the source site.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fetch API status&lt;/th&gt;
&lt;th&gt;Source status&lt;/th&gt;
&lt;th&gt;Ingestion action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;Check the content type, then pass the text to your parser.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;404 or 410&lt;/td&gt;
&lt;td&gt;Record the missing page and stop. Keep the error page out of your corpus.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;429&lt;/td&gt;
&lt;td&gt;Unavailable&lt;/td&gt;
&lt;td&gt;Delay the job according to the provider’s retry guidance.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;402&lt;/td&gt;
&lt;td&gt;Unavailable&lt;/td&gt;
&lt;td&gt;Stop and alert the account owner. A retry alone cannot add credits.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A source status of 200 does not guarantee usable content. A site can send a sign-in screen or a “not found” message with 200. Check for an expected marker, such as a product identifier, article heading or stable HTML element, before you accept the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep billing out of the ingestion decision
&lt;/h2&gt;

&lt;p&gt;Treat charges as a third field. With GimmePage, for example, &lt;code&gt;format=json&lt;/code&gt; returns &lt;code&gt;site_status&lt;/code&gt;, &lt;code&gt;request_id&lt;/code&gt; and &lt;code&gt;cost&lt;/code&gt; on a successful fetch. A response with outer status 200 and &lt;code&gt;site_status: 404&lt;/code&gt; can have a nonzero &lt;code&gt;cost&lt;/code&gt; because the provider returned the requested page. The job still discards that page for ingestion. On an API error, record the error code and follow its retry guidance. A &lt;code&gt;Retry-After&lt;/code&gt; header can tell your scheduler when it may try again.&lt;/p&gt;

&lt;p&gt;This also changes how you read dashboards. Count a returned 404 under source errors and keep its cost in your spend total. Count an account-level 429 under fetch API errors. If you combine the two, you can end up changing your concurrency settings to solve broken links.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check those cases without making paid requests
&lt;/h2&gt;

&lt;p&gt;Save four small test fixtures based on the table. Give the 200/404 fixture a short HTML error page and a nonzero cost. Assert that the page stays out of the corpus, the source status stays in the log, and the cost still reaches your billing metrics. For the 429 fixture, assert that the job is delayed instead of immediately retried. Add a 200/200 fixture with a missing content marker and verify that it is also kept out of the corpus.&lt;/p&gt;

&lt;p&gt;Oddbench builds both IP-API.io and GimmePage. This example uses GimmePage’s documented response contract. &lt;a href="https://gimmepage.com/docs/api" rel="noopener noreferrer"&gt;API response reference&lt;/a&gt; · &lt;a href="https://gimmepage.com/docs/errors" rel="noopener noreferrer"&gt;Error and retry reference&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>brightdatachallenge</category>
    </item>
    <item>
      <title>A small IP API allowance changes where enrichment belongs in your application</title>
      <dc:creator>IP-API.io team</dc:creator>
      <pubDate>Thu, 03 Dec 2026 21:38:32 +0000</pubDate>
      <link>https://dev.to/ipapiio/a-small-ip-api-allowance-changes-where-enrichment-belongs-in-your-application-42bh</link>
      <guid>https://dev.to/ipapiio/a-small-ip-api-allowance-changes-where-enrichment-belongs-in-your-application-42bh</guid>
      <description>&lt;p&gt;Disclosure: I represent IP-API.io. The examples below use its public API contract. The design applies to other metered enrichment APIs too. No authenticated lookup was made while preparing this example.&lt;/p&gt;

&lt;p&gt;A free API plan still has a request budget. If an application enriches an IP on every page load, the integration can exhaust a small allowance before there is enough traffic to learn whether the enrichment is useful.&lt;/p&gt;

&lt;p&gt;For a concrete example, IP-API.io's current Free plan includes 1,000 IP requests and 100 email validations per monthly billing period. Those are separate allowances. Four IP lookups for each of 250 sessions consume the full IP allowance. A batch request is not a reason to assume that 100 addresses count as one lookup: check the provider's billing rules before estimating cost.&lt;/p&gt;

&lt;p&gt;The first decision is where enrichment changes a useful outcome. An account creation event may need network context; a stylesheet request usually does not. Write that decision down before putting the API call into shared request middleware.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the call on your server
&lt;/h2&gt;

&lt;p&gt;Keep the API key in server configuration. The documented explicit-address endpoint is &lt;code&gt;GET /api/v1/ip/{ip}&lt;/code&gt;, with &lt;code&gt;api_key&lt;/code&gt; as a query parameter. An illustrative request is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;isIP&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:net'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;lookupIP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fetchImpl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;isIP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Expected an IPv4 or IPv6 address'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Missing API key'&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;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/api/v1/ip/${encodeURIComponent(ip)}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'https://ip-api.io'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searchParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'api_key'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;try&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchImpl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1500&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'unavailable'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'available'&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="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;response&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="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'unavailable'&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function only validates address syntax. Resolve the visitor address at your trusted proxy boundary and apply your private/reserved-address policy before calling it. Do not trust an arbitrary &lt;code&gt;X-Forwarded-For&lt;/code&gt; value supplied by a client. Normalize equivalent IPv6 representations before using an address as a cache key.&lt;/p&gt;

&lt;p&gt;The explicit address matters: when your backend calls a “detect my IP” endpoint, the provider can see your backend's connection. Sending the address you actually intend to enrich avoids confusing your server's network with your visitor's network.&lt;/p&gt;

&lt;p&gt;Query-string keys also need attention in access logs, tracing and exception reports. Redact &lt;code&gt;api_key&lt;/code&gt; and avoid recording the full outbound URL. The example returns a sanitized unavailable result instead of returning an exception that may include it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reuse work and set a budget
&lt;/h2&gt;

&lt;p&gt;Cache successful results for a deliberately chosen period, and bound the cache size. There is a tradeoff: a longer cache lifetime reduces calls but can retain stale network context. An ASN lookup and a time-sensitive security signal may need different policies.&lt;/p&gt;

&lt;p&gt;Also coalesce concurrent requests for the same address. Ten simultaneous requests can all miss an ordinary cache before the first result arrives. An in-flight promise map, removed in a &lt;code&gt;finally&lt;/code&gt; block, lets them share one provider request. For multiple workers, both cache and admission decisions need shared coordination if a global limit matters.&lt;/p&gt;

&lt;p&gt;Caching is not a monthly quota guarantee. Track actual outbound lookups and use a shared budget before admitting new ones. Leave headroom for testing and operations. The public contract documents &lt;code&gt;/api/v1/ratelimit&lt;/code&gt; for quota and renewal information; read the actual renewal date rather than assuming a calendar-month reset. Do not add a quota request to every visitor request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat unavailable as its own state
&lt;/h2&gt;

&lt;p&gt;A timeout, a 429, and an invalid key all mean that enrichment is unavailable. They do not mean that an address is safe. Decide separately whether the application can continue without the signal, needs a later review, or must stop a particular operation. A background analytics job and an account-recovery flow can reasonably make different decisions.&lt;/p&gt;

&lt;p&gt;For a 429, avoid an immediate retry loop. Respect any documented retry guidance and wait for budget to become available. For authentication errors, alert the operator without logging the key. If you retry transient failures, cap attempts and count them in the budget; an aborted HTTP request may already have reached the provider.&lt;/p&gt;

&lt;p&gt;Finally, an address shared by a VPN, company gateway or mobile network can represent many people. Network enrichment is context. Keep it separate from a conclusion that a person is fraudulent, and avoid using one flag as an automatic rejection rule.&lt;/p&gt;

&lt;p&gt;Public references: &lt;a href="https://ip-api.io/api-docs.html" rel="noopener noreferrer"&gt;IP-API.io API documentation&lt;/a&gt;, &lt;a href="https://ip-api.io/openapi.json" rel="noopener noreferrer"&gt;machine-readable OpenAPI contract&lt;/a&gt;, and &lt;a href="https://ip-api.io/#pricing" rel="noopener noreferrer"&gt;Free plan and current allowances&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Validation: the JavaScript example passed six checks with a simulated fetch transport: invalid IP, missing key, IPv6 URL/auth construction, 429, network failure and invalid JSON. No network calls or real API key were used for those checks.&lt;/p&gt;

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