<?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: IderaDevTools</title>
    <description>The latest articles on DEV Community by IderaDevTools (@ideradevtools).</description>
    <link>https://dev.to/ideradevtools</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%2F692047%2Fa74c3570-fc25-4d45-89cb-8c37071e8a0f.jpg</url>
      <title>DEV Community: IderaDevTools</title>
      <link>https://dev.to/ideradevtools</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ideradevtools"/>
    <language>en</language>
    <item>
      <title>How to Upscale AI Generated Images Before Your Users Download or Print Them</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Wed, 18 Nov 2026 07:53:15 +0000</pubDate>
      <link>https://dev.to/ideradevtools/how-to-upscale-ai-generated-images-before-your-users-download-or-print-them-5cb2</link>
      <guid>https://dev.to/ideradevtools/how-to-upscale-ai-generated-images-before-your-users-download-or-print-them-5cb2</guid>
      <description>&lt;p&gt;To upscale AI generated images to a size people can print, enlarge the file after the model renders it. Filestack Image Upscaling doubles an image with one &lt;code&gt;upscale&lt;/code&gt; segment in an &lt;a href="https://www.filestack.com/products/image-transformations/" rel="noopener noreferrer"&gt;image editing API&lt;/a&gt; URL on the CDN. We built a small Node service around it (Node 20.6 or later) that makes each download size once, the first time someone asks for it, and sends every later download to the stored file.&lt;/p&gt;

&lt;p&gt;A user of your app generates an illustration and wants it on their wall, but the image model rendered it at 1672 x 941 pixels, the size of a laptop screen. At the 300 pixels per inch many print shops ask for, it prints 5.6 inches wide, and the model may not offer a bigger render.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;upscale&lt;/code&gt; doubles the width and height of an image, in the format it arrived in. Two passes with a &lt;code&gt;resize&lt;/code&gt; between them take a 1672 x 941 render to 5330 x 3000.&lt;/li&gt;
&lt;li&gt;The task accepts inputs up to 4,000,000 pixels, so the second pass needs the image shrunk to fit first. &lt;code&gt;fit:max&lt;/code&gt; does that without changing the shape.&lt;/li&gt;
&lt;li&gt;On the line art in this article, &lt;code&gt;style:artwork&lt;/code&gt; keeps the outlines about as dark as the model drew them, and the default &lt;code&gt;photo&lt;/code&gt; style draws them slightly softer.&lt;/li&gt;
&lt;li&gt;Upscale when a user asks for a size, store the result, and serve the stored file with &lt;code&gt;?dl=true&lt;/code&gt; from then on.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;resize&lt;/code&gt; enlarges the pixels that are already there, so it blurs the outlines that &lt;code&gt;upscale&lt;/code&gt; keeps sharp.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why generated images come out too small to print
&lt;/h2&gt;

&lt;p&gt;Image models usually render at a fixed set of sizes, and the larger sizes cost more per image and take longer. For a screen that’s fine. A poster, a canvas or a sticker sheet is different. The print shop works in inches and pixels per inch, and 1672 pixels runs out quickly:&lt;/p&gt;

&lt;p&gt;The service below offers the last two rows as download sizes, and calls them &lt;code&gt;large&lt;/code&gt; and &lt;code&gt;print&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four ways to make a bigger file
&lt;/h2&gt;

&lt;p&gt;We built the service around the last option. It renders at the small size and upscales only the images people download, so the cost lands on the images that get used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upscale AI generated images with one URL segment
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;upscale&lt;/code&gt; is a path segment in front of the image’s handle, and it runs on Start, Grow and Scale:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://cdn.filestackcontent.com/upscale/HANDLE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For the illustration above, that returns a 3344 x 1882 PNG. The output keeps the input’s format, and &lt;code&gt;upscale/output=format:jpg&lt;/code&gt; returns a JPEG if the print shop wants one. The &lt;a href="https://blog.filestack.com/start-grow-scale-now-include-image-upscaling/" rel="noopener noreferrer"&gt;upscale parameters and limits&lt;/a&gt; post covers the &lt;code&gt;noise&lt;/code&gt; and &lt;code&gt;upscale&lt;/code&gt; parameters, which a clean render doesn’t need.&lt;/p&gt;

&lt;p&gt;Here’s what that does to the illustration’s edges. The figure below starts from the illustration shrunk to half its width, doubles it back three ways, and compares each with the original render. The number under each crop is PSNR, where higher means closer to the original.&lt;/p&gt;

&lt;p&gt;On this illustration, &lt;code&gt;resize&lt;/code&gt; lands at 28.8 dB and both upscale styles at about 35.6. The blur on the resized tile’s outline is the difference you see.&lt;/p&gt;

&lt;h2&gt;
  
  
  Artwork style or photo style for generated art
&lt;/h2&gt;

&lt;p&gt;The figure also shows a choice the service makes for every image. &lt;code&gt;style&lt;/code&gt; takes &lt;code&gt;photo&lt;/code&gt;, the default, or &lt;code&gt;artwork&lt;/code&gt;. The two score almost the same against the original here. What differs is the line. Edge contrast, the average difference between neighboring pixels, is 2.12 on the original illustration, 2.18 with &lt;code&gt;style:artwork&lt;/code&gt; and 1.94 with the default. A second line-art illustration from the same model follows the same pattern, 2.41 against 2.47 and 2.22. So on this art, &lt;code&gt;artwork&lt;/code&gt; keeps the outlines about as dark as the model drew them and &lt;code&gt;photo&lt;/code&gt; softens them slightly.&lt;/p&gt;

&lt;p&gt;Your app already knows which style to use. If the user chose an illustration, line art or sticker preset when they generated the image, use &lt;code&gt;artwork&lt;/code&gt;. If they chose a photographic preset, use &lt;code&gt;photo&lt;/code&gt;. That’s why the service stores the style on each image record, and the illustration’s record says &lt;code&gt;artwork&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep large renders under the input limit
&lt;/h2&gt;

&lt;p&gt;One upscale gets the illustration to the &lt;code&gt;large&lt;/code&gt; size. The &lt;code&gt;print&lt;/code&gt; size needs a second pass, and that’s where the input limit comes in. One upscale of a 1672 x 941 render gives 3344 x 1882, which is 6.3 million pixels. A second &lt;code&gt;upscale&lt;/code&gt; straight after it fails, because the task accepts inputs up to 4,000,000 pixels:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP 400
... The input image is too large. Maximum allowed size for upscale task is 4000000 pixels (failed task index 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The failed task index counts from 0, so index 1 is the second &lt;code&gt;upscale&lt;/code&gt;. So we put a &lt;code&gt;resize&lt;/code&gt; between the passes to shrink the image to fit, and &lt;code&gt;fit:max&lt;/code&gt; keeps the shape inside a width and height box. &lt;code&gt;upscaleTasks&lt;/code&gt; in &lt;code&gt;upscale.mjs&lt;/code&gt; works out the chain for any render size. The same file signs the request and stores the result, which the next section uses:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createHmac } from 'node:crypto';
const CDN = 'https://cdn.filestackcontent.com';
const LIMIT = 4_000_000; // largest input upscale accepts, in pixels
// Doubles the image `passes` times, shrinking it under the limit before any pass that needs it
export function upscaleTasks(width, height, passes, style) {
  const tasks = [];
  for (let i = 0; i &amp;lt; passes; i++) {
    if (width * height &amp;gt; LIMIT) {
      const scale = Math.sqrt(LIMIT / (width * height));
      const w = Math.floor(width * scale);
      const h = Math.floor(height * scale);
      tasks.push(`resize=width:${w},height:${h},fit:max`);
      [width, height] = [w, h];
    }
    tasks.push(`upscale=style:${style}`);
    [width, height] = [width * 2, height * 2];
  }
  return { tasks: tasks.join('/'), width, height };
}
function security() {
  const expiry = Math.floor(Date.now() / 1000) + 300;
  const policy = Buffer.from(JSON.stringify({ call: ['read', 'convert', 'store'], expiry }))
    .toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_');
  const signature = createHmac('sha256', process.env.FILESTACK_APP_SECRET).update(policy).digest('hex');
  return `security=p:${policy},s:${signature}`;
}
// Runs the chain once and keeps the result as a file of its own
export async function storeUpscaled(handle, tasks) {
  const res = await fetch(`${CDN}/${security()}/${tasks}/store/${handle}`);
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  return (await res.json()).handle;
}
export const downloadUrl = (handle) =&amp;gt; `${CDN}/${handle}?dl=true`;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For the illustration, two passes give &lt;code&gt;upscale=style:artwork/resize=width:2665,height:1500,fit:max/upscale=style:artwork&lt;/code&gt; and a 5330 x 3000 file. A square 1024 render gives 4000 x 4000, and a render already over the limit, such as 2048 x 2048, is shrunk before the first pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  Store each size the first time someone asks
&lt;/h2&gt;

&lt;p&gt;At this point the service knows which chain to run for each size. What it doesn’t have yet is a file to hand the user.&lt;/p&gt;

&lt;p&gt;Upscaled output delivered by URL is cached at the CDN for 31 days. A download button needs more than that: one file per size that stays put, and a filename the browser saves instead of opens. Chaining &lt;code&gt;store&lt;/code&gt; after the tasks keeps the result as a file of its own, and its policy needs the &lt;code&gt;store&lt;/code&gt; call alongside &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;convert&lt;/code&gt;. Adding &lt;code&gt;?dl=true&lt;/code&gt; to the stored file’s URL sends it with &lt;code&gt;Content-Disposition: attachment&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;server.mjs&lt;/code&gt; puts that together. It makes each size the first time someone asks for it, then redirects every later request to the stored file. It assumes each generated image is already stored in your Filestack application, with its handle, width and height on the image record. It’s plain Node with no packages, and needs Node 20.6 or later for &lt;code&gt;--env-file&lt;/code&gt; and a &lt;code&gt;.env&lt;/code&gt; file holding the app secret from the Developer Portal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FILESTACK_APP_SECRET=YOUR_APP_SECRET

import { createServer } from 'node:http';
import { upscaleTasks, storeUpscaled, downloadUrl } from './upscale.mjs';
// Stand-in for your images table: one row per generated image
const images = new Map([
  ['img_7Qx', { handle: 'kxqdtjH1RFyA1rNZyZZs', width: 1672, height: 941, style: 'artwork', files: {} }],
]);
const SIZES = { large: 1, print: 2 }; // upscale passes per download size
const pending = new Map();
async function fileFor(id, size) {
  const image = images.get(id);
  if (image.files[size]) return image.files[size];
  const key = `${id}:${size}`;
  if (!pending.has(key)) {
    const { tasks, width, height } = upscaleTasks(image.width, image.height, SIZES[size], image.style);
    pending.set(key, storeUpscaled(image.handle, tasks).then((handle) =&amp;gt; {
      image.files[size] = { handle, width, height };
      console.log(id, size, tasks, '-&amp;gt;', handle, `${width}x${height}`);
      return image.files[size];
    }).finally(() =&amp;gt; pending.delete(key)));
  }
  return pending.get(key);
}
createServer(async (req, res) =&amp;gt; {
  const { pathname, searchParams } = new URL(req.url, 'http://localhost');
  const match = pathname.match(/^\/images\/(\w+)\/download$/);
  const size = searchParams.get('size') ?? 'large';
  if (!match || !images.has(match[1]) || !Object.hasOwn(SIZES, size)) {
    res.writeHead(404).end();
    return;
  }
  try {
    const file = await fileFor(match[1], size);
    res.writeHead(302, { Location: downloadUrl(file.handle) }).end();
  } catch (err) {
    console.error(match[1], size, err.message);
    res.writeHead(502).end('Could not prepare the download');
  }
}).listen(8789, () =&amp;gt; console.log('downloads on :8789'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;images&lt;/code&gt; stands in for your generated images table, with one row for the illustration, &lt;code&gt;img_7Qx&lt;/code&gt;. The first request for a size waits for the upscale. For this illustration that’s about 10 seconds for &lt;code&gt;large&lt;/code&gt; and about 30 for &lt;code&gt;print&lt;/code&gt;, so show the user a “preparing your file” state rather than a spinning button. &lt;code&gt;pending&lt;/code&gt; makes three quick clicks on the same button share one upscale and one stored file. Requests after that redirect straight away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it
&lt;/h2&gt;

&lt;p&gt;The policy is signed with your app secret, so the &lt;code&gt;img_7Qx&lt;/code&gt; row needs an image stored in your own application. Put that image’s handle, width and height in the row, start the service, then ask for the print size:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --env-file=.env server.mjs
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' "http://127.0.0.1:8789/images/img_7Qx/download?size=print"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;curl prints &lt;code&gt;302&lt;/code&gt; &lt;a href="https://cdn.filestackcontent.com/HANDLE?dl=true" rel="noopener noreferrer"&gt;&lt;code&gt;https://cdn.filestackcontent.com/HANDLE?dl=true&lt;/code&gt;&lt;/a&gt;, and the service logs the chain it ran and the size it made. For the 1672 x 941 illustration, that’s:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;img_7Qx print upscale=style:artwork/resize=width:2665,height:1500,fit:max/upscale=style:artwork -&amp;gt; HANDLE 5330x3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Run the same curl again and it redirects to the stored file straight away, with no new upscale and no new log line. An unknown image or size returns &lt;code&gt;404&lt;/code&gt;, and a failed upscale returns &lt;code&gt;502&lt;/code&gt; without storing anything, so the next click tries again.&lt;/p&gt;

&lt;h2&gt;
  
  
  What upscaling every download costs
&lt;/h2&gt;

&lt;p&gt;Image Upscaling includes 1,000 images a month, then $0.025 an image. With the service above, an image is upscaled only when someone downloads it, and only once per size. Images that are viewed and never downloaded cost nothing extra.&lt;/p&gt;

&lt;p&gt;To show upscaled images on a page as well, use the CDN URL without &lt;code&gt;store&lt;/code&gt;. The &lt;a href="https://www.filestack.com/features/smart-image-processing/" rel="noopener noreferrer"&gt;smart image processing&lt;/a&gt; page covers the other image tasks. For a front end that shows the before and after, the &lt;a href="https://blog.filestack.com/upscale-images-react/" rel="noopener noreferrer"&gt;upscaling in a React app&lt;/a&gt; walkthrough builds one.&lt;/p&gt;

&lt;p&gt;Next, swap &lt;code&gt;images&lt;/code&gt; for your generated images table, set &lt;code&gt;style&lt;/code&gt; from the preset each image was generated with, and add a size for each product you print.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/upscale-ai-generated-images/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>ai</category>
    </item>
    <item>
      <title>Mistral OCR, DeepSeek-OCR or an OCR API for Your Documents?</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Mon, 16 Nov 2026 06:03:36 +0000</pubDate>
      <link>https://dev.to/ideradevtools/mistral-ocr-deepseek-ocr-or-an-ocr-api-for-your-documents-29mb</link>
      <guid>https://dev.to/ideradevtools/mistral-ocr-deepseek-ocr-or-an-ocr-api-for-your-documents-29mb</guid>
      <description>&lt;p&gt;A user uploads a scanned contract, and your app needs the text out of it. Two kinds of tool can read that page, and they hand back different things.&lt;/p&gt;

&lt;p&gt;Mistral OCR and DeepSeek-OCR are model-based OCR. They read a page the way a vision model does and return markdown, with headings, lists and tables kept in shape.&lt;/p&gt;

&lt;p&gt;A classic &lt;a href="https://www.filestack.com/features/intelligence/ocr/" rel="noopener noreferrer"&gt;OCR API&lt;/a&gt; returns plain text plus the position of every word on the page, and the same file gives the same words and positions on every request. Pick a model when you want a clean, readable copy of the page to feed a language model. Pick an OCR API when your app needs to know where each word sits, to highlight it, crop it, redact it or match a value to its label.&lt;/p&gt;

&lt;p&gt;Filestack OCR, part of our API for uploading, processing and delivering files, is a classic OCR API. It reads a stored file by its handle, turning a PDF page into an image in the same request, and returns every line and word with a bounding box. We wrote a short Node script for this post that runs it on one page of a scanned agreement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mistral OCR, a hosted API, and DeepSeek-OCR, an open model, both return each page as markdown that keeps headings and tables.&lt;/li&gt;
&lt;li&gt;An OCR API returns every word with a four-point bounding box in the image’s pixels.&lt;/li&gt;
&lt;li&gt;Word positions are what let an app highlight a search hit, pair a value with its label, or pixelate one field.&lt;/li&gt;
&lt;li&gt;Filestack OCR reads images, so a PDF page is converted to PNG in the same URL before OCR runs.&lt;/li&gt;
&lt;li&gt;Whichever reads the text, the file still needs intake, storage and delivery around it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What do Mistral OCR and DeepSeek-OCR return?
&lt;/h2&gt;

&lt;p&gt;Mistral OCR and DeepSeek-OCR both return the page as markdown. A heading stays a heading, a table comes back as a table, and reading order follows the layout rather than the raw position of each line.&lt;/p&gt;

&lt;p&gt;First, Mistral OCR is a hosted API. The &lt;a href="https://docs.mistral.ai/studio/document-processing/basic_ocr" rel="noopener noreferrer"&gt;Mistral OCR documentation&lt;/a&gt; describes a &lt;code&gt;pages&lt;/code&gt; array where each page carries &lt;code&gt;markdown&lt;/code&gt;, extracted &lt;code&gt;images&lt;/code&gt;, &lt;code&gt;tables&lt;/code&gt;, &lt;code&gt;hyperlinks&lt;/code&gt;, a &lt;code&gt;header&lt;/code&gt;, a &lt;code&gt;footer&lt;/code&gt; and the page &lt;code&gt;dimensions&lt;/code&gt;. With &lt;code&gt;include_blocks&lt;/code&gt; turned on, it adds a bounding box for each paragraph-level block of text. Confidence scores are available per page, per block or per word. Mistral bills OCR per 1,000 pages.&lt;/p&gt;

&lt;p&gt;By contrast, DeepSeek-OCR is an open model, and DeepSeek doesn’t host it. The &lt;a href="https://github.com/deepseek-ai/DeepSeek-OCR" rel="noopener noreferrer"&gt;DeepSeek-OCR repository&lt;/a&gt; published the original 3B-parameter model under the MIT license in October 2025.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/deepseek-ai/DeepSeek-OCR-2" rel="noopener noreferrer"&gt;DeepSeek-OCR 2&lt;/a&gt; followed in January 2026 at the same size, under Apache 2.0. Both run through vLLM or Transformers, and DeepSeek’s examples are tested on NVIDIA GPUs. A prompt such as &lt;code&gt;&amp;lt;|grounding|&amp;gt;Convert the document to markdown.&lt;/code&gt; returns the page as markdown in either version, and the grounding mode also locates regions on the page.&lt;/p&gt;

&lt;p&gt;As a result, Mistral OCR and DeepSeek-OCR are both strong at layout. A contract with numbered clauses, or an invoice with a table, comes out as structured text that a language model can read directly. In &lt;a href="https://blog.filestack.com/document-parsing-vs-ocr/" rel="noopener noreferrer"&gt;document parsing versus OCR&lt;/a&gt;, structured output is the main difference, and it decides how much cleanup the text needs before search or extraction.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does an OCR API return that a model doesn’t?
&lt;/h2&gt;

&lt;p&gt;An OCR API returns the position of every word. Each word carries a four-point bounding box in the pixels of the page image. Words are grouped into lines and text areas, alongside the flat text of the whole page.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;read-words.mjs&lt;/code&gt; reads page 1 of the agreement in the figure with Filestack OCR and prints the first words with their boxes. Filestack OCR reads images, so the script converts the PDF page to a PNG in the same URL. The request is signed with a policy that allows &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;convert&lt;/code&gt; for this one file. The script is plain Node with no packages, and it needs Node 20.6 or later for &lt;code&gt;--env-file&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createHmac } from 'node:crypto';
// A five-minute policy that lets this request read and convert one file
function signedUrl(tasks, handle) {
  const expiry = Math.floor(Date.now() / 1000) + 300;
  const policy = Buffer.from(JSON.stringify({ call: ['read', 'convert'], handle, expiry }))
    .toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_');
  const signature = createHmac('sha256', process.env.FILESTACK_APP_SECRET).update(policy).digest('hex');
  return `https://cdn.filestackcontent.com/security=p:${policy},s:${signature}/${tasks}/${handle}`;
}
const [handle, page = '1'] = process.argv.slice(2);
// OCR reads images, so the PDF page is turned into a PNG in the same request
const res = await fetch(signedUrl(`output=format:png,page:${page}/ocr`, handle));
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const ocr = await res.json();
// Every word on the page, with the box it sits in, in the page image's pixels
const words = ocr.document.text_areas.flatMap((area) =&amp;gt; area.lines.flatMap((line) =&amp;gt; line.words));
for (const word of words.slice(0, 5)) {
  const xs = word.bounding_box.map((p) =&amp;gt; p.x);
  const ys = word.bounding_box.map((p) =&amp;gt; p.y);
  console.log(word.text.padEnd(12), `x ${Math.min(...xs)}-${Math.max(...xs)}`, `y ${Math.min(...ys)}-${Math.max(...ys)}`);
}
console.log(`${words.length} words on a ${ocr.page_width} x ${ocr.page_height} page`);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The script reads your app secret from a &lt;code&gt;.env&lt;/code&gt; file in the folder you run it from. Copy the secret from the Security section of your application in the Developer Portal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FILESTACK_APP_SECRET=your_app_secret
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Run it with the handle of a PDF stored in your app and the page number:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --env-file=.env read-words.mjs HANDLE 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For the agreement, it prints:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MASTER       x 165-234 y 55-70
SERVICES     x 240-323 y 54-69
AGREEMENT    x 327-436 y 52-68
Agreement    x 217-265 y 89-102
No.          x 267-284 y 89-100
178 words on a 612 x 792 page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;OCR by handle needs a signed policy, which &lt;code&gt;signedUrl&lt;/code&gt; adds. A request without one returns &lt;code&gt;403 security required for tasks: ocr&lt;/code&gt;. A PDF sent to &lt;code&gt;ocr&lt;/code&gt; without the conversion step returns &lt;code&gt;400&lt;/code&gt; with &lt;code&gt;unsupported mimetype&lt;/code&gt;, so keep &lt;code&gt;output=format:png&lt;/code&gt; in front of &lt;code&gt;ocr&lt;/code&gt;. The full response shape, with text areas, lines and words, is in the &lt;a href="https://www.filestack.com/docs/transformations/intelligence/ocr/" rel="noopener noreferrer"&gt;OCR task reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When are bounding boxes the deciding factor?
&lt;/h2&gt;

&lt;p&gt;Bounding boxes decide the choice whenever your app acts on a place on the page rather than on the text alone. Four common cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Highlighting.&lt;/strong&gt; A search hit or a citation in a chat answer points at the exact line on the page image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Label and value pairing.&lt;/strong&gt; A value printed under the label &lt;code&gt;ORDER NUMBER&lt;/code&gt; belongs to that label. The bounding boxes show which value sits under which label.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redaction.&lt;/strong&gt; A name, an account number or a signature gets pixelated or cropped at its coordinates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Form checks.&lt;/strong&gt; A field that should sit in the top right of a form can be checked by position.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Label pairing also finds the total on an invoice, and we build that lookup step by step in &lt;a href="https://blog.filestack.com/start-grow-scale-now-include-ocr/" rel="noopener noreferrer"&gt;invoice totals from bounding boxes&lt;/a&gt;. If none of these apply, and a language model reads the page next, markdown is often the easier input. Mistral OCR and DeepSeek-OCR both return it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one gives the same output on every run?
&lt;/h2&gt;

&lt;p&gt;Filestack OCR returns the same words and boxes for the same file on every request. For the agreement, &lt;code&gt;read-words.mjs&lt;/code&gt; prints the same five words and boxes each time it runs.&lt;/p&gt;

&lt;p&gt;However, a model that generates its output token by token can phrase or order the same page differently between runs, depending on the model and its sampling settings.&lt;/p&gt;

&lt;p&gt;Therefore, run-to-run variation is fine for a reading copy. It’s a problem when your app stores a field’s position, compares two versions of a document, or needs an audit trail that reproduces. To compare engines on your own pages, you can &lt;a href="https://blog.filestack.com/ocr-api-accuracy-benchmark/" rel="noopener noreferrer"&gt;benchmark OCR accuracy&lt;/a&gt; against a test set with known text.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the options for reading text from uploaded documents?
&lt;/h2&gt;

&lt;p&gt;There are four common ways to get text out of documents your users upload:&lt;/p&gt;

&lt;p&gt;Tesseract is open source, and its code and trained models live in the &lt;a href="https://github.com/tesseract-ocr/tesseract" rel="noopener noreferrer"&gt;Tesseract repository&lt;/a&gt;. In Python, the other common &lt;a href="https://blog.filestack.com/python-ocr-library/" rel="noopener noreferrer"&gt;Python OCR libraries&lt;/a&gt; are EasyOCR and PaddleOCR, and both run on your own server the way Tesseract does. The options also combine. You can keep Filestack OCR for positions and send the same page to a model when you want a markdown copy for a language model.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens to the file before and after OCR?
&lt;/h2&gt;

&lt;p&gt;The file needs work on both sides of the OCR step, whichever engine reads it. Before OCR, the upload is received, checked and stored, and a PDF page or a phone photo is turned into a clean image. After OCR, the text is saved with the file, the page is served when someone opens the citation, and the file is deleted when it’s no longer needed.&lt;/p&gt;

&lt;p&gt;In addition, our API covers that work around OCR. The upload lands through our file picker or upload API, a workflow can scan it for viruses, and Document Detection straightens a photographed page. The CDN then serves the page image when a user follows a citation back to it. Put together, those steps make an &lt;a href="https://www.filestack.com/solutions/pipelines/intelligent-document-processing/" rel="noopener noreferrer"&gt;intelligent document processing pipeline&lt;/a&gt; with OCR as one stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions people ask
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Is Mistral OCR better than an OCR API?
&lt;/h2&gt;

&lt;p&gt;Mistral OCR is better when you want the page as markdown, with tables and headings kept. An OCR API is better when you need each word’s position on the page or the same output on every request. Highlighting, redaction and label matching all work from coordinates, so an app that does any of them needs an OCR API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does DeepSeek-OCR have an API?
&lt;/h2&gt;

&lt;p&gt;DeepSeek-OCR has no hosted API from DeepSeek. The weights are open, so you serve the model with vLLM or Transformers behind your own endpoint, or call it through a third-party inference provider that hosts it. DeepSeek-OCR 2 works the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can an LLM like GPT or Claude do OCR?
&lt;/h2&gt;

&lt;p&gt;Vision language models such as GPT and Claude can read text from an image. They return it in any format you ask for, including markdown or JSON. Their responses carry no position for each word, and their output can vary between runs. So they suit reading and summarizing more than redaction or audit trails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does OCR work on PDFs?
&lt;/h2&gt;

&lt;p&gt;OCR works on PDFs once each page is an image. With Filestack, &lt;code&gt;output=format:png,page:1/ocr&lt;/code&gt; in one URL converts page 1 and reads it. A PDF that already has a text layer can skip OCR, because the text can be extracted directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to try next
&lt;/h2&gt;

&lt;p&gt;OCR runs on the Start, Grow and Scale plans. To run &lt;code&gt;read-words.mjs&lt;/code&gt; on your own documents, &lt;a href="https://www.filestack.com/signup-free/" rel="noopener noreferrer"&gt;create a free account&lt;/a&gt; and choose one of those plans. Then upload a scanned PDF with the file picker or the upload API. The handle is the last part of the file URL the upload returns, and it’s what the script takes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/mistral-ocr-deepseek-ocr-or-ocr-api/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>ocr</category>
      <category>api</category>
    </item>
    <item>
      <title>How to Auto-Close Orders from Proof of Delivery Photos with OCR</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Thu, 12 Nov 2026 12:05:33 +0000</pubDate>
      <link>https://dev.to/ideradevtools/how-to-auto-close-orders-from-proof-of-delivery-photos-with-ocr-5g69</link>
      <guid>https://dev.to/ideradevtools/how-to-auto-close-orders-from-proof-of-delivery-photos-with-ocr-5g69</guid>
      <description>&lt;p&gt;It’s mid-afternoon on route 14, and the driver is at stop 7. They hand over the pallet, get the delivery note signed, lay it on the truck bed and take a photo. The proof of delivery photo goes into the app, and the truck pulls away. Later that day, someone in the office opens the photo, reads the order number and marks the order delivered. If the photo is blurred, cut off or of the wrong note, nobody knows until then. By that time the driver is several stops away, and the customer gets a phone call.&lt;/p&gt;

&lt;p&gt;That office step is what intelligent document processing software for shippers is meant to remove, and two Filestack features cover it between them. OCR reads the order number off the photo while the driver is still at the door, so a bad photo goes straight back for a retake. Document Detection keeps a straightened, shadow-free copy of the note for anyone who reads it later. We built a small Node service around the two to show how they fit together. It’s one of the narrower &lt;a href="https://www.filestack.com/solutions/pipelines/intelligent-document-processing/" rel="noopener noreferrer"&gt;intelligent document processing solutions&lt;/a&gt;, with one document and one decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ocr&lt;/code&gt; reads a photographed delivery note as the driver took it, angle and shadow included, so point it at the uploaded photo.&lt;/li&gt;
&lt;li&gt;Find the order number by its pattern and by the label beside or above it. A second number with the same pattern, such as a back order, has a different label.&lt;/li&gt;
&lt;li&gt;Check the photo inside the driver’s request. An unreadable photo, a missing note or the wrong order goes back to the driver as a retake while they are still at the stop.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;doc_detection&lt;/code&gt; with &lt;code&gt;store&lt;/code&gt; keeps a cropped, straightened, shadow-free copy of the note. Store the original photo alongside it.&lt;/li&gt;
&lt;li&gt;A photo with no note in it still returns a crop from &lt;code&gt;doc_detection&lt;/code&gt;, so the OCR text, not the crop, decides whether a note is there.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the photo has to prove
&lt;/h2&gt;

&lt;p&gt;The photo has one job. It has to show the signed note for the order the driver is delivering. There are three ways it can fail:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The order number can’t be read.&lt;/li&gt;
&lt;li&gt;There’s no note in the photo at all.&lt;/li&gt;
&lt;li&gt;The note belongs to a different order.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each one has the same fix, which is another photo, and the driver is the only person who can take it. So the check can’t wait for someone in the office. It runs in the request the driver’s app makes when they tap “Delivered”, and the service below answers inside that request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four ways to match a proof of delivery photo to an order
&lt;/h2&gt;

&lt;p&gt;There are four usual ways to tie the photo to the order:&lt;/p&gt;

&lt;p&gt;We went with OCR, because it reads any printed note, including the ones a supplier or a customer prints. The catch is in the last column. Besides the order number, a delivery note carries a customer account, a PO number and sometimes a second number in the same format as the order. So the service needs a rule for which number is the order, and that rule gets a file of its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read the photo as the driver took it
&lt;/h2&gt;

&lt;p&gt;The first thing the service does is read the photo. OCR and Document Detection run on Start, Grow and Scale, and both need a signed policy on every request. For &lt;code&gt;ocr&lt;/code&gt; the policy needs the &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;convert&lt;/code&gt; calls, and an unsigned request returns &lt;code&gt;403 security required for tasks: ocr&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The photo at the top of this post is taken at an angle, on a ribbed truck bed, with a shadow across the page. The &lt;a href="https://www.filestack.com/features/intelligence/ocr/" rel="noopener noreferrer"&gt;OCR API&lt;/a&gt; reads it as it is, so there’s no crop or straighten step first. It returns every text area, line and word on the page, each with a four-point &lt;code&gt;bounding_box&lt;/code&gt; in the photo’s pixels, plus a flat &lt;code&gt;text&lt;/code&gt; field. The &lt;a href="https://blog.filestack.com/start-grow-scale-now-include-ocr/" rel="noopener noreferrer"&gt;OCR response reference&lt;/a&gt; has the full shape.&lt;/p&gt;

&lt;p&gt;We wrote the service in plain Node with no packages. It needs Node 20.6 or later for &lt;code&gt;--env-file&lt;/code&gt;, and a &lt;code&gt;.env&lt;/code&gt; file holding your API key and app secret, both from the Developer Portal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FILESTACK_API_KEY=YOUR_API_KEY
FILESTACK_APP_SECRET=YOUR_APP_SECRET
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;filestack.mjs&lt;/code&gt; is the only file that talks to Filestack. It signs each request and makes the two calls the service needs, one to read the photo and one to store a clean copy of the note:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createHmac } from 'node:crypto';
const CDN = 'https://cdn.filestackcontent.com';
function signedUrl(tasks, handle, calls) {
  const expiry = Math.floor(Date.now() / 1000) + 300;
  const policy = Buffer.from(JSON.stringify({ call: calls, handle, expiry }))
    .toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_');
  const signature = createHmac('sha256', process.env.FILESTACK_APP_SECRET)
    .update(policy)
    .digest('hex');
  return `${CDN}/security=p:${policy},s:${signature}/${tasks}/${handle}`;
}
async function getJson(url) {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  return res.json();
}
// Every line and word on the photo, with its position on the page
export const readText = (handle) =&amp;gt; getJson(signedUrl('ocr', handle, ['read', 'convert']));
// Crops, straightens and cleans up the note, then stores it as a new file
export async function storePage(handle) {
  const url = signedUrl('doc_detection/store', handle, ['read', 'convert', 'store']);
  return (await getJson(url)).handle;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The OCR response is &lt;code&gt;Cache-Control: private&lt;/code&gt;, and a repeat request runs the task again. So the service reads each photo once and keeps what it needs from the response.&lt;/p&gt;

&lt;p&gt;At this point the service can turn the photo into lines of text with positions. It can’t tell which of those lines is the order yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick out the order number by its label
&lt;/h2&gt;

&lt;p&gt;Matching &lt;code&gt;ORD-&lt;/code&gt; followed by digits finds every order-shaped number on the note, and the note at the top of this post has two: the order being delivered, and a back order that follows on the next delivery. The label next to each number is what tells them apart.&lt;/p&gt;

&lt;p&gt;Notes print that label in one of two places. Some put it on the same line, as in &lt;code&gt;Order No: ORD-2026-58213&lt;/code&gt;. Others put it in a box above the value. In that layout, the flat &lt;code&gt;text&lt;/code&gt; field lists the labels and values out of order. On the second carrier’s note below, it reads &lt;code&gt;CONSIGNMENT&lt;/code&gt;, &lt;code&gt;ROUTE&lt;/code&gt;, &lt;code&gt;HL-77-40912&lt;/code&gt;, &lt;code&gt;E3&lt;/code&gt;, so the flat text alone can pair a value with the wrong label.&lt;/p&gt;

&lt;p&gt;The bounding boxes settle it. A value belongs to a label that sits directly above it, in an overlapping column, less than two lines away. &lt;code&gt;find-order.mjs&lt;/code&gt; takes the OCR response and looks for that label. It accepts an order number only when the label is on the same line just before it, or directly above it:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Order numbers as this carrier prints them, such as ORD-2026-58213
const ORDER = /\bORD-\d{4}-\d{5}\b/;
const ORDER_LABEL = /^order\s*(no\.?|number|#)?\s*:?$/i;
const NAME_LABEL = /^(print\s+)?name\s*:?\s*/i;
const linesOf = (ocr) =&amp;gt; ocr.document.text_areas.flatMap((area) =&amp;gt; area.lines);
function box(line) {
  const xs = line.bounding_box.map((p) =&amp;gt; p.x);
  const ys = line.bounding_box.map((p) =&amp;gt; p.y);
  return { left: Math.min(...xs), right: Math.max(...xs), top: Math.min(...ys), bottom: Math.max(...ys) };
}
// The label sits directly above the value: overlapping columns, less than two lines apart
function labelAbove(label, value) {
  const a = box(label);
  const b = box(value);
  const lineHeight = b.bottom - b.top;
  return a.left &amp;lt; b.right &amp;amp;&amp;amp; b.left &amp;lt; a.right &amp;amp;&amp;amp; a.bottom &amp;lt;= b.top + lineHeight / 2 &amp;amp;&amp;amp; b.top - a.bottom &amp;lt; lineHeight * 2;
}
export function findOrderNumber(ocr) {
  const lines = linesOf(ocr);
  const labels = lines.filter((line) =&amp;gt; ORDER_LABEL.test(line.text.trim()));
  for (const line of lines) {
    const match = line.text.match(ORDER);
    if (!match) continue;
    const before = line.text.slice(0, match.index).trim();
    if (ORDER_LABEL.test(before)) return match[0];
    if (!before &amp;amp;&amp;amp; labels.some((label) =&amp;gt; labelAbove(label, line))) return match[0];
  }
  return null;
}
export function findReceivedBy(ocr) {
  const line = linesOf(ocr).find((l) =&amp;gt; NAME_LABEL.test(l.text));
  return line ? line.text.replace(NAME_LABEL, '').trim() || null : null;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;On the truck bed note, the back order line starts with “Back order”, which isn’t an order label, so it never matches. On the second carrier’s note, the &lt;code&gt;ORDER NUMBER&lt;/code&gt; box sits right above its value, so that one matches as well.&lt;/p&gt;

&lt;p&gt;To fit your own notes, change &lt;code&gt;ORDER&lt;/code&gt; to your order number format and &lt;code&gt;ORDER_LABEL&lt;/code&gt; to the label your notes print. If your notes come from several carriers, add each carrier’s label to the pattern.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/plans/pro-writer?source=promotion_paragraph---post_body_banner_jsw_scribble--f34f18f8fe00-----------------------------------------" rel="noopener noreferrer"&gt;Subscribe to Pro Writer Tools&lt;/a&gt; to remove upgrade prompts from your unlocked stories.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;findReceivedBy&lt;/code&gt; reads the printed name next to the signature, not the signature. The stored photo and page show the signature itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Answer the driver before they leave the stop
&lt;/h2&gt;

&lt;p&gt;The driver’s app uploads the photo the way it uploads anything else, then sends the photo’s handle to the service for that stop. The service reads the photo, checks the order number against the stop, and answers in the same request. Here’s &lt;code&gt;server.mjs&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createServer } from 'node:http';
import { readText, storePage } from './filestack.mjs';
import { findOrderNumber, findReceivedBy } from './find-order.mjs';
// Stand-in for your dispatch database: the order each stop on today's route expects
const stops = new Map([
  ['route-14-stop-7', { order: 'ORD-2026-58213', status: 'out_for_delivery' }],
]);
async function closeStop(stopId, handle, lastTry) {
  const stop = stops.get(stopId);
  if (!stop) return [404, { error: 'unknown stop' }];
  if (stop.status === 'delivered') return [200, { action: 'closed', order: stop.order, proof: stop.proof }];
  const ocr = await readText(handle);
  const order = findOrderNumber(ocr);
  let problem = null;
  if (!ocr.text) problem = 'No delivery note in the photo';
  else if (!order) problem = 'Order number not readable';
  else if (order !== stop.order) problem = `This note is for ${order}`;
  if (problem &amp;amp;&amp;amp; !lastTry) return [422, { action: 'retake', reason: problem }];
  const proof = await storePage(handle);
  Object.assign(stop, {
    status: problem ? 'needs_review' : 'delivered',
    reason: problem,
    proof,
    photo: handle,
    receivedBy: findReceivedBy(ocr),
    at: new Date().toISOString(),
  });
  console.log(stopId, stop);
  return [200, { action: problem ? 'review' : 'closed', order: stop.order, proof }];
}
createServer(async (req, res) =&amp;gt; {
  const match = req.url.match(/^\/stops\/([\w-]+)\/proof$/);
  if (req.method !== 'POST' || !match) {
    res.writeHead(404).end();
    return;
  }
  let raw = '';
  for await (const chunk of req) raw += chunk;
  let input = {};
  try {
    input = JSON.parse(raw) ?? {};
  } catch {}
  const { handle, lastTry = false } = input;
  if (typeof handle !== 'string') {
    res.writeHead(400, { 'Content-Type': 'application/json' }).end(JSON.stringify({ error: 'handle required' }));
    return;
  }
  try {
    const [status, body] = await closeStop(match[1], handle, lastTry);
    res.writeHead(status, { 'Content-Type': 'application/json' }).end(JSON.stringify(body));
  } catch (err) {
    console.error(match[1], handle, err.message);
    res.writeHead(502, { 'Content-Type': 'application/json' }).end(JSON.stringify({ action: 'retry', reason: 'Could not read the photo' }));
  }
}).listen(8788, () =&amp;gt; console.log('proof of delivery service on :8788'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;stops&lt;/code&gt; stands in for your dispatch database, with one stop on today’s route. The app acts on the &lt;code&gt;action&lt;/code&gt; in the response:&lt;/p&gt;

&lt;p&gt;A driver with a bad photo sees the reason on screen and the camera opens again while they’re still at the door. Sometimes a better photo isn’t possible, and &lt;code&gt;lastTry&lt;/code&gt; is how the app says so. Send it after two retakes, or when the driver taps a “Customer has gone” button. The stop is then marked &lt;code&gt;needs_review&lt;/code&gt; with the reason, the photo and the stored page. A person looks at those few stops instead of every stop.&lt;/p&gt;

&lt;p&gt;A second tap on “Delivered” for a closed stop returns the stored result without reading the photo again.&lt;/p&gt;

&lt;h1&gt;
  
  
  Keep a straightened copy of the note
&lt;/h1&gt;

&lt;p&gt;This is where Document Detection comes in. The original photo is the evidence, so the service keeps its handle. A support agent or a customer disputing a delivery has an easier time reading a straightened copy.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;doc_detection&lt;/code&gt; finds the page in the photo, crops it, straightens it and turns it into black text on white paper. On the photo at the top of this post, that takes the shadow off the page. The &lt;a href="https://blog.filestack.com/start-grow-scale-now-include-document-detection/" rel="noopener noreferrer"&gt;document detection parameters&lt;/a&gt; include &lt;code&gt;preprocess:false&lt;/code&gt;, which keeps the color instead.&lt;/p&gt;

&lt;p&gt;Chaining &lt;code&gt;store&lt;/code&gt; after the task saves that page as a file of its own. The policy then needs the &lt;code&gt;store&lt;/code&gt; call as well as &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;convert&lt;/code&gt;. Without it, the request returns &lt;code&gt;403 ... call is not allowed: (call: store)&lt;/code&gt;. Each request stores a new copy, which is why we run it only once, when the stop closes.&lt;/p&gt;

&lt;p&gt;The crop can trim the outer margin of a note, as it does on the left edge of the page above. So the service keeps both handles, the page for reading and the photo for the whole scene.&lt;/p&gt;

&lt;p&gt;Document Detection includes 1,000 images a month, then $0.20 an image, and OCR includes 5,000 units a month, then $0.03 a unit. One closed stop uses one of each, and a retake uses one OCR read.&lt;/p&gt;

&lt;h2&gt;
  
  
  When there’s no note in the photo
&lt;/h2&gt;

&lt;p&gt;A driver who photographs the parcel on the doorstep instead of the note sends a photo with no text in it. &lt;code&gt;ocr&lt;/code&gt; returns an empty &lt;code&gt;text&lt;/code&gt;, and the service asks for a retake with “No delivery note in the photo”.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;doc_detection&lt;/code&gt; isn’t the test for this. Given a photo with no paper in it, it still returns a crop of whatever rectangle it finds, here the parcel, and with &lt;code&gt;coords:true&lt;/code&gt; it still returns a plausible box. So we let the OCR text decide. For receipts and invoices, the &lt;a href="https://blog.filestack.com/document-detection-receipts-invoices/" rel="noopener noreferrer"&gt;detection on receipts and invoices&lt;/a&gt; post covers the same task.&lt;/p&gt;

&lt;p&gt;The other two failures play out like this. A thumb over the order number leaves every other line readable and no order number, so the driver sees “Order number not readable”. Yesterday’s note, photographed by mistake, reads cleanly and returns “This note is for ORD-2026–58197”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it locally
&lt;/h2&gt;

&lt;p&gt;You now have the three files the service needs. Start it:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --env-file=.env server.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;try-stop.mjs&lt;/code&gt; plays the driver’s app. It stores a photo with the REST upload endpoint, then posts the handle to the service for a stop:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createHmac } from 'node:crypto';
import { readFile } from 'node:fs/promises';
import { basename } from 'node:path';

// Plays the driver app: stores a photo, then asks the service to close the stop
const [stopId, path, lastTry] = process.argv.slice(2);
const expiry = Math.floor(Date.now() / 1000) + 300;
const policy = Buffer.from(JSON.stringify({ call: ['pick', 'store'], expiry }))
  .toString('base64')
  .replace(/\+/g, '-')
  .replace(/\//g, '_');
const signature = createHmac('sha256', process.env.FILESTACK_APP_SECRET).update(policy).digest('hex');
const params = new URLSearchParams({ key: process.env.FILESTACK_API_KEY, policy, signature, filename: basename(path) });
const stored = await fetch(`https://www.filestackapi.com/api/store/S3?${params}`, {
  method: 'POST',
  headers: { 'Content-Type': 'image/jpeg' },
  body: await readFile(path),
});
if (!stored.ok) throw new Error(`store: ${stored.status} ${await stored.text()}`);
const { url } = await stored.json();
const handle = url.split('/').pop();
const res = await fetch(`http://127.0.0.1:8788/stops/${stopId}/proof`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ handle, lastTry: lastTry === 'last' }),
});
console.log(res.status, await res.json());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Pass the stop and a photo, and add &lt;code&gt;last&lt;/code&gt; for the final try:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --env-file=.env try-stop.mjs route-14-stop-7 note.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For the photo of the right note, the script prints &lt;code&gt;200&lt;/code&gt; and &lt;code&gt;{ action: 'closed', order: 'ORD-2026-58213', proof: '...' }&lt;/code&gt;. The service logs the stop with its photo, stored page and &lt;code&gt;receivedBy&lt;/code&gt;. A photo of the parcel prints &lt;code&gt;422&lt;/code&gt; with &lt;code&gt;No delivery note in the photo&lt;/code&gt;. A stop that isn’t in &lt;code&gt;stops&lt;/code&gt; returns &lt;code&gt;404&lt;/code&gt;, and a request without a handle returns &lt;code&gt;400&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The photos in this post are 4032 x 3024, the size a 12 MP phone camera saves. OCR reads the same text from this note at 2,000 pixels wide. So shrinking photos in the app before upload can save the driver’s mobile data. Check that on your own notes before you turn it on.&lt;/p&gt;

&lt;h1&gt;
  
  
  When the app uploads after the driver drives on
&lt;/h1&gt;

&lt;p&gt;Some drivers work without signal, and the app queues photos until it reconnects. Nobody is at the door by then, so a check inside the request has nothing to offer. For those apps, build a workflow with one &lt;code&gt;ocr&lt;/code&gt; task instead, and start it on each stored photo with the &lt;code&gt;run_workflow&lt;/code&gt; task, signed with the &lt;code&gt;runWorkflow&lt;/code&gt; and &lt;code&gt;convert&lt;/code&gt; calls. The &lt;code&gt;fs.workflow&lt;/code&gt; event carries the same OCR response under the task’s name, so &lt;code&gt;findOrderNumber&lt;/code&gt; works unchanged, and the stops that fail go to review. The &lt;a href="https://www.filestack.com/products/workflows/" rel="noopener noreferrer"&gt;file processing workflows&lt;/a&gt; page covers building one.&lt;/p&gt;

&lt;p&gt;The workflow result arrives only as a &lt;a href="https://www.filestack.com/features/webhooks/" rel="noopener noreferrer"&gt;webhook notification&lt;/a&gt;, so the service needs a public URL for that route. For the capture step in the app itself, the &lt;a href="https://blog.filestack.com/mobile-data-extraction-sdk-phone-camera/" rel="noopener noreferrer"&gt;phone camera capture&lt;/a&gt; post covers taking the photo on the phone and uploading it.&lt;/p&gt;

&lt;p&gt;Next, replace &lt;code&gt;stops&lt;/code&gt; with a lookup on today’s route in your dispatch database, and add the label each carrier you work with prints to &lt;code&gt;ORDER_LABEL&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Frequently asked questions
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Does OCR need the proof of delivery photo cropped or straightened first?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. The OCR API reads a photographed delivery note as the driver took it, angle and shadow included, so there’s no crop or straighten step first. Point &lt;code&gt;ocr&lt;/code&gt; at the uploaded photo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you find the order number when a delivery note has more than one order-shaped number?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find it by its pattern and by the label beside or above it. A second number with the same pattern, such as a back order, has a different label. When the label sits in a box above the value, the bounding boxes show which label the value belongs to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens when the driver’s photo is unreadable or shows the wrong note?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The service checks the photo inside the driver’s request. An unreadable order number, a missing note or a note for a different order returns &lt;code&gt;422&lt;/code&gt; with a reason, and the camera opens again while the driver is still at the stop. After two retakes, or when the customer has gone, the app sends &lt;code&gt;lastTry&lt;/code&gt; and the stop is marked &lt;code&gt;needs_review&lt;/code&gt; for a person.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Document Detection tell whether a photo has a delivery note in it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Given a photo with no paper in it, &lt;code&gt;doc_detection&lt;/code&gt; still returns a crop of whatever rectangle it finds, and with &lt;code&gt;coords:true&lt;/code&gt; it still returns a plausible box. The OCR text decides whether a note is there. An empty &lt;code&gt;text&lt;/code&gt; means no note, and the driver is asked for a retake.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much do OCR and Document Detection cost per delivery?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;OCR includes 5,000 units a month, then $0.03 a unit, and Document Detection includes 1,000 images a month, then $0.20 an image. One closed stop uses one of each, and a retake uses one OCR read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/proof-of-delivery-photo-processing/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>orc</category>
    </item>
    <item>
      <title>Temporary Image Upload Service with Expiring Links and Cleanup Policies</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Tue, 10 Nov 2026 12:16:15 +0000</pubDate>
      <link>https://dev.to/ideradevtools/temporary-image-upload-service-with-expiring-links-and-cleanup-policies-cb4</link>
      <guid>https://dev.to/ideradevtools/temporary-image-upload-service-with-expiring-links-and-cleanup-policies-cb4</guid>
      <description>&lt;p&gt;A few months back, someone on a design team discovered that preview images from 2023 were still publicly accessible. Nobody had intended to keep them around. The upload flow was designed to feel temporary, but nothing actually removed the files.&lt;/p&gt;

&lt;p&gt;That’s the gap this post addresses. A temporary image upload service should do more than provide an expiring link. It should support lifecycle rules that automatically remove files after a defined period, making it useful for previews, one-time shares, and moderation queues where permanent storage creates unnecessary risk.&lt;/p&gt;

&lt;p&gt;The important part is that “temporary” means two separate things: the link stops working, and the underlying file gets deleted. Those are different mechanisms, and both need to be implemented deliberately.&lt;/p&gt;

&lt;p&gt;Let’s look at what each one requires.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Temporary uploads make two separate promises: access ends, and the file itself is deleted. You need both.&lt;/li&gt;
&lt;li&gt;Signed URLs with expiry timestamps are what make a link stop working at a set time. The same expiry works on files you share with clients, as in these &lt;a href="https://blog.filestack.com/expiring-watermarked-documents-with-filestack/" rel="noopener noreferrer"&gt;expiring, watermarked documents&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Cleanup policies are what actually remove the bytes from storage, not just the link.&lt;/li&gt;
&lt;li&gt;Files with no active link but no deletion rule become “orphaned” and quietly cost you money.&lt;/li&gt;
&lt;li&gt;Temporary hosting still needs scanning and abuse checks; expiry alone doesn’t stop bad actors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When Temporary Is the Feature
&lt;/h2&gt;

&lt;p&gt;Not every upload needs to live forever. In some workflows, the shorter a file remains available, the better the product works.&lt;/p&gt;

&lt;p&gt;Some use cases are built around files that should disappear once their purpose is served. A design preview only matters until the client approves it. A one-time share only needs to remain available for its intended recipient. A moderation queue needs an image long enough for a human or automated system to review it, and no longer.&lt;/p&gt;

&lt;p&gt;Even compliance-driven retention follows the same principle: keep files for exactly as long as the applicable policy requires, then remove them.&lt;/p&gt;

&lt;p&gt;The common thread is that permanence can be a liability. Every file that remains after its purpose is finished is another asset to secure, another storage cost to carry, and another piece of data to account for if something goes wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expiring Links, Access That Ends
&lt;/h2&gt;

&lt;p&gt;The first half of “temporary” is about who can open the file and for how long.&lt;/p&gt;

&lt;p&gt;This is handled with signed URLs. A signed URL includes an expiration time, so once that time passes, the link can no longer be used. Access can also be scoped to a particular recipient or request context, and links can be revoked early when necessary. The&lt;a href="https://www.filestack.com/docs/delivery/cdn/" rel="noopener noreferrer"&gt; deliver images docs&lt;/a&gt; cover the delivery and URL configuration options in more detail.&lt;/p&gt;

&lt;p&gt;The important part is that these checks happen when someone requests the file, before the file is delivered. An expired or unauthorised request is rejected before any bytes are sent.&lt;/p&gt;

&lt;p&gt;But here’s the catch: an expired link doesn’t mean the file is gone. It only means that particular door is locked. The image is still sitting in storage.&lt;/p&gt;

&lt;p&gt;That’s a different problem, and it needs a different fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleanup Policies, Bytes That End
&lt;/h2&gt;

&lt;p&gt;If expiring links lock the door, cleanup policies are what actually clear out the room.&lt;/p&gt;

&lt;p&gt;This is where scheduled deletion comes in: rules that automatically remove files from storage once their retention period expires. Good systems can also run orphan sweeps to catch files that no longer have an active reference, since abandoned files can quietly accumulate and increase storage costs.&lt;/p&gt;

&lt;p&gt;A verified-delete audit trail adds another layer of accountability by recording what was removed and when. Cleanup then becomes something you can demonstrate, not simply something you assume happened.&lt;/p&gt;

&lt;p&gt;This matters particularly for moderation queues. You want the original file to remain fully available while it’s under review, then become inaccessible and, where required, actually deleted once the review is complete.&lt;/p&gt;

&lt;p&gt;If you’re building this yourself, security questions such as how to prevent file upload vulnerabilities in a web application naturally connect to lifecycle management. A file that can’t be reliably removed is also harder to govern and secure throughout its lifecycle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Abuse Prevention on Ephemeral Infrastructure
&lt;/h2&gt;

&lt;p&gt;Here’s something worth saying clearly: temporary doesn’t mean safe by default.&lt;/p&gt;

&lt;p&gt;An upload flow without file scanning can still be abused even if every link expires quickly.&lt;a href="https://www.filestack.com/docs/security/policies/" rel="noopener noreferrer"&gt; Security policies&lt;/a&gt; can add controls around what is allowed into the upload workflow, alongside scanning and rate limiting.&lt;/p&gt;

&lt;p&gt;An attacker only needs a valid link during its active window. That’s why malware scanning, rate limiting, and high-entropy URLs still matter for short-lived uploads.&lt;/p&gt;

&lt;p&gt;This is why how to detect and block malicious files during upload remains an important security concern regardless of how long the files are retained. Short retention limits exposure over time, but it doesn’t replace controls at the point of upload.&lt;/p&gt;

&lt;p&gt;Expiry and cleanup control when a file disappears. Scanning and rate limiting control what enters the system in the first place. A secure temporary-upload workflow needs both.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route, Temporary on Real Infrastructure
&lt;/h2&gt;

&lt;p&gt;Once you’ve mapped out signed URLs, cleanup jobs, orphan sweeps, and scanning, you start to see how much of this is genuinely infrastructure work, not a small feature.&lt;/p&gt;

&lt;p&gt;The production version of this setup is a full&lt;a href="https://www.filestack.com/products/deliver-images/" rel="noopener noreferrer"&gt; image upload service&lt;/a&gt;, where expiry is handled through signed URLs and cleanup through a managed deletion workflow. If you’re weighing this against building it in-house, it’s worth looking into what tools provide a CDN for delivering user-uploaded files, whether there’s a free tier for file upload APIs to test with first, and generally what features to look for in a reliable file upload service before committing either way.&lt;/p&gt;

&lt;p&gt;None of this is meant to talk you out of building it yourself. Some teams have good reasons to. But it’s worth understanding what “temporary” actually requires before committing to maintaining the whole lifecycle long-term.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Build Both Halves of Temporary
&lt;/h2&gt;

&lt;p&gt;Ephemeral uploads sound simple on the surface, but they only work if you handle both sides of the promise. Expire access with signed URLs, remove the underlying files with cleanup policies, and keep an audit trail for both. Skip either half, and you can end up with files that look temporary but quietly remain in storage, just like those forgotten previews from 2023.&lt;/p&gt;

&lt;p&gt;If you’re not sure where you stand, there’s a simple test: find your oldest “temporary” upload and see whether the link still works. At Filestack, we built expiring links and deletion workflows to make temporary file handling part of the system rather than something you have to remember to clean up manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What is a temporary image upload service?
&lt;/h2&gt;

&lt;p&gt;It’s image storage that sits behind expiring links, paired with automatic lifecycle deletion so files don’t linger after they’re no longer needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is an expired link the same as a deleted file?
&lt;/h2&gt;

&lt;p&gt;No. An expired link just means access has ended; the file can still exist in storage. Deletion is what actually removes the bytes. A solid setup handles both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do temporary uploads still need scanning?
&lt;/h2&gt;

&lt;p&gt;Yes. Ephemeral hosting without scanning can still be misused; expiry alone doesn’t stop bad actors from using a link while it’s still active.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/temporary-image-upload-service-expiring-links/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>image</category>
      <category>upload</category>
    </item>
    <item>
      <title>Virus Detection in an Applicant Tracker Built on Filestack</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Thu, 29 Oct 2026 18:20:43 +0000</pubDate>
      <link>https://dev.to/ideradevtools/virus-detection-in-an-applicant-tracker-built-on-filestack-2693</link>
      <guid>https://dev.to/ideradevtools/virus-detection-in-an-applicant-tracker-built-on-filestack-2693</guid>
      <description>&lt;p&gt;A recruitment pipeline is a stream of documents from strangers, opened by non-technical staff, on machines with access to personal data. It is one of the softest targets in any company, and the attack is old and boring: attach something to a plausible application and wait for someone to double-click it.&lt;/p&gt;

&lt;p&gt;Building the defence yourself means a malware scanner you keep updated, a quarantine bucket, a queue that holds each upload until the scan finishes, and a document viewer so recruiters never download the file in the first place. That is a security product, and you were trying to build a hiring tool.&lt;/p&gt;

&lt;p&gt;This guide walks through Hollis, an applicant tracker, and the thing worth stealing from it: virus detection is not a URL task. It runs in a Workflow and answers by webhook, and that changes how you build the UI around it. It also walks through why the demo’s lock fails open, because that is the mistake this pattern most often ships with.&lt;/p&gt;

&lt;h1&gt;
  
  
  What we’re building
&lt;/h1&gt;

&lt;p&gt;A candidate uploads a CV. The attachment stays locked until it has been scanned. Once it clears, a recruiter reads it in an embedded preview that never puts the file on their disk, and can extract the text with OCR so the pipeline is searchable.&lt;/p&gt;

&lt;h1&gt;
  
  
  Stack
&lt;/h1&gt;

&lt;p&gt;Layer — Tech&lt;br&gt;&lt;br&gt;
Framework — Next.js 16 (App Router)&lt;br&gt;&lt;br&gt;
Upload, storage, CDN, processing — Filestack&lt;br&gt;&lt;br&gt;
Malware scanning — Filestack Workflows&lt;br&gt;&lt;br&gt;
Client state — Zustand&lt;br&gt;&lt;br&gt;
Styling — Tailwind v4&lt;br&gt;&lt;br&gt;
Language — TypeScript&lt;/p&gt;

&lt;p&gt;Applications live in a persisted Zustand store, which is &lt;code&gt;localStorage&lt;/code&gt; behind a hook, so the candidate view and the recruiter pipeline share state with no database. Logins are emulated. Scan verdicts live in an in-memory &lt;code&gt;Map&lt;/code&gt; on the server, which matters more than it sounds and comes up below.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1: Three settings
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NEXT_PUBLIC_FILESTACK_API_KEY=your_api_key_here
FILESTACK_APP_SECRET=your_app_secret_here
NEXT_PUBLIC_FILESTACK_WORKFLOW_ID=your_workflow_id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The public key is for uploads. The secret signs &lt;code&gt;ocr&lt;/code&gt; requests, which Filestack rejects unsigned, and must never carry a &lt;code&gt;NEXT_PUBLIC_&lt;/code&gt; prefix. The workflow ID names the workflow where the scan lives. The upload starts it from the browser, so it needs the public prefix (the demo’s &lt;code&gt;.env.example&lt;/code&gt; calls it &lt;code&gt;FILESTACK_WORKFLOW_ID&lt;/code&gt;).&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 2: The thing to understand first
&lt;/h1&gt;

&lt;p&gt;Most Filestack tasks are synchronous. You build a URL, you get a result. &lt;code&gt;virus_detection&lt;/code&gt; is not one of them. It is only available in Workflows. It runs after the file lands in storage, asynchronously, and the verdict arrives at a webhook you configure. That is the right shape for a scan. Scanning takes time, and the answer has to be authoritative before anyone opens the file. It cannot be a synchronous fetch from a browser. It does mean the integration looks different from everything else in this series:&lt;/p&gt;

&lt;p&gt;URL task Workflow task&lt;br&gt;&lt;br&gt;
Triggered by — Building a URL — A file landing in storage&lt;br&gt;&lt;br&gt;
Result arrives — In the response — At your webhook&lt;br&gt;&lt;br&gt;
Configured in — Your code — The Filestack dashboard&lt;br&gt;&lt;br&gt;
Examples — ocr, enhance, resize — virus_detection&lt;/p&gt;

&lt;p&gt;To set it up, create a workflow in the dashboard, add the virus detection task, and point its webhook at &lt;code&gt;/api/filestack/virus-webhook&lt;/code&gt;. Then tell the upload to run it. The picker takes the workflow ID in its storage options:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pickFiles({
  accept: ['application/pdf', 'image/*', '.doc', '.docx'],
  maxFiles: 1,
  storeTo: { workflows: [process.env.NEXT_PUBLIC_FILESTACK_WORKFLOW_ID!] },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That last step is missing from the demo. &lt;code&gt;FILESTACK_WORKFLOW_ID&lt;/code&gt; is listed in &lt;code&gt;.env.example&lt;/code&gt; but nothing reads it, and the picker is opened without &lt;code&gt;workflows&lt;/code&gt;, so no upload ever starts a scan. Combined with the timeout below, that means the demo always ends in the “no workflow configured” state. A workflow ID is not a secret, so a public variable is fine here.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 3: Receiving the verdict
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/app/api/filestack/virus-webhook/route.ts
const verdicts = new Map&amp;lt;string, Verdict&amp;gt;();
export async function POST(request: Request) {
  const body = (await request.json()) as {
    handle?: string;
    data?: Verdict;
    results?: Record&amp;lt;string, { data?: Verdict }&amp;gt;;
  };
  // Workflows nests task output under the task name you chose, so accept both
  // the flat shape and the per-task shape.
  const verdict = body.data ?? Object.values(body.results ?? {}).find((entry) =&amp;gt; entry.data)?.data;
  if (!body.handle || !verdict) {
    return NextResponse.json({ error: 'Expected a handle and a verdict' }, { status: 400 });
  }
  verdicts.set(body.handle, verdict);
  return NextResponse.json({ ok: true });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The verdict itself is small:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ "infected": false, "infections_list": [] }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Accepting both payload shapes is a good habit. Workflows nest each task’s output under the name you gave the task, so a parser that hard-codes one shape breaks the day someone renames the task. Log the first real payload you receive and confirm the shape against your own account before you rely on it. The same route answers &lt;code&gt;GET ?handle=…&lt;/code&gt; with &lt;code&gt;pending&lt;/code&gt; or &lt;code&gt;complete&lt;/code&gt;, which is what the browser polls.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 4: Locking the UI until it answers
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/components/features/CandidateReview.tsx
const locked = scan === 'pending' || scan === 'infected';
{locked ? (
  &amp;lt;div&amp;gt;…The preview stays locked until virus detection reports back…&amp;lt;/div&amp;gt;
) : (
  &amp;lt;iframe src={previewUrl(file.handle)} className="h-[460px] w-full border-0" title={file.filename} /&amp;gt;
)}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The browser polls for the verdict every 1.5 seconds:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const poll = async (): Promise&amp;lt;void&amp;gt; =&amp;gt; {
  attempts += 1;
  const body = await fetch(`/api/filestack/virus-webhook?handle=${encodeURIComponent(uploaded.handle)}`)
    .then((r) =&amp;gt; r.json());
if (body.status === 'complete') {
    setScan(body.infected ? 'infected' : 'clean');
    return;
  }
  if (attempts &amp;gt;= 5) {
    setScan('unconfigured');
    return;
  }
  setTimeout(() =&amp;gt; void poll(), 1500);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
  
  
  Step 5: Read it without downloading it
&lt;/h1&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export function previewUrl(handle: string): string {
  return `https://cdn.filestackcontent.com/preview/${handle}`;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;One iframe. No pdf.js, no viewer library, and the CV is never written to the recruiter’s disk. For a document from a stranger, rendering it on Filestack’s side and sending the recruiter a viewer is a much smaller attack surface than handing the raw bytes to a desktop application. Text extraction is a signed &lt;code&gt;ocr&lt;/code&gt; call, offered once the file has cleared:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const signed = await requestSignedUrl(file.handle, [signedTaskSegment({ task: 'ocr' })]);
const result = (await fetch(signed).then((r) =&amp;gt; r.json())) as IOcrResult;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That makes the pipeline searchable, including CVs that arrive as photographs or scans, which is the case a PDF text-extraction library silently gets wrong.&lt;/p&gt;

&lt;h1&gt;
  
  
  Fail open, fail closed
&lt;/h1&gt;

&lt;p&gt;This is the part of the codebase most worth arguing about, because the pattern is right and the defaults are not. &lt;strong&gt;The lock opens on a timeout.&lt;/strong&gt; Look at &lt;code&gt;locked&lt;/code&gt; again: it is &lt;code&gt;pending&lt;/code&gt; or &lt;code&gt;infected&lt;/code&gt;. After five polls, about 7.5 seconds, the state becomes &lt;code&gt;unconfigured&lt;/code&gt;, which is neither, so the preview unlocks. The UI is honest about it and says the preview is unlocked “so you can still explore the demo”. But a slow scan and a missing workflow look identical from the browser. A large file on a busy afternoon that takes eight seconds to scan unlocks before its verdict arrives. &lt;strong&gt;On serverless, the verdict never arrives.&lt;/strong&gt; The verdicts are in a module-level &lt;code&gt;Map&lt;/code&gt;. On Vercel or any other serverless platform, the webhook POST and the browser’s GET can be handled by different instances, each with its own empty &lt;code&gt;Map&lt;/code&gt;. The GET returns &lt;code&gt;pending&lt;/code&gt; five times, the lock times out, and the file opens. Deployed as it is, every attachment unlocks unscanned. &lt;strong&gt;Anyone can mark a file clean.&lt;/strong&gt; The webhook trusts whoever calls it. A single POST with &lt;code&gt;{ "handle": "…", "data": { "infected": false, "infections_list": [] } }&lt;/code&gt; clears any file. Filestack signs its webhook requests; verify that signature with your webhook secret before reading the body. &lt;strong&gt;The lock is in the UI, not on the file.&lt;/strong&gt; The handle is known to the browser from the moment the upload finishes, and both &lt;code&gt;preview/&amp;lt;handle&amp;gt;&lt;/code&gt; and &lt;code&gt;cdn.filestackcontent.com/&amp;lt;handle&amp;gt;&lt;/code&gt; are unsigned. Hiding an iframe does not stop anyone fetching the URL. A real gate means enabling Security for the application, so unsigned requests fail, and having the server issue a signed preview URL only after a clean verdict is on record. &lt;strong&gt;Infected files reach the recruiter’s queue.&lt;/strong&gt; Infected applications are recorded with &lt;code&gt;status: 'held'&lt;/code&gt;, and the recruiter pipeline shows held items with the same View and Download buttons as clean ones. The pipeline’s own intro text says “attachments that have not cleared are not shown here at all”. The one file the system knows is dangerous is one click from a recruiter’s disk. The principle that fixes all five is the same: unknown is not clean.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store verdicts in the database, as a column on the attachment, so any instance can read them.&lt;/li&gt;
&lt;li&gt;Treat “no verdict yet” as locked, for as long as it takes. Show the recruiter a “still scanning” state, and alert someone if a scan has not returned in a few minutes, instead of unlocking.&lt;/li&gt;
&lt;li&gt;Verify webhook signatures.&lt;/li&gt;
&lt;li&gt;Enable Security and hand out signed preview URLs only for files with a clean verdict.&lt;/li&gt;
&lt;li&gt;Never render View or Download for anything that is not clean.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is one smaller bug in the same component. The poll’s &lt;code&gt;setTimeout&lt;/code&gt; is never cancelled. Click “Review another application” during a scan, upload a second CV, and the first file’s verdict can arrive and set the scan state for the second.&lt;/p&gt;

&lt;h1&gt;
  
  
  Beyond recruitment
&lt;/h1&gt;

&lt;p&gt;Surface — Filestack feature&lt;br&gt;&lt;br&gt;
Support ticket attachments — virus_detection in a Workflow&lt;br&gt;&lt;br&gt;
Client document intake — virus_detection, preview&lt;br&gt;&lt;br&gt;
Vendor onboarding paperwork — virus_detection, ocr&lt;br&gt;&lt;br&gt;
Marketplace seller uploads — virus_detection&lt;br&gt;&lt;br&gt;
Pulling skills and dates out of a CV — ocr, with bounding boxes for review&lt;/p&gt;

&lt;h1&gt;
  
  
  Production checklist
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Trigger the workflow. Pass the workflow ID to the picker in &lt;code&gt;storeTo.workflows&lt;/code&gt;; at the moment nothing starts a scan.&lt;/li&gt;
&lt;li&gt;Fail closed. Remove the timeout unlock. A missing verdict is locked, and a long-missing verdict alerts someone.&lt;/li&gt;
&lt;li&gt;Persist verdicts in the database, not a module-level &lt;code&gt;Map&lt;/code&gt;, so they survive restarts and work across serverless instances.&lt;/li&gt;
&lt;li&gt;Verify the webhook signature before trusting any verdict.&lt;/li&gt;
&lt;li&gt;Enable Security for the application and issue signed preview and download URLs only after a clean verdict.&lt;/li&gt;
&lt;li&gt;Hide View and Download for held items in the recruiter pipeline, or leave them out of it, as its copy promises.&lt;/li&gt;
&lt;li&gt;Decide the policy for &lt;code&gt;infected: true&lt;/code&gt;: quarantine, delete, and who gets told.&lt;/li&gt;
&lt;li&gt;Cancel the poll when the user moves on to another file.&lt;/li&gt;
&lt;li&gt;Move applications out of &lt;code&gt;localStorage&lt;/code&gt; and replace the emulated login.&lt;/li&gt;
&lt;li&gt;Keep &lt;code&gt;FILESTACK_APP_SECRET&lt;/code&gt; server side; &lt;code&gt;ocr&lt;/code&gt; needs it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Further reading
&lt;/h1&gt;

&lt;p&gt;Topic Link&lt;br&gt;&lt;br&gt;
Virus detection and other Intelligence Intelligence&lt;br&gt;&lt;br&gt;
Running tasks on upload, webhooks Workflows&lt;br&gt;&lt;br&gt;
Document preview and delivery Deliver files&lt;br&gt;&lt;br&gt;
Policies, signatures and app security Security&lt;br&gt;&lt;br&gt;
File Picker configuration and sources Pickers&lt;/p&gt;

&lt;h1&gt;
  
  
  Key takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Some tasks are URLs, some are Workflows.&lt;/strong&gt; &lt;code&gt;ocr&lt;/code&gt;, &lt;code&gt;enhance&lt;/code&gt; and &lt;code&gt;resize&lt;/code&gt; answer in the response. &lt;code&gt;virus_detection&lt;/code&gt; only runs in a Workflow and reports its verdict to a webhook, which changes how the UI has to be built.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actually trigger the workflow.&lt;/strong&gt; Pass the workflow ID to the picker through &lt;code&gt;storeTo.workflows&lt;/code&gt;. A configured webhook does nothing if no upload ever starts a scan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unknown is not clean.&lt;/strong&gt; A missing verdict keeps the file locked for as long as it takes, with an alert if a scan stalls. A lock that opens on a timer is a delay, not a scan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store verdicts where every instance can read them.&lt;/strong&gt; An in memory &lt;code&gt;Map&lt;/code&gt; loses verdicts across serverless instances, so record the verdict in the database against the attachment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust only signed webhooks.&lt;/strong&gt; Verify Filestack’s signature before accepting a verdict, or anyone can mark any file clean with a single POST.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lock the file, not just the UI.&lt;/strong&gt; Hiding an iframe does not stop anyone fetching the CDN URL. Enable Security and issue signed preview URLs only after a clean verdict.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep held files out of reach.&lt;/strong&gt; Never render View or Download for anything that is not clean, and decide in advance what happens to infected uploads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preview instead of download.&lt;/strong&gt; Filestack’s &lt;code&gt;preview&lt;/code&gt; renders the document in an iframe, so a stranger’s file never lands on the recruiter’s disk, and a signed &lt;code&gt;ocr&lt;/code&gt; call makes even scanned CVs searchable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Final thoughts
&lt;/h1&gt;

&lt;p&gt;The useful lesson here is not really about recruitment. It is that Filestack has two shapes of capability, and the second one changes your architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anything that transforms bytes is a URL, and you get the answer in the response.&lt;/li&gt;
&lt;li&gt;Anything that has to be authoritative before a human acts is a Workflow, which means a webhook, a stored verdict and a UI that waits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The waiting is the hard part. A scan that unlocks on a timer is not a scan, it is a delay. Build the gate so that every path you have not thought about ends with the file locked, and the security model holds even on the day your webhook does not fire.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/virus-detection-in-an-applicant-tracker-built-on-filestack/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
    </item>
    <item>
      <title>A Receipt Reader That Draws Its OCR Back on the Photo</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Mon, 26 Oct 2026 09:07:26 +0000</pubDate>
      <link>https://dev.to/ideradevtools/a-receipt-reader-that-draws-its-ocr-back-on-the-photo-4f2</link>
      <guid>https://dev.to/ideradevtools/a-receipt-reader-that-draws-its-ocr-back-on-the-photo-4f2</guid>
      <description>&lt;p&gt;That works until the number is wrong, and on a creased thermal receipt photographed on a restaurant table it sometimes is. Now a finance reviewer has a figure they doubt and no way to check it short of opening the original and hunting for the total by eye. The extraction saved nobody any time.&lt;/p&gt;

&lt;p&gt;Building the version that fixes this yourself is a small computer vision project: find the receipt inside the photo, warp it flat, correct the exposure, run an OCR engine, keep the word positions, and host all of it somewhere that can take a phone upload. That is a model, a worker and a queue before you have approved a single expense.&lt;/p&gt;

&lt;p&gt;This guide walks through Marlow, an expense capture app, and the detail worth stealing from it: Filestack’s &lt;code&gt;ocr&lt;/code&gt; returns a bounding box for every word, so the app can draw the extracted figure back onto the photo it came from.&lt;/p&gt;

&lt;h1&gt;
  
  
  What we’re building
&lt;/h1&gt;

&lt;p&gt;An employee photographs a receipt at any angle, in any light. The receipt is found and flattened, the colour is corrected, the text is read, and every word is outlined on the image where it was found. The claim lands in a finance queue with the total already pulled out.&lt;/p&gt;

&lt;p&gt;Checking a total becomes a glance rather than a search.&lt;/p&gt;

&lt;h1&gt;
  
  
  Stack
&lt;/h1&gt;

&lt;p&gt;Layer: Tech&lt;br&gt;&lt;br&gt;
Framework: Next.js 16 (App Router)&lt;br&gt;&lt;br&gt;
Upload, storage, CDN, processing: Filestack&lt;br&gt;&lt;br&gt;
Client state: Zustand&lt;br&gt;&lt;br&gt;
Styling: Tailwind v4&lt;br&gt;&lt;br&gt;
Language: TypeScript&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1: Two keys, and why
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NEXT_PUBLIC_FILESTACK_API_KEY=your_api_key_here
FILESTACK_APP_SECRET=your_app_secret_here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The first is public by necessity, because uploads go from the phone straight to Filestack with no server hop. The second must never carry a &lt;code&gt;NEXT_PUBLIC_&lt;/code&gt; prefix.&lt;/p&gt;

&lt;p&gt;The second one exists because Filestack tasks come in two kinds. &lt;code&gt;resize&lt;/code&gt;, &lt;code&gt;enhance&lt;/code&gt; and friends answer a plain URL. &lt;code&gt;ocr&lt;/code&gt; and &lt;code&gt;doc_detection&lt;/code&gt; reject unsigned requests: they need a policy signed with your app secret, which means a server has to be involved. That split shapes the whole app, and it is also where the most interesting bug in this codebase lives.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 2: Upload from the phone
&lt;/h1&gt;

&lt;p&gt;The upload is the shared picker helper used across this series, opened with &lt;code&gt;accept: ['image/*']&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/services/filestack.service.ts
export async function pickFiles(options: Partial&amp;lt;PickerOptions&amp;gt; = {}): Promise&amp;lt;IStoredFile[]&amp;gt; {
  const client = await getFilestackClient();
return new Promise&amp;lt;IStoredFile[]&amp;gt;((resolve, reject) =&amp;gt; {
    client
      .picker({
        fromSources: ['local_file_system', 'url', 'googledrive', 'dropbox', 'onedrive'],
        ...options,
        onUploadDone: (response) =&amp;gt; resolve((response.filesUploaded ?? []).map(formatPickerMetadata)),
        onCancel: () =&amp;gt; resolve([]),
        onFileUploadFailed: (_file, error) =&amp;gt; reject(error),
      })
      .open()
      .catch(reject);
  });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Wrapping the picker in a promise turns a callback API into one &lt;code&gt;await&lt;/code&gt;, which is the shape every caller in the app actually wants. A cancel resolves with an empty list rather than rejecting, so closing the picker is not treated as an error.&lt;/p&gt;

&lt;p&gt;What comes back is trimmed to one shape, and the &lt;code&gt;handle&lt;/code&gt; is the part that matters:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export interface IStoredFile {
  url: string;
  handle: string;
  filename: string;
  mimetype: string;
  size: number;
  uploadedAt?: string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
  
  
  Step 3: Signing on the server
&lt;/h1&gt;

&lt;p&gt;One route holds the secret and hands back finished URLs:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/app/api/filestack/sign/route.ts
const ALLOWED = /^(ocr|envelope_ocr|doc_detection(=[a-z_]+:(true|false)(,[a-z_]+:(true|false))*)?)$/;
const TTL_SECONDS = 60 * 10;
const policy = JSON.stringify({
  expiry: Math.floor(Date.now() / 1000) + TTL_SECONDS,
  call: ['read', 'convert'],
  handle,
});
const encodedPolicy = Buffer.from(policy).toString('base64');
const signature = createHmac('sha256', secret).update(encodedPolicy).digest('hex');
const url = [CDN, `security=p:${encodedPolicy},s:${signature}`, ...tasks, handle].join('/');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Three decisions here are worth copying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The policy names one handle. A leaked URL cannot be replayed against any other file.&lt;/li&gt;
&lt;li&gt;The TTL is ten minutes. The URL is handed to a browser, so it should stop working soon after the browser is done with it.&lt;/li&gt;
&lt;li&gt;The route has a task allowlist. Without it, you have built a signing oracle: anyone can post any task chain and get it signed with your secret.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The browser side is a single fetch:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const signed = await requestSignedUrl(uploaded.handle, [
  signedTaskSegment({ task: 'doc_detection', coords: false, preprocess: true }),
  signedTaskSegment({ task: 'ocr' }),
]);
const result = (await fetch(signed).then((r) =&amp;gt; r.json())) as IOcrResult;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
  
  
  Step 4: Clean before you read
&lt;/h1&gt;

&lt;p&gt;The reading chain is two tasks in one URL:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;security=p:…,s:…/doc_detection=coords:false,preprocess:true/ocr/&amp;lt;handle&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Tasks apply left to right. &lt;code&gt;doc_detection&lt;/code&gt; finds the receipt inside the photo and warps it flat, removing the table, the shadow and the thumb holding it down. With &lt;code&gt;coords:false&lt;/code&gt; it returns the processed image rather than the corner coordinates, and &lt;code&gt;ocr&lt;/code&gt; reads that image instead of the original.&lt;/p&gt;

&lt;p&gt;Running &lt;code&gt;ocr&lt;/code&gt; on the raw photo would read a crooked, dim picture of a table with a receipt on it. The order is the accuracy.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 5: Drawing the boxes
&lt;/h1&gt;

&lt;p&gt;The OCR response nests: &lt;code&gt;document.text_areas[].lines[].words[]&lt;/code&gt;, each word carrying a bounding box, plus a flat &lt;code&gt;text&lt;/code&gt; field and a &lt;code&gt;text_area_percentage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The component normalises defensively rather than trusting one field layout:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/components/features/ReceiptReader.tsx
if (Array.isArray(raw) &amp;amp;&amp;amp; raw.length &amp;gt;= 2) {
  // A list of points: derive the extent.
  const pts = raw as { x: number; y: number }[];
  const xs = pts.map((p) =&amp;gt; p.x);
  const ys = pts.map((p) =&amp;gt; p.y);
  x = Math.min(...xs);
  y = Math.min(...ys);
  w = Math.max(...xs) - x;
  h = Math.max(...ys) - y;
} else if (typeof raw === 'object') {
  const b = raw as { x?: number; y?: number; width?: number; height?: number };
  x = b.x; y = b.y; w = b.width; h = b.height;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then it converts every box to fractions of the image, using the rendered image’s natural size, so the overlay survives any display width:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const norm = x &amp;lt;= 1 &amp;amp;&amp;amp; y &amp;lt;= 1 &amp;amp;&amp;amp; w &amp;lt;= 1 &amp;amp;&amp;amp; h &amp;lt;= 1;
boxes.push({
  text: word.text ?? '',
  x: norm ? x : x / imgW,
  y: norm ? y : y / imgH,
  w: norm ? w : w / imgW,
  h: norm ? h : h / imgH,
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The boxes belong to the processed image, not the original. They come from OCR that ran after &lt;code&gt;doc_detection&lt;/code&gt;, so they have to be drawn over that chain’s output. Overlay them on the raw upload and every box lands in the wrong place, because the receipt in the raw photo is somewhere else and at a different angle.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 6: A total you can point at
&lt;/h1&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function guessTotal(text: string): string | null {
  const matches = [...text.matchAll(/(?:total|amount due|balance)\D{0,12}([\d.,]+)/gi)];
  const last = matches.at(-1);
  if (last) return last[1];
  const money = [...text.matchAll(/\d+[.,]\d{2}/g)].map((m) =&amp;gt; m[0]);
  return money.length &amp;gt; 0 ? money.sort(/* largest first */)[0] : null;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Taking the last match is deliberate. Receipts print subtotal, tax and total in that order, and “Subtotal” also matches &lt;code&gt;total&lt;/code&gt;, so the one you want is the one at the bottom.&lt;/p&gt;

&lt;p&gt;This is a heuristic and should be treated as one. It fails on a receipt that prints “Total items: 3” under the total, and the fallback’s &lt;code&gt;parseFloat&lt;/code&gt; sort reads &lt;code&gt;1,234.56&lt;/code&gt; as &lt;code&gt;1.234&lt;/code&gt;. It is acceptable here for one reason: the box is drawn on the image, so a wrong guess is visibly wrong rather than silently wrong.&lt;/p&gt;

&lt;h1&gt;
  
  
  What the browser builds and what the server signs
&lt;/h1&gt;

&lt;p&gt;This is the part of the codebase most worth arguing about, because it gets the principle right and the implementation slightly wrong.&lt;/p&gt;

&lt;p&gt;The principle: anything that answers an unsigned request can be built in the browser and dropped into an &lt;code&gt;&amp;lt;img src&amp;gt;&lt;/code&gt;. Anything that needs a policy goes through the signing route. The image the boxes are drawn on, though, is built like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cleanedTasks = ['doc_detection=coords:false,preprocess:true', 'enhance=preset:fix_dark'];
const cleanedUrl = file ? cdnUrl(file.handle, cleanedTasks) : '';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That is an unsigned URL containing &lt;code&gt;doc_detection&lt;/code&gt;, which the app itself says rejects unsigned requests. Either the preview fails to load and the boxes have nothing to sit on, or your account accepts it unsigned and the signing route’s comment is wrong. One of them has to change, and it is the preview. Sign it.&lt;/p&gt;

&lt;p&gt;That exposes the second problem. The two chains are not the same:&lt;/p&gt;

&lt;p&gt;ChainTasksShown on screen:&lt;code&gt;doc_detection&lt;/code&gt; → &lt;code&gt;enhance&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Read by OCR:&lt;code&gt;doc_detection&lt;/code&gt; → &lt;code&gt;ocr&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The product copy says the receipt is “flattened, colour corrected and read, in that order, because each step makes the next more accurate”. The reading chain skips the colour correction, so the step that is meant to help OCR never reaches it. The boxes still line up, because &lt;code&gt;enhance&lt;/code&gt; does not move pixels, but the reader is working from a dimmer image than the one on screen.&lt;/p&gt;

&lt;p&gt;The fix is one chain, used twice:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const chain = ['doc_detection=coords:false,preprocess:true', 'enhance=preset:fix_dark'];
const imageUrl = await requestSignedUrl(handle, chain);
const ocrUrl = await requestSignedUrl(handle, [...chain, 'ocr']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That needs &lt;code&gt;enhance&lt;/code&gt; added to the route’s allowlist. Do that deliberately, as a fixed pattern like &lt;code&gt;enhance=preset:(fix_dark|fix_tint)&lt;/code&gt;, rather than loosening the regex.&lt;/p&gt;

&lt;h1&gt;
  
  
  One small layout bug worth knowing about
&lt;/h1&gt;

&lt;p&gt;The boxes are positioned with &lt;code&gt;left: calc(${box.x * 100}% + 0.5rem)&lt;/code&gt; inside a card with &lt;code&gt;p-2&lt;/code&gt; padding. Absolute percentages resolve against the card’s padding box, which is 1rem wider than the image. So boxes drift right by up to a rem towards the far edge of the receipt. On a narrow phone screen that is enough to put the box half on the wrong digit.&lt;/p&gt;

&lt;p&gt;Wrap the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; and the boxes in their own relative element with no padding, and use plain percentages. The coordinates are already fractions of the image, so they should be positioned against the image.&lt;/p&gt;

&lt;h1&gt;
  
  
  Beyond expenses
&lt;/h1&gt;

&lt;p&gt;Surface: Filestack feature&lt;br&gt;&lt;br&gt;
Invoice and purchase order capture: doc_detection, ocr&lt;br&gt;&lt;br&gt;
ID and proof-of-address onboarding: doc_detection, ocr&lt;br&gt;&lt;br&gt;
Delivery notes and proof of delivery: ocr, with boxes for the signature block&lt;br&gt;&lt;br&gt;
Mileage logs photographed from a diary: doc_detection, enhance, ocr&lt;br&gt;&lt;br&gt;
Screening uploads from personal devices: virus_detection in a Workflow&lt;br&gt;&lt;br&gt;
Running the chain once, on upload: Workflows&lt;/p&gt;

&lt;p&gt;The boxes are useful anywhere a human has to approve what a machine read. Most integrations throw them away.&lt;/p&gt;

&lt;h1&gt;
  
  
  Production checklist
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Sign the preview chain. It contains &lt;code&gt;doc_detection&lt;/code&gt;, so build it through the signing route like the OCR chain.&lt;/li&gt;
&lt;li&gt;Read the same image you show. Put &lt;code&gt;enhance&lt;/code&gt; in the OCR chain, and add it to the allowlist as a fixed pattern.&lt;/li&gt;
&lt;li&gt;Fix the overlay offset by positioning boxes against the image, not the padded card.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;guessTotal&lt;/code&gt; with a real parser that handles thousands separators and currency, and keep the boxes either way.&lt;/li&gt;
&lt;li&gt;Move the chain into a Workflow so one upload triggers everything server side, and store the OCR result against the claim instead of re-reading it.&lt;/li&gt;
&lt;li&gt;Downscale before &lt;code&gt;doc_detection&lt;/code&gt;. It has a maximum input size, and phone photos are large.&lt;/li&gt;
&lt;li&gt;Check your plan’s quotas for &lt;code&gt;ocr&lt;/code&gt; and &lt;code&gt;doc_detection&lt;/code&gt; before launch. They are metered separately from transformations.&lt;/li&gt;
&lt;li&gt;Move submissions out of &lt;code&gt;localStorage&lt;/code&gt; and put real auth in front of the finance queue.&lt;/li&gt;
&lt;li&gt;Configure Security Policies: origin lock, &lt;code&gt;image/*&lt;/code&gt;, a size cap.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Key takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Show where the number came from.&lt;/strong&gt; Filestack’s &lt;code&gt;ocr&lt;/code&gt; returns a bounding box for every word, so the extracted total can be drawn back onto the receipt. A wrong value becomes visibly wrong instead of silently wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two kinds of tasks, two kinds of URLs.&lt;/strong&gt; &lt;code&gt;resize&lt;/code&gt; and &lt;code&gt;enhance&lt;/code&gt; answer plain URLs. &lt;code&gt;ocr&lt;/code&gt; and &lt;code&gt;doc_detection&lt;/code&gt; need a signed policy, so the app secret lives on a server route and never in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sign narrowly.&lt;/strong&gt; Scope each policy to one handle, expire it in ten minutes, and allowlist the tasks the route will sign. Skip the allowlist and you have built a signing oracle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Order is accuracy.&lt;/strong&gt; Run &lt;code&gt;doc_detection&lt;/code&gt; before &lt;code&gt;ocr&lt;/code&gt; so the reader sees a flat, cropped receipt instead of a crooked photo of a table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draw boxes on the image OCR actually read.&lt;/strong&gt; The coordinates belong to the processed output, not the raw upload, and they should be positioned against the image itself rather than a padded card.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One chain, signed once, used twice.&lt;/strong&gt; Build the preview and the OCR request from the same chain (&lt;code&gt;doc_detection&lt;/code&gt;, &lt;code&gt;enhance&lt;/code&gt;, &lt;code&gt;ocr&lt;/code&gt;) so the image you show is the image you read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat heuristics as heuristics.&lt;/strong&gt; &lt;code&gt;guessTotal&lt;/code&gt; is acceptable only because its guess is visible. Replace it with a real parser that handles currency and thousands separators before going to production.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The pattern travels.&lt;/strong&gt; Invoices, ID onboarding, proof of delivery, mileage logs: anywhere a human approves what a machine read, show them where it read it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Final thoughts
&lt;/h1&gt;

&lt;p&gt;Extraction is not the hard part any more. Trust is.&lt;/p&gt;

&lt;p&gt;A number in a field is a claim.&lt;br&gt;&lt;br&gt;
A number with a box drawn around where it came from is evidence.&lt;/p&gt;

&lt;p&gt;Filestack gives you the second in the same response as the first. The only work left is keeping the image you show and the image you read the same, which in this app means one chain, signed once, used twice.&lt;/p&gt;

&lt;p&gt;The general shape holds well beyond receipts: whenever a machine reads something a human has to approve, show the human where it read it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/show-your-working-a-receipt-reader/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>ocr</category>
    </item>
    <item>
      <title>Slow Image Editing API Responses and Where the Latency Comes From</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Tue, 20 Oct 2026 13:52:00 +0000</pubDate>
      <link>https://dev.to/ideradevtools/slow-image-editing-api-responses-and-where-the-latency-comes-from-173n</link>
      <guid>https://dev.to/ideradevtools/slow-image-editing-api-responses-and-where-the-latency-comes-from-173n</guid>
      <description>&lt;p&gt;The dashboard says p50 is fine. Nobody’s complaining about the median. Then someone splits the data by cache status and finds p99 sitting at 4 seconds, hidden in the aggregate because cached and cold requests were averaged together as though they were the same kind of request.&lt;/p&gt;

&lt;p&gt;The real solution for slow image editing API responses is rarely a faster API. It’s identifying which of the four latency sources you’re actually paying for, because each one has a different fix. Applying the wrong fix can waste time without improving the metric that matters.&lt;/p&gt;

&lt;p&gt;Slow image editing API responses usually trace to four sources: cold transformations with no cache hit, oversized source images, chained operations executed on every request, and origin distance without a CDN. The solution stack is caching transformed outputs at the edge, right-sizing masters, and pre-warming common renditions. Filestack caches every transformation at the CDN, so repeat requests skip processing entirely.&lt;/p&gt;

&lt;p&gt;This article starts with measurement, because attribution has to come before any fix. It then walks through each of the four latency sources and the specific changes that actually address them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First-request transformation latency and cached-request latency differ by an order of magnitude. Conflating them in one metric misdiagnoses everything downstream.&lt;/li&gt;
&lt;li&gt;A 20-megapixel master resized on every request wastes decode time permanently that a right-sized master avoids for good.&lt;/li&gt;
&lt;li&gt;Chained operations cost once, when the whole chain caches as a single output object, not once per operation on every request.&lt;/li&gt;
&lt;li&gt;Origin distance adds fixed round-trip latency that no amount of processing optimisation can recover. Only moving to the edge removes it.&lt;/li&gt;
&lt;li&gt;Pre-warming predictable renditions, generating known catalog sizes ahead of time, moves the cold cost to deploy time instead of a user’s first request.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Measuring, Split Cold From Cached First
&lt;/h2&gt;

&lt;p&gt;Before touching any fix, split the data. A single average latency across cold and cached requests tells you very little because it combines two fundamentally different operations. A transformation that processes an image from scratch and one that serves an already-cached result are not the same request with slightly different timings. They’re different orders of magnitude.&lt;/p&gt;

&lt;p&gt;Instrument cache status directly. Most CDN and transformation layers expose a cache-status header on the response, such as hit or miss. Log that alongside latency because it’s one of the most useful signals for understanding where the time is going.&lt;/p&gt;

&lt;p&gt;Report p50 and p99 separately, and break them down by rendition too. A thumbnail and a full-resolution hero image can have very different cold-path costs even before caching is considered.&lt;/p&gt;

&lt;p&gt;Press enter or click to view image in full size&lt;/p&gt;

&lt;p&gt;Once cold and cached requests are separated, the waterfall above becomes the map for what follows: four distinct costs stack up on a cold request, while a cached request skips most of them. Each segment in the cold-request path has its own cause and its own fix, which the next three sections take in order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 1, Cache Misses, The Silent Majority
&lt;/h2&gt;

&lt;p&gt;The single biggest lever in many systems is &lt;strong&gt;cache stability&lt;/strong&gt;. If an apparently identical rendition generates a cache miss on every request, nothing else in the latency stack matters yet. You’re repeatedly paying the full cold-path cost for work that should have been done once.&lt;/p&gt;

&lt;p&gt;The usual culprit is an &lt;strong&gt;unstable URL&lt;/strong&gt;: query parameters appear in different orders, a per-user signature is added even though the underlying transformation is identical, or a timestamp or session token makes an otherwise cacheable URL unique. Each variation can create a separate cache key, turning one reusable rendition into repeated cache misses.&lt;/p&gt;

&lt;p&gt;The fix is &lt;strong&gt;canonical, deterministic transformation URLs&lt;/strong&gt;. Express the same transformation the same way every time and remove incidental variations that defeat caching. This connects directly to what tools provide a CDN for delivering user-uploaded files: a CDN can only reuse a cached object when requests map to the same cache key, and unnecessary URL variation prevents that reuse.&lt;/p&gt;

&lt;p&gt;Stabilising URLs can eliminate a large class of latency problems before you need to optimise the transformation itself. The remaining causes matter for requests that are genuinely cold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Causes 2 and 3, Source Size and Chain Order
&lt;/h2&gt;

&lt;p&gt;A cold request that remains slow after cache stability is fixed usually points to one of two causes inside the transformation itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source size is the first.&lt;/strong&gt; A 20-megapixel master that gets decoded and resized for every cold request can add unnecessary processing time. If your largest rendition is 2,000 pixels wide, starting from a 6,000-pixel-wide master means decoding far more pixel data than the output needs. Keeping a reasonably sized working copy alongside the original can reduce that cost at the source.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frgvo4b5jvoqlmha7trvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frgvo4b5jvoqlmha7trvf.png" alt=" " width="720" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chain order is the second.&lt;/strong&gt; For chained operations such as resize, crop, and watermark, it generally makes sense to perform expensive size-reducing operations early so later steps work on fewer pixels. For example, resizing before applying a watermark avoids performing the overlay across a full-resolution image when most of those pixels will be discarded afterwards.&lt;/p&gt;

&lt;p&gt;This is the same principle behind what are the best practices for optimising image loading times on websites: do expensive work on the smallest practical amount of data as early in the pipeline as possible.&lt;/p&gt;

&lt;p&gt;Optimising the transformation handles the costs within your pipeline’s control. The fourth cause sits outside the transformation itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 4, Origin Distance
&lt;/h2&gt;

&lt;p&gt;Origin distance is different from the first three causes in one important way: processing optimisation can’t fix it. A user thousands of miles from your origin still pays the network distance whenever a request has to reach that origin, regardless of how quickly the transformation itself runs.&lt;/p&gt;

&lt;p&gt;This is fundamentally a geography problem, so the fix is geographic too: serve content from edge locations closer to users instead of relying on a single distant origin. A CDN with a distributed edge network can serve a cached transformation from an edge near the requester, reducing the distance between the user and the content even when the origin is elsewhere.&lt;/p&gt;

&lt;p&gt;This is the practical core of what’s the best API for image and video transformation on upload as an infrastructure question, not just a feature question. An API that transforms images quickly but serves them from a single region can still have poor latency for users far from that region. Transformation speed and delivery geography are separate problems, and both need to be addressed.&lt;/p&gt;

&lt;p&gt;Four causes, four fixes. The remaining question is whether to build and maintain all four yourself or use a system that already handles them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route, Pay the Cold Cost Once
&lt;/h2&gt;

&lt;p&gt;The structural fix is an&lt;a href="https://www.filestack.com/products/image-transformations/" rel="noopener noreferrer"&gt; image editing API&lt;/a&gt; that caches transformed renditions at the edge, so the processing cost is paid once per unique rendition. Instead of solving cache stability, source sizing, transformation ordering, and edge delivery as separate engineering problems, a system that combines canonical transformation URLs with CDN caching can address much of the latency stack by design.&lt;/p&gt;

&lt;p&gt;With edge-cached transformations, the cold path runs once for each unique rendition. Subsequent requests can be served from the CDN, so the initial transformation cost isn’t repeatedly paid for the same output. The cold cost still exists because generating a new rendition requires real processing, but it happens once rather than on every request.&lt;/p&gt;

&lt;p&gt;For a question like which file upload service has the most reliable uptime and upload success rate, check a vendor’s current published performance and uptime data directly. Those claims can change over time and should be supported by verifiable numbers rather than general reputation.&lt;/p&gt;

&lt;p&gt;For a startup looking for the easiest way for a developer to transform images inside an app, the practical answer follows the architecture this article has built toward: use a system where caching and edge delivery are built into the workflow rather than making a small team design, implement, and tune each layer from scratch.&lt;/p&gt;

&lt;p&gt;For the pieces this builds on, the&lt;a href="https://www.filestack.com/docs/transformations/overview/" rel="noopener noreferrer"&gt; Transformation docs&lt;/a&gt; cover chain syntax and caching behaviour directly, and the&lt;a href="https://www.filestack.com/docs/delivery/cdn/" rel="noopener noreferrer"&gt; CDN delivery docs&lt;/a&gt; detail edge configuration.&lt;/p&gt;

&lt;p&gt;With the managed path on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion, Attribute, Then Fix
&lt;/h2&gt;

&lt;p&gt;Stabilise URLs first, because cache instability can quietly explain most latency complaints before the other causes even matter. Right-size your source images so you’re not paying decode costs for pixels no output will ever use. Order transformation chains so expensive operations run on the smallest practical data. And move delivery to the edge, because origin distance is the one latency source that processing optimisations can’t eliminate.&lt;/p&gt;

&lt;p&gt;Split your metrics by cache status today before changing anything else. In many cases, the fix that actually moves the latency number isn’t the one the team expected going in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why are some image API responses slow and others fast?
&lt;/h2&gt;

&lt;p&gt;Cold transformations do real processing work; cached ones serve straight from the edge. Split the metrics by cache status, or the two get averaged into one misleading number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do chained transformations multiply latency?
&lt;/h2&gt;

&lt;p&gt;Only on the cold request that generates the output for the first time. Once cached, the whole chain serves as one object regardless of how many operations it contains.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the biggest single fix?
&lt;/h2&gt;

&lt;p&gt;Usually cache stability: identical, canonical transformation URLs for identical renditions, so a repeat request actually hits the cache instead of quietly missing it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/slow-image-editing-api-responses-latency/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>image</category>
    </item>
    <item>
      <title>How Ecommerce Platforms Use APIs to Edit Images at Scale</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Thu, 15 Oct 2026 15:27:32 +0000</pubDate>
      <link>https://dev.to/ideradevtools/how-ecommerce-platforms-use-apis-to-edit-images-at-scale-50je</link>
      <guid>https://dev.to/ideradevtools/how-ecommerce-platforms-use-apis-to-edit-images-at-scale-50je</guid>
      <description>&lt;p&gt;The merchandising meeting lands a simple-sounding request: the brand refresh needs new crops and a watermark on 12,000 product images by Friday. The team editing by hand starts doing the math and quietly panics. The team with a URL template changes one line and moves on with their day.&lt;/p&gt;

&lt;p&gt;Ask how ecommerce platforms use APIs to edit images at scale, and the answer is a discipline, not a tool: keep one master image, generate renditions on request, and eliminate manual edits. At catalog scale, image editing stops being a design task and becomes configuration.&lt;/p&gt;

&lt;p&gt;Ecommerce platforms edit images at scale by moving transformation out of design tools and into APIs: one master image per product, with crops, resizes, formats, and watermarks generated on request through URL parameters and cached at the CDN. This yields consistent catalogs without manual editing. Filestack’s transformation API applies chained operations through a simple URL syntax.&lt;/p&gt;

&lt;p&gt;This article covers the math that makes hand-editing impractical at real catalog scale, how URL-based image transformation works, and what it takes to keep those generated renditions fast once they’re in use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A 10,000-SKU catalog across 6 surfaces and 3 formats implies 180,000 renditions. Nobody is hand-making that many images, and nobody should try.&lt;/li&gt;
&lt;li&gt;URL-based transformation encodes the edit in the request itself, so renditions need no pre-generation or storage of their own.&lt;/li&gt;
&lt;li&gt;Chained operations: resize, crop, format, watermark, execute in one pass and cache as a single CDN object, not four separate round trips.&lt;/li&gt;
&lt;li&gt;Format negotiation to WebP or AVIF at the edge cuts catalog page weight materially, with zero re-uploads required.&lt;/li&gt;
&lt;li&gt;A one-master-image policy means a reshoot updates every surface automatically, since every rendition derives from the same source.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Catalog Problem, One Master, Many Renditions
&lt;/h2&gt;

&lt;p&gt;Do the math on a real catalog before anything else. Ten thousand SKUs, six surfaces: thumbnail, product page hero, mobile card, search result, email banner, and zoom view, and three formats per surface for browser compatibility and file size. That’s 180,000 individual renditions, and it’s still a modest catalog by ecommerce standards.&lt;/p&gt;

&lt;p&gt;Hand-editing that many images isn’t a staffing problem you solve by adding more people. It’s a workflow that stops making sense when every file needs individual attention. The model that works at this scale is one master image per product, with each rendition generated on demand instead of being created and stored separately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiwjiqmqhgin0zijz7rmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiwjiqmqhgin0zijz7rmd.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This connects directly to what’s the best API for image and video transformation on upload: the right answer isn’t simply a tool that edits faster. It’s a system that eliminates the need for a human to make the same edit 180,000 times in the first place.&lt;/p&gt;

&lt;p&gt;Upload the master image once, then express each rendition as a reusable URL transformation. That replaces the manual editing workflow structurally rather than simply making it faster.&lt;/p&gt;

&lt;p&gt;Understanding the scale of the problem explains why URL-based transformation exists. The next question is how it actually works.&lt;/p&gt;

&lt;h2&gt;
  
  
  URL-Based Transformation: The Edit in the Request
&lt;/h2&gt;

&lt;p&gt;A URL-based transformation encodes the edit directly in the request URL: resize dimensions, crop coordinates, output format, watermark overlays, and more. The master image stays untouched. The transformation happens when the image is requested, and the resulting rendition can be cached at the CDN like any other static asset.&lt;/p&gt;

&lt;p&gt;Here’s a product hero image resized and converted to WebP:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;https://cdn.filestackapi.com/AbCdEf123/resize=width:1200,height:1200/format=webp/SOURCE_HANDLE&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Everything after the source handle represents the transformation: resize to 1200 × 1200, then convert to WebP. Change the dimensions, and you get a different rendition. Request the same URL again, and the cached result can be reused.&lt;/p&gt;

&lt;p&gt;Here’s the same master image cropped for a mobile card and given a seasonal campaign watermark:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;https://cdn.filestackapi.com/AbCdEf123/crop=dim:[100,100,800,800]/watermark=file:BADGE_HANDLE,position:bottom-right/resize=width:400/SOURCE_HANDLE&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That’s three operations in one request: crop to a square region, add the watermark in the bottom-right, then resize the result for mobile. The operations run as one transformation pipeline, producing one requested rendition rather than requiring separate processing and stored files for each step.&lt;/p&gt;

&lt;p&gt;This directly answers what’s the best way to add image transformation on the fly for resize, crop, and watermarking: express the operations in the URL in the order they should run, then let the transformation service handle processing and caching.&lt;/p&gt;

&lt;p&gt;The URL is also easy to read and compare in code review. A reviewer can see which transformation changed without having to inspect two image files manually.&lt;/p&gt;

&lt;p&gt;The real leverage comes from generating these URLs automatically from your catalog rules rather than hand-crafting them for every product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automations, Thumbnails, Badges, Watermarks
&lt;/h2&gt;

&lt;p&gt;Most rendition generation shouldn’t require a human to construct a URL at all. Event-driven automation is what makes this scale: when a new product image is uploaded, the thumbnail, hero crop, and mobile variant can be generated automatically as part of the upload workflow, with no separate manual step.&lt;/p&gt;

&lt;p&gt;This is the practical answer to how do I generate image thumbnails automatically after upload at catalog scale: connect thumbnail generation to the upload pipeline and use a fixed transformation template. Every new product image gets its standard renditions as soon as it arrives, without anyone having to remember to request them.&lt;/p&gt;

&lt;p&gt;Campaign overlays work the same way. Apply a seasonal sale badge, “new arrival” label, or temporary watermark through URL parameters rather than modifying the master image. One shared template can apply the overlay across an entire collection. When the campaign ends, change the template once, and the overlay disappears everywhere it was applied.&lt;/p&gt;

&lt;p&gt;Automated renditions handle the routine cases well. Keeping those renditions fast to load is a separate problem, and it’s worth treating it separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance, Cache and Formats
&lt;/h2&gt;

&lt;p&gt;A transformed image is only useful if it loads quickly, and this is where caching and format choice do most of the work. Each unique transformation URL can be cached at the CDN as its own object after the first request, so subsequent requests can be served from the cache instead of repeating the transformation.&lt;/p&gt;

&lt;p&gt;Format choice matters too. Serving WebP or AVIF instead of JPEG can reduce file size while maintaining similar visual quality, particularly for browsers that support those formats. You don’t need to re-upload the master image or maintain a separate asset pipeline. The transformation request can determine the output format while keeping the same source image and transformation parameters.&lt;/p&gt;

&lt;p&gt;The result is a useful separation: one master image, reusable transformation rules, and cached optimized renditions for the clients that request them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FormatTypical size vs JPEGBrowser support&lt;/strong&gt;JPEGBaselineUniversalWebP~25–35% smallerBroad modern supportAVIF~40–50% smallerGrowing, newer browsers&lt;/p&gt;

&lt;p&gt;This is the same principle behind what are the best practices for optimising image loading times on websites, applied to a product catalog: cache transformed images aggressively, since the same rendition usually doesn’t need to be generated repeatedly, and negotiate the output format automatically instead of sending the same JPEG to every browser.&lt;/p&gt;

&lt;p&gt;Getting caching and format selection right is what makes the rendition-tree approach fast in production, rather than just clever in theory. Building and maintaining that pipeline is still real infrastructure work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route, Catalog Policy as URLs
&lt;/h2&gt;

&lt;p&gt;The whole model runs on one&lt;a href="https://www.filestack.com/products/image-transformations/" rel="noopener noreferrer"&gt; image editing API&lt;/a&gt; whose chained URL operations can generate different renditions from a master image and deliver them through the CDN. Instead of building transformation logic, cache management, and format handling as separate systems, one API can handle the workflow from master image to delivered rendition.&lt;/p&gt;

&lt;p&gt;For a question like what company makes the most reliable file uploading and transformation API, evaluate current published performance and uptime data rather than relying on general reputation, since those figures can change over time.&lt;/p&gt;

&lt;p&gt;For engineers at printing companies looking for a powerful way to transform images inside their applications, the same model applies beyond ecommerce: one master asset, transformation rules expressed as reusable URLs, and renditions generated on demand rather than pre-building and storing every possible output.&lt;/p&gt;

&lt;p&gt;For the pieces this builds on, the&lt;a href="https://www.filestack.com/docs/transformations/ui/" rel="noopener noreferrer"&gt; Image Transformations docs&lt;/a&gt; cover the operation syntax, while the&lt;a href="https://www.filestack.com/docs/delivery/cdn/" rel="noopener noreferrer"&gt; Deliver Images docs&lt;/a&gt; cover CDN delivery for transformed assets.&lt;/p&gt;

&lt;p&gt;With the managed approach on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Edit Policy, Not Pixels
&lt;/h2&gt;

&lt;p&gt;One master image per product. Renditions generated from reusable URLs instead of being edited file by file. Each generated result cached at the edge, with the output format selected for the requesting browser. That’s the whole model, and it scales whether the catalog has a thousand SKUs or a million.&lt;/p&gt;

&lt;p&gt;Rebuild the images on one product page using transformation URLs this week. Once one page runs on transformation rules instead of manually edited files, the rest of the catalog becomes a template change rather than a new editing project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How do large catalogs keep product images consistent?
&lt;/h2&gt;

&lt;p&gt;Through one master image per SKU, with every rendition generated by URL-encoded transformations applied consistently through a shared template.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are transformed images slow to serve?
&lt;/h2&gt;

&lt;p&gt;No, once cached. Each transformation URL caches at the CDN as its own object, so only the first request pays the generation cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can watermarks be applied without re-editing files?
&lt;/h2&gt;

&lt;p&gt;Yes. A watermark overlay is a URL parameter applied at delivery time, not an edit made to the stored file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/ecommerce-apis-edit-images-at-scale/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
    </item>
    <item>
      <title>Enterprise File Delivery with Access Controls, Audit Trails, and SLAs</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Wed, 14 Oct 2026 18:00:31 +0000</pubDate>
      <link>https://dev.to/ideradevtools/enterprise-file-delivery-with-access-controls-audit-trails-and-slas-4ajc</link>
      <guid>https://dev.to/ideradevtools/enterprise-file-delivery-with-access-controls-audit-trails-and-slas-4ajc</guid>
      <description>&lt;p&gt;The deal is paused on one question in the security review: “Can you show us who downloaded this file?” Not “Can you deliver it quickly?” Not “Does the link work?” Just that one question, and the answer can determine whether the quarter closes on time.&lt;/p&gt;

&lt;p&gt;Enterprise file delivery is judged twice: once by users measuring seconds and once by auditors measuring answers. Speed matters, and CDNs and Range requests are what make large downloads fast and resilient. But what separates enterprise delivery is everything that sits on top of that speed: controlled access, auditability, and guarantees around availability.&lt;/p&gt;

&lt;p&gt;Enterprise file delivery adds governance to speed: signed URLs and access policies decide who can fetch a file, audit trails record every access, and SLAs plus multi-region CDN delivery guarantee availability. Filestack combines CDN delivery with policy and signature-based security, expiring URLs, and compliance controls suited to regulated teams.&lt;/p&gt;

&lt;p&gt;This article covers each of those three additions directly: what signed URLs and access policies actually control, what an audit trail needs to answer during a security review, and what an SLA can realistically promise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Signed, expiring URLs scope each download to a specific bearer and time window, replacing the shared static link that anyone with the URL can use forever.&lt;/li&gt;
&lt;li&gt;Access policies express permissions, read access, expiry, and IP constraints, verifiable at the edge before any bytes move.&lt;/li&gt;
&lt;li&gt;An audit trail that answers who fetched what and when is the difference between resolving an incident and having no answer at all.&lt;/li&gt;
&lt;li&gt;SOC 2 compliance and GDPR-aligned processing are the certification questions procurement asks first, before anything about features.&lt;/li&gt;
&lt;li&gt;Multi-region CDN delivery is what backs an availability promise an SLA can actually stand behind, rather than a number picked because it sounds reassuring.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Access Control, Signed URLs and Policies
&lt;/h2&gt;

&lt;p&gt;A shared static link is the default failure mode of casual file delivery: one URL, no expiry, and access for anyone who gets hold of it, including someone it was never intended for.&lt;/p&gt;

&lt;p&gt;Enterprise delivery replaces that with signed, expiring URLs, where each link is scoped to a specific access window and stops working when that window closes.&lt;/p&gt;

&lt;p&gt;Access policies go deeper than the URL itself. They define the permissions attached to a download, such as read-only access, an explicit expiry time, or, in some systems, an IP range restriction. The important architectural detail is that these rules should be enforced before the file is delivered, not discovered afterwards when an audit log shows that an unauthorised download already happened.&lt;/p&gt;

&lt;p&gt;This is also where procurement questions about what security certifications file upload API providers offer, such as SOC 2 or GDPR-related compliance, come in. Check a vendor’s current compliance documentation directly because certifications and their scope can change.&lt;/p&gt;

&lt;p&gt;Access control determines who can fetch a file. What happens after that decision, and what gets recorded each time, is where the next layer of governance begins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Audit Trails, The Unanswerable Question, Answered
&lt;/h2&gt;

&lt;p&gt;The paused-deal question from the introduction, “Can you show us who downloaded this file?”, has one acceptable answer: “Yes. Here’s the log.” Anything weaker, “we don’t track it,” “we could probably reconstruct it,” or “let us check”, can turn a routine security review into a stalled deal.&lt;/p&gt;

&lt;p&gt;A real audit trail should answer four questions for every access: who accessed the file, what file they accessed, when the access happened, and where the request came from. That’s the minimum bar. Anything less is closer to server logs that someone hopes will be complete enough when an auditor asks, rather than a system designed to answer the question on demand.&lt;/p&gt;

&lt;p&gt;Press enter or click to view image in full size&lt;/p&gt;

&lt;p&gt;Retention and export matter as much as capture. A log that exists but can’t be exported in the format a compliance workflow or external auditor requires is only half useful. Retention also needs to match the applicable regulatory requirements for the data being distributed, which can vary by industry and by the contents of the files. Confirm those requirements for your specific use case rather than assuming a vendor’s default retention period is sufficient.&lt;/p&gt;

&lt;p&gt;An audit trail turns “we think” into “here’s the record.” The next governance layer, SLAs, turns “it’s usually up” into a number someone has actually agreed to.&lt;/p&gt;

&lt;h2&gt;
  
  
  SLAs and Multi-Region Availability
&lt;/h2&gt;

&lt;p&gt;An SLA is only as valuable as what the underlying infrastructure can honestly support. A number chosen because it sounds reassuring, without the architecture to back it up, can create a false sense of security that an actual incident quickly exposes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-region CDN delivery&lt;/strong&gt; is what makes a high-availability promise credible. If files are served from only one region, a regional outage can take the entire delivery path down. Distributing delivery across multiple regions means a failure in one region doesn’t necessarily take the whole service with it. That’s the engineering reality an SLA should reflect.&lt;/p&gt;

&lt;p&gt;This connects directly to which file upload service has the most reliable uptime and upload success rate, viewed from the delivery side. Check a vendor’s current published uptime figures and status history rather than relying only on the SLA percentage in a contract. The contractual guarantee and actual service history answer different questions.&lt;/p&gt;

&lt;p&gt;Getting access controls, audit trails, and a genuinely supportable SLA right requires real infrastructure to build and maintain. It’s worth understanding that cost before deciding whether to build it yourself or use a managed service.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Build-vs-Buy Ledger at Enterprise Scale
&lt;/h2&gt;

&lt;p&gt;Building this in-house means owning signed URL generation and rotation, an access policy engine, audit log capture and export, and multi-region CDN infrastructure as ongoing responsibilities, not a one-time project. Each piece needs maintenance as compliance requirements evolve, new regions are added, and customers introduce new audit or procurement requirements.&lt;/p&gt;

&lt;p&gt;That’s the real substance behind what’s the ROI of using a managed file upload API vs. building in-house at enterprise scale. The comparison isn’t just the initial build cost. A capable team might build a first version of much of this in a quarter, but the ongoing cost is keeping four separate governance systems secure, current, and audit-ready indefinitely.&lt;/p&gt;

&lt;p&gt;The right comparison is the cost of maintaining that infrastructure internally versus the cost of using a managed system that already carries those responsibilities. The answer won’t be the same for every organisation, and it shouldn’t be assumed either way. Run the numbers against your actual engineering, compliance, infrastructure, and operational costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route, Governance Under One Roof
&lt;/h2&gt;

&lt;p&gt;The packaged version is governed&lt;a href="https://www.filestack.com/products/deliver-files/" rel="noopener noreferrer"&gt; file delivery&lt;/a&gt; with signed URLs, policy enforcement, and CDN delivery under one roof. Instead of building and maintaining access control, audit logging, and multi-region delivery as separate systems, the governance layers come together as part of the delivery workflow.&lt;/p&gt;

&lt;p&gt;This is close to what tools provide a CDN for delivering user-uploaded files taken to its enterprise conclusion: the CDN speed layer and the governance layers on top of it, rather than separate integrations that each need to be maintained. Filestack security policies and signatures can apply to both uploads and downloads, giving teams a more consistent permission model across the file lifecycle.&lt;/p&gt;

&lt;p&gt;For questions like what’s the best file upload API for enterprise-scale applications, or the leadership question of for an edtech company, what’s the most comprehensive solution for a CTO to deliver files anywhere, the architectural answer is similar across industries: combine delivery performance and governance rather than bolting a separately managed access-control layer onto a CDN.&lt;/p&gt;

&lt;p&gt;For the pieces this builds on, the&lt;a href="https://www.filestack.com/docs/security" rel="noopener noreferrer"&gt; Security and compliance docs&lt;/a&gt; cover certification and policy details, while the&lt;a href="https://www.filestack.com/docs/delivery" rel="noopener noreferrer"&gt; Deliver Files product docs&lt;/a&gt; cover the delivery configuration.&lt;/p&gt;

&lt;p&gt;With the managed approach on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Fast Is Table Stakes, Provable Wins Deals
&lt;/h2&gt;

&lt;p&gt;Sign every URL so no download link works forever for anyone who happens to have it. Log every access so the question that pauses a deal has an immediate, complete answer instead of a scramble. Promise only the availability your architecture can actually support, because an SLA nobody can verify during an incident isn’t much of a guarantee.&lt;/p&gt;

&lt;p&gt;Run the procurement checklist below against your current delivery path today, before an auditor runs it for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What distinguishes enterprise file delivery?
&lt;/h2&gt;

&lt;p&gt;Access controls, per-access audit trails, and SLA-backed availability, layered on top of the same CDN speed every delivery system needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are enterprise downloads secured?
&lt;/h2&gt;

&lt;p&gt;Through signed, expiring URLs scoped by an access policy and verified at the edge before any bytes move.&lt;/p&gt;

&lt;h2&gt;
  
  
  What certifications matter for delivery vendors?
&lt;/h2&gt;

&lt;p&gt;SOC 2 and GDPR alignment are the baseline procurement asks. Worth confirming a vendor’s current certification status directly rather than assuming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/enterprise-file-delivery-access-audit-slas/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>file</category>
      <category>delivery</category>
    </item>
    <item>
      <title>Large File Delivery with Caching, Range Requests, and Resumable Downloads</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Fri, 09 Oct 2026 16:14:43 +0000</pubDate>
      <link>https://dev.to/ideradevtools/large-file-delivery-with-caching-range-requests-and-resumable-downloads-31c0</link>
      <guid>https://dev.to/ideradevtools/large-file-delivery-with-caching-range-requests-and-resumable-downloads-31c0</guid>
      <description>&lt;p&gt;A 4GB dataset download reaches 91% on hotel Wi-Fi. The connection drops for two seconds. The server says, “start over.” The user says, “support ticket,” and probably with a lot less patience the second time.&lt;/p&gt;

&lt;p&gt;Large file delivery fails quietly. A download that stalls at 91% and starts from zero is the result of a design choice, or the lack of one. Uploads have had resumability for years, with chunked transfers and progress that survives dropped connections treated as standard features. Downloads deserve the same three techniques, but many teams never built them in.&lt;/p&gt;

&lt;p&gt;Large file delivery is the download side of the upload problem: serving multi-gigabyte files fast and resumably. The core techniques are CDN edge caching, HTTP Range requests for partial and resumable downloads, and cache-friendly immutable URLs. Filestack delivers stored files through an integrated CDN with range support, so large assets stream instead of stall.&lt;/p&gt;

&lt;p&gt;This article covers why large downloads fail by default, how Range requests provide resumability, how caching improves delivery speed, and what changes when the file is video.&lt;/p&gt;

&lt;h1&gt;
  
  
  Key Takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;HTTP Range requests, backed by &lt;code&gt;Accept-Ranges: bytes&lt;/code&gt; and &lt;code&gt;206 Partial Content&lt;/code&gt; responses, enable pause, resume, and parallel segment downloads.&lt;/li&gt;
&lt;li&gt;Edge caching moves multi-gigabyte transfers to servers physically near the user, cutting both latency and origin egress cost at once.&lt;/li&gt;
&lt;li&gt;Immutable, versioned URLs allow &lt;code&gt;Cache-Control: immutable&lt;/code&gt; with a long &lt;code&gt;max-age&lt;/code&gt;, the single highest-leverage caching setting for static files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ETag&lt;/code&gt; combined with &lt;code&gt;If-Range&lt;/code&gt; prevents the classic corrupted-resume bug: resuming a download partway through, against a file that changed underneath it.&lt;/li&gt;
&lt;li&gt;Chunk-parallel download of ranged segments can saturate a client’s available bandwidth in a way a single stream often can’t.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Why Big Downloads Fail
&lt;/h1&gt;

&lt;p&gt;Three separate problems compound into the stalled download from the intro, and none of them is exotic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Origin distance&lt;/strong&gt; is the first. A file served from a single origin server, no matter how fast that server is, still has to cross the physical and network distance between it and the user. Someone on another continent pays that distance for every byte.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single-stream fragility&lt;/strong&gt; is the second. A download running as one continuous HTTP request has no recovery path if the connection drops. At 91% of a 4GB file, one failed connection can send the whole transfer back to zero because the server was never asked to resume from where it stopped.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache misses&lt;/strong&gt; complete the problem. Without caching, every download hits the origin, even when thousands of users request the same file. That’s slower for users and can increase origin egress costs.&lt;/p&gt;

&lt;p&gt;This is closely related to what tools provide a CDN for delivering user-uploaded files. Solving all three problems usually means the same infrastructure: a CDN reduces the impact of origin distance, Range requests provide resumability, and caching prevents repeated downloads from hitting the origin unnecessarily.&lt;/p&gt;

&lt;p&gt;Each of these three problems has its own fix, and they’re worth taking one at a time, starting with the one that turns a stalled download into a resumable one.&lt;/p&gt;

&lt;h1&gt;
  
  
  Range Requests and Resume
&lt;/h1&gt;

&lt;p&gt;A server that supports Range requests advertises that support with the &lt;code&gt;Accept-Ranges: bytes&lt;/code&gt; header. A client can then request only part of a file using the &lt;code&gt;Range&lt;/code&gt; header, and a server that honors the request responds with &lt;code&gt;206 Partial Content&lt;/code&gt; and sends only the requested bytes.&lt;/p&gt;

&lt;p&gt;This turns “start over” into “pick up where you left off.” A client that knows how many bytes it already has can resume a failed download from that offset instead of throwing away its progress.&lt;/p&gt;

&lt;p&gt;There is one important problem with naive resume logic: the file might have changed between attempts. If the client combines the original bytes with bytes from a newer version, the resulting file can be corrupted without being immediately obvious.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ETag&lt;/code&gt; and &lt;code&gt;If-Range&lt;/code&gt; prevent that. The client saves the &lt;code&gt;ETag&lt;/code&gt; from the original response and sends it back in &lt;code&gt;If-Range&lt;/code&gt; when resuming. If the &lt;code&gt;ETag&lt;/code&gt; still matches, the server can safely return the requested range. If it has changed, the server sends the complete file instead, preventing two different versions from being stitched together.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;async function resumableDownload(url, existingBytes = 0, etag = null) {
const headers = {};
if (existingBytes &amp;gt; 0) {
headers["Range"] = `bytes=${existingBytes}-`;
if (etag) headers["If-Range"] = etag;
}
const response = await fetch(url, { headers });
if (response.status === 206) {
// Partial content: append to what we already have
const newEtag = response.headers.get("ETag");
const chunk = await response.arrayBuffer();
return { chunk, etag: newEtag, resumed: true };
}
if (response.status === 200) {
// Full file: either a fresh download, or the file changed since we last tried
const newEtag = response.headers.get("ETag");
const full = await response.arrayBuffer();
return { chunk: full, etag: newEtag, resumed: false };
}
throw new Error(`Unexpected status: ${response.status}`);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;A client built this way handles both cases without special-case logic: a genuine resume gets a &lt;code&gt;206 Partial Content&lt;/code&gt; response and appends the missing bytes, while a changed file gets a fresh &lt;code&gt;200 OK&lt;/code&gt; response and starts clean. The same resume flow handles both safely.&lt;/p&gt;

&lt;p&gt;Range requests solve the fragility problem. They don’t, by themselves, solve the distance or redundant-fetch problems from the previous section. That’s where caching comes in.&lt;/p&gt;

&lt;h1&gt;
  
  
  Caching Strategy, Immutable URLs and TTLs
&lt;/h1&gt;

&lt;p&gt;The highest-leverage caching decision for a large static file is also the simplest: if the file’s content never changes at a given URL, tell caches they can keep it with &lt;code&gt;Cache-Control: immutable&lt;/code&gt; and a long &lt;code&gt;max-age&lt;/code&gt;. A cache can then serve repeat requests without revalidating against the origin, including requests from many different users.&lt;/p&gt;

&lt;p&gt;The trick that makes this safe is putting a version identifier in the URL instead of relying on cache invalidation when content changes. For example, &lt;code&gt;/assets/report-v3.pdf&lt;/code&gt; can be cached for a long time because the next version uses a different URL, such as &lt;code&gt;/assets/report-v4.pdf&lt;/code&gt;, rather than replacing the existing resource.&lt;/p&gt;

&lt;p&gt;Purging still has a place, but it should be the exception rather than the normal update mechanism. Use it when content genuinely needs to disappear, such as after a takedown or security issue. For routine updates, versioning the URL is more predictable and doesn’t depend on every cache in the path processing a purge request quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HeaderPurposeTypical value for large static files&lt;/strong&gt;&lt;code&gt;Accept-Ranges&lt;/code&gt;Advertises Range request support&lt;code&gt;bytesContent-Range&lt;/code&gt;States which byte range a 206 response covers&lt;code&gt;bytes 91000000-4294967295/4294967296ETag&lt;/code&gt;Identifies a specific file version for validationA hash or version string unique to that file’s content&lt;code&gt;If-Range&lt;/code&gt;Makes a Range request conditional on ETag matchThe ETag value from a previous response&lt;code&gt;Cache-Control&lt;/code&gt;Sets caching behaviour for the response&lt;code&gt;public, max-age=31536000, immutable&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This same discipline is the broader answer to what are the best practices for optimising image loading times on websites, applied to large static assets generally: version the URL, cache aggressively with immutable resources, and let the CDN serve repeat requests without repeatedly fetching the same bytes from the origin.&lt;/p&gt;

&lt;p&gt;Caching and Range requests solve delivery for most large files. Video adds another wrinkle worth handling separately.&lt;/p&gt;

&lt;h1&gt;
  
  
  Video and Media Specifics
&lt;/h1&gt;

&lt;p&gt;Progressive playback, where a video starts playing before the entire file has downloaded, relies on the same Range request mechanism covered above. The player requests the byte ranges it needs as playback continues, and a server or CDN that supports ranges can deliver those portions without requiring the entire file upfront.&lt;/p&gt;

&lt;p&gt;This works well for a single quality level, but it has a limit. It doesn’t support &lt;strong&gt;adaptive bitrate switching&lt;/strong&gt;, where the player moves to a lower quality when the network slows down or a higher quality when conditions improve.&lt;/p&gt;

&lt;p&gt;That’s where HLS or DASH becomes the better approach. The video is transcoded into multiple quality levels and divided into short segments, allowing the player to switch between them as network conditions change.&lt;/p&gt;

&lt;p&gt;The practical rule is simple: Range-based progressive download is fine for a single-quality video or a large non-video asset. Once adaptive quality matters, move to segmented streaming instead of stretching Range requests beyond what they’re designed to do.&lt;/p&gt;

&lt;p&gt;Whichever approach you use, the underlying question remains the same: is delivery actually reliable in practice? That’s something worth measuring rather than assuming.&lt;/p&gt;

&lt;h1&gt;
  
  
  Measuring Delivery Reliability
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Completion rate&lt;/strong&gt; is the most direct signal: what percentage of started downloads actually finish. If completion drops on mobile networks or in certain regions, it’s often a sign of the distance or connection-fragility problems covered earlier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resume rate&lt;/strong&gt; shows how often stalled downloads successfully recover instead of being abandoned. A high stall rate combined with a low resume rate suggests the Range and resume flow isn’t working as intended. A reliable resume path should turn most stalls into recoveries rather than failed downloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;p95 time-to-first-byte&lt;/strong&gt; is especially useful for large file delivery because the average can hide the users having the worst experience. Tracking the 95th percentile shows how the slower end of the distribution is performing instead of letting fast requests mask the bad ones.&lt;/p&gt;

&lt;p&gt;These metrics are also useful when evaluating which file upload service has the most reliable uptime and upload success rate, with the same caveat on the download side: check a provider’s current, verifiable numbers rather than relying on general reputation.&lt;/p&gt;

&lt;p&gt;Measuring reliability tells you whether the techniques above are actually working in production. Building and maintaining all three correctly is still a significant infrastructure commitment.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Managed Route, Delivery Attached to Storage
&lt;/h1&gt;

&lt;p&gt;The integrated version is&lt;a href="https://www.filestack.com/products/deliver-files/" rel="noopener noreferrer"&gt; file delivery&lt;/a&gt; through a CDN that supports Range requests, connected to the same pipeline the files entered through. Files uploaded through the pipeline can be delivered through the CDN without requiring a separate delivery system.&lt;/p&gt;

&lt;p&gt;That’s the delivery half of a symmetry many teams overlook: upload reliability gets careful engineering attention, while downloads are often served using whatever the framework provides by default. For a product team asking what’s the most responsive way to deliver files anywhere, such as high-resolution property photos and floor plans that need to load quickly for buyers around the world, the answer is architectural before it’s vendor-specific: combine edge caching with Range support and connect that delivery layer to your file storage from the start.&lt;/p&gt;

&lt;p&gt;For the pieces this builds on, the&lt;a href="https://www.filestack.com/docs/delivery/cdn/" rel="noopener noreferrer"&gt; Deliver Files product docs&lt;/a&gt; cover the CDN configuration directly, the&lt;a href="https://blog.filestack.com/file-delivery-101/" rel="noopener noreferrer"&gt; File Delivery 101 guide&lt;/a&gt; covers CDN delivery at scale, and the&lt;a href="https://blog.filestack.com/mobile-file-upload-large-files-slow-connections/" rel="noopener noreferrer"&gt; large-file mobile upload guide&lt;/a&gt; covers the other half of this same symmetry, getting large files in reliably in the first place.&lt;/p&gt;

&lt;p&gt;With the managed approach on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion: Never Make Anyone Start Over
&lt;/h1&gt;

&lt;p&gt;Cache at the edge so repeat requests don’t unnecessarily reach the origin. Support Range requests so a dropped connection can resume instead of starting over. Version your URLs so you can cache aggressively without serving stale content. Use ETags to make sure a resumed download never combines bytes from two different versions of the same file.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;curl -r 0-1023&lt;/code&gt; against your own delivery URL today and check the response. If you get a &lt;code&gt;200 OK&lt;/code&gt; with the entire file instead of a &lt;code&gt;206 Partial Content&lt;/code&gt; response containing the requested range, you’ve found exactly the kind of delivery gap this article describes.&lt;/p&gt;

&lt;h1&gt;
  
  
  Frequently Asked Questions
&lt;/h1&gt;

&lt;h1&gt;
  
  
  What makes a download resumable?
&lt;/h1&gt;

&lt;p&gt;Server support for Range requests, returning &lt;code&gt;206 Partial Content&lt;/code&gt; for a byte range, validated against file changes using &lt;code&gt;ETag&lt;/code&gt; and &lt;code&gt;If-Range&lt;/code&gt; so a resume never corrupts against an updated file.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the best cache setting for large static files?
&lt;/h1&gt;

&lt;p&gt;A versioned URL with &lt;code&gt;Cache-Control: immutable&lt;/code&gt; and a long &lt;code&gt;max-age&lt;/code&gt;. Putting the version in the URL means the cache never needs to revalidate or guess whether content changed.&lt;/p&gt;

&lt;h1&gt;
  
  
  Does Filestack support ranged delivery?
&lt;/h1&gt;

&lt;p&gt;Yes. Files stored through Filestack serve through a CDN with range support built in, so large assets stream and resume rather than stalling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Originally published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/large-file-delivery-caching-range-requests/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>file</category>
      <category>delivery</category>
    </item>
    <item>
      <title>Cross-Platform PDF Data Extraction SDK for Multiple Clients</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Thu, 08 Oct 2026 23:17:19 +0000</pubDate>
      <link>https://dev.to/ideradevtools/cross-platform-pdf-data-extraction-sdk-for-multiple-clients-531e</link>
      <guid>https://dev.to/ideradevtools/cross-platform-pdf-data-extraction-sdk-for-multiple-clients-531e</guid>
      <description>&lt;p&gt;The same invoice PDF produces a different total on Android than it does on the web. Support can’t reproduce the issue because both teams are using different OCR engines, and both implementations can be working correctly. The engines have simply changed at different rates over time.&lt;/p&gt;

&lt;p&gt;The goal of a cross-platform PDF data extraction SDK isn’t just to reuse code. It’s to make sure the same invoice produces the same result no matter which client uploads it.&lt;/p&gt;

&lt;p&gt;That consistency doesn’t happen automatically. It’s an architecture decision you need to make from the start, not something to patch after the results start drifting.&lt;/p&gt;

&lt;p&gt;A cross-platform PDF data extraction SDK exposes one extraction pipeline to many clients: web, iOS, Android, and server. The architecture that scales keeps OCR and parsing server-side behind a single API while thin per-platform SDKs handle capture and upload. Filestack Capture follows this model, with JavaScript and mobile SDKs feeding one processing pipeline and one result schema.&lt;/p&gt;

&lt;p&gt;This article makes the case for that architecture directly. It explains what belongs on the client versus the server and how to keep extraction results consistent as the pipeline evolves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Duplicating OCR per platform multiplies model drift: three engines end up with three accuracy profiles and three separate bug queues.&lt;/li&gt;
&lt;li&gt;Thin-client architecture puts capture and upload in the SDK, and OCR, layout detection, and schema mapping behind one versioned API.&lt;/li&gt;
&lt;li&gt;A single result schema with per-field confidence keeps downstream validation code platform-agnostic, since it never needs to know which client produced a given field.&lt;/li&gt;
&lt;li&gt;Server-side extraction lets heavy recognition models run on real hardware, not whatever CPU happens to be in a five-year-old phone.&lt;/li&gt;
&lt;li&gt;Idempotent document IDs allow re-extraction after a pipeline upgrade without any change on the client side.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  One Pipeline, Many Clients: The Argument
&lt;/h2&gt;

&lt;p&gt;The alternative to one shared pipeline is a separate recognition engine for every platform: one OCR library inside the iOS app, another inside Android, and perhaps a third running server-side for web uploads. Each gets updated on its own schedule, tuned by a different team, and tested against a different set of documents.&lt;/p&gt;

&lt;p&gt;That’s the divergence problem from the introduction, built into the architecture rather than happening by accident. Over time, three engines develop three different accuracy profiles. A fix or improvement made to one doesn’t reach the others unless someone remembers to implement it separately.&lt;/p&gt;

&lt;p&gt;Centralising extraction behind one API removes that failure mode. There’s one accuracy profile to monitor, one place to improve when a document type causes problems, and one bug queue instead of three.&lt;/p&gt;

&lt;p&gt;The cost argument follows the same logic. Maintaining and tuning one recognition pipeline is generally simpler than maintaining three, especially when you include the engineering time spent tracking down bugs that reproduce on only one platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcfy53b0lnzzhs1zkr3ij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcfy53b0lnzzhs1zkr3ij.png" alt=" " width="720" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the architecture worth defending, not just adopting by default. The honest counterargument is on-device recognition, which has real advantages: it works offline and avoids a network round trip.&lt;/p&gt;

&lt;p&gt;But for anything beyond lightweight pre-checks, those benefits don’t outweigh what a centralised pipeline gives you in consistency, maintainability, and a single place to improve the extraction system.&lt;/p&gt;

&lt;p&gt;The next section draws that line more precisely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thin Client, Fat Server in Practice
&lt;/h2&gt;

&lt;p&gt;The dividing line is simple: the SDK captures, uploads, and retries. The API extracts, detects layout, and returns a schema. OCR, layout detection, and field parsing shouldn’t live inside individual platform SDKs, even if adding a small local recognition feature seems convenient at first.&lt;/p&gt;

&lt;p&gt;Capture is platform-specific by necessity. A camera API on iOS is very different from a file input on the web. Upload and retry logic can be more consistent, but each platform still needs an SDK that fits its networking patterns.&lt;/p&gt;

&lt;p&gt;Once the file reaches the server, extraction should be completely platform-agnostic. It shouldn’t matter whether the upload came from a browser, phone, or another backend service.&lt;/p&gt;

&lt;p&gt;On the server, this is also the practical shape of how to integrate a file upload API with Node.js: a Node service accepts the upload, starts extraction, and returns a document ID that the client can poll or use with a webhook. The server-side flow stays the same regardless of where the file originated.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Node.js: minimal server-side extraction endpoint
const express = require("express");
const app = express();
app.post("/documents", async (req, res) =&amp;gt; {
  const { fileUrl } = req.body;
  const document = await extractionPipeline.submit({
    source: fileUrl,
    // No platform field needed. The pipeline treats every source identically.
  });
  res.json({ documentId: document.id, status: "processing" });
});
app.get("/documents/:id", async (req, res) =&amp;gt; {
  const result = await extractionPipeline.getResult(req.params.id);
  res.json(result); // same schema regardless of which client uploaded
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Keeping this boundary clean is an architecture decision, not just a code organisation preference. Once a “quick optimisation” adds recognition logic to one client, that client has quietly become its own extraction pipeline, and the consistency guarantee starts to disappear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping Results Consistent
&lt;/h2&gt;

&lt;p&gt;A single pipeline solves the divergence problem when it ships. Keeping it consistent as the pipeline evolves takes more discipline.&lt;/p&gt;

&lt;p&gt;Version the pipeline explicitly. When you change the OCR model or a layout detection rule, treat it as a new pipeline version rather than silently changing the existing one. That lets you pin clients or documents to a known version and trace regressions back to a specific change.&lt;/p&gt;

&lt;p&gt;Maintain a golden-document test set. Keep a fixed collection of representative invoices, forms, contracts, and scanned documents. Run them through every new pipeline version before release and compare the output field by field. This is the organisational answer to what’s the best way to add OCR or text extraction to uploaded PDFs: extraction quality needs to be tested with every change, not checked once and forgotten.&lt;/p&gt;

&lt;p&gt;Calibrate confidence scores across sources. A 0.95 confidence score should mean roughly the same level of reliability whether the document came from a phone camera or a desktop scanner. If one source produces more errors at the same confidence level, recalibrate the scores using real outcomes so downstream systems can continue to rely on them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6evkcc081dhv70dr73qa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6evkcc081dhv70dr73qa.png" alt=" " width="720" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With consistency handled on the server, the client SDK can stay simpler rather than becoming more complex. That makes its responsibilities easier to define and is the next part of the architecture to design deliberately.&lt;/p&gt;

&lt;h2&gt;
  
  
  SDK Surface Design
&lt;/h2&gt;

&lt;p&gt;A thin client SDK should expose a genuinely small surface: capture, upload, and a document ID that the client can poll or subscribe to. The extraction internals shouldn’t leak into the client API. If a developer needs to know which OCR model ran or how layout detection made a decision, the SDK surface has become too broad.&lt;/p&gt;

&lt;p&gt;This minimal design also makes platform support easier. The question of what SDKs are available for adding file uploads to iOS and Android apps matters because a thin SDK is relatively small and maintainable across platforms. An SDK that includes its own recognition pipeline is much harder to keep consistent across iOS, Android, web, and server, which brings back the divergence problem this architecture is meant to prevent.&lt;/p&gt;

&lt;p&gt;Idempotent document IDs complete the API boundary. If a document is submitted twice, whether because of a client retry or a deliberate re-extraction after a pipeline upgrade, the system should recognise it and avoid creating duplicate records. This also lets you reprocess existing documents with a new pipeline version without changing the client, because the client only deals with the document ID, not the extraction logic behind it.&lt;/p&gt;

&lt;p&gt;Keeping the SDK this narrow is a deliberate constraint. It’s also what makes the cross-platform architecture maintainable in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route, Consistency as a Service
&lt;/h2&gt;

&lt;p&gt;This architecture is available as a managed&lt;a href="https://www.filestack.com/products/filestack-capture/" rel="noopener noreferrer"&gt; data extraction SDK&lt;/a&gt; with platform-specific capture SDKs feeding into a centralised extraction pipeline and consistent output. Instead of building the thin client SDKs, pipeline versioning, and golden-document testing infrastructure yourself, you can use an integration that follows this architecture.&lt;/p&gt;

&lt;p&gt;This also addresses what API can convert and optimise documents after upload while keeping processing centralised. Format conversion and optimisation can happen alongside extraction, so documents from different clients follow the same processing path.&lt;/p&gt;

&lt;p&gt;For developers at startups looking for an easier way to build complex file-processing pipelines, the practical lesson is simple: avoid creating separate recognition engines for each platform unless you have a strong reason to do so. Keeping recognition centralised prevents the platform-specific drift that can lead to inconsistent results later.&lt;/p&gt;

&lt;p&gt;Filestack Capture provides web and mobile capture capabilities through a centralised processing workflow, so improvements to the processing pipeline can be applied consistently rather than implemented separately for each platform.&lt;/p&gt;

&lt;p&gt;For the underlying pieces, the&lt;a href="https://www.filestack.com/docs/api" rel="noopener noreferrer"&gt; Capture API docs&lt;/a&gt; cover the extraction APIs, the&lt;a href="https://blog.filestack.com/pdf-data-extraction-sdk-structured-fields" rel="noopener noreferrer"&gt; PDF extraction companion post&lt;/a&gt; covers the pipeline stages, and the&lt;a href="https://blog.filestack.com/implementing-efficient-mobile-ocr-filestack-developers-guide" rel="noopener noreferrer"&gt; mobile extraction post&lt;/a&gt; covers the mobile capture side.&lt;/p&gt;

&lt;p&gt;With the managed approach on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Centralise the Brain, Distribute the Eyes
&lt;/h2&gt;

&lt;p&gt;One pipeline, one schema, thin SDKs on every platform, and versioned upgrades that don’t require a client release. That’s the architecture: a decision made early, rather than a fix after three platforms have already drifted apart.&lt;/p&gt;

&lt;p&gt;Send the same test PDF from two different platforms through your pipeline today and compare the resulting JSON. If anything differs beyond fields such as the document ID or timestamp, you’ve found the kind of cross-platform inconsistency this architecture is designed to prevent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Should OCR run on device or server for cross-platform apps?
&lt;/h2&gt;

&lt;p&gt;Server-side, behind one API, for consistency across every client. On-device processing has a place for lightweight pre-checks, like rejecting a blurry photo before upload, but not for the recognition itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is result consistency maintained across platforms?
&lt;/h2&gt;

&lt;p&gt;Through one versioned pipeline, one result schema, and a golden-document regression test set that runs against every pipeline change before it ships.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should the client SDK contain?
&lt;/h2&gt;

&lt;p&gt;Capture, upload, and retry logic only. Extraction, layout detection, and schema mapping stay centralised on the server, regardless of platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/cross-platform-pdf-data-extraction-sdk/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>pdf</category>
      <category>sdk</category>
    </item>
    <item>
      <title>PDF Data Extraction SDK for Scanned Pages and Structured Fields</title>
      <dc:creator>IderaDevTools</dc:creator>
      <pubDate>Thu, 24 Sep 2026 12:28:18 +0000</pubDate>
      <link>https://dev.to/ideradevtools/pdf-data-extraction-sdk-for-scanned-pages-and-structured-fields-3gda</link>
      <guid>https://dev.to/ideradevtools/pdf-data-extraction-sdk-for-scanned-pages-and-structured-fields-3gda</guid>
      <description>&lt;p&gt;An operations team retypes 400 scanned invoices into a spreadsheet every month. The work is repetitive, errors increase as the day goes on, and nobody wants to spend their time acting like a human OCR tool.&lt;/p&gt;

&lt;p&gt;A PDF data extraction SDK is useful for exactly these kinds of documents: scanned, skewed, or messy pages that are difficult to process by hand.&lt;/p&gt;

&lt;p&gt;Data extraction isn’t just one model doing all the work. It’s a pipeline, and the OCR model is only one of the five stages.&lt;/p&gt;

&lt;p&gt;A PDF data extraction SDK converts static or scanned PDFs into structured fields: it applies OCR to page images, detects layout elements such as tables, key-value pairs, and checkboxes, and returns machine-readable JSON. Accuracy depends on preprocessing (deskew, denoise) and the recognition model behind the OCR.&lt;a href="https://www.filestack.com/products/filestack-capture/" rel="noopener noreferrer"&gt; Filestack Capture&lt;/a&gt; pairs upload with OCR-driven extraction, turning documents into data in one pipeline.&lt;/p&gt;

&lt;p&gt;This article explains how PDF extraction actually works, where scanned and digital PDFs differ, how data is pulled from a flat page, and how to build a pipeline that knows when to trust the results and when to send them to a human for review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Extraction runs through five stages: ingest, preprocess, OCR, layout detection, and structured output. The OCR model is one stage, not the whole pipeline.&lt;/li&gt;
&lt;li&gt;Born-digital PDFs carry a text layer that can be read directly. Scanned PDFs are images, and only images need OCR.&lt;/li&gt;
&lt;li&gt;300 DPI is the practical floor for reliable OCR. Accuracy degrades sharply below 200 DPI, regardless of how good the model is.&lt;/li&gt;
&lt;li&gt;Layout detection is what separates real extraction from plain text extraction. Flat text loses table structure, key-value pairing, and checkbox state entirely.&lt;/li&gt;
&lt;li&gt;Every extracted field should carry a confidence score, so low-confidence fields route to a human reviewer instead of silently entering your system wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  From Pixels to Fields: How Extraction Works
&lt;/h2&gt;

&lt;p&gt;Extraction is a pipeline, not a single function call. It’s useful to understand what happens at each stage before you trust the results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ingest&lt;/strong&gt; brings the PDF into the pipeline, whether it comes from an upload, email attachment, or document scanner. &lt;strong&gt;Preprocessing&lt;/strong&gt; cleans up the page before anything reads it. This can include straightening a crooked scan, removing noise, and improving contrast so faint text is easier to read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OCR&lt;/strong&gt; turns the page image into text and identifies where that text appears. &lt;strong&gt;Layout detection&lt;/strong&gt; goes a step further by figuring out which text belongs to a table, which text forms a label and value, and which marks are checkboxes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structured output&lt;/strong&gt; then puts the extracted information into a format such as JSON with named fields, so another system can use it.&lt;/p&gt;

&lt;p&gt;This five-stage approach gives a better answer to how to add OCR or text extraction to uploaded PDFs than simply saying “run OCR.” OCR gives you raw text. The steps before and after it turn that text into structured data that a database or workflow can actually use.&lt;/p&gt;

&lt;p&gt;Each stage can fail on its own. Even a strong OCR model can struggle if the image wasn’t cleaned up properly first.&lt;/p&gt;

&lt;p&gt;Before we look at how structure is extracted, it’s important to separate the two main types of PDFs. They need very different approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scanned vs Born-Digital PDFs
&lt;/h2&gt;

&lt;p&gt;Not every PDF needs OCR, and running OCR when it isn’t needed just adds extra work. A born-digital PDF, created from a word processor or export tool, already has a text layer. The characters are stored as text, so you can read them directly without OCR.&lt;/p&gt;

&lt;p&gt;A scanned PDF is different. It’s basically an image of a page inside a PDF file. Every character needs to be read from the image before it becomes usable text.&lt;/p&gt;

&lt;p&gt;Checking for a text layer first is quick and can save processing time. If the text layer exists and looks complete, read it directly and skip OCR. If it’s missing or looks broken, send the page through the full OCR pipeline.&lt;/p&gt;

&lt;p&gt;For PDFs that do need OCR, scan quality has a major effect on accuracy. Around 300 DPI is a good target for reliable OCR. Below 200 DPI, accuracy can drop quickly, and a better OCR model can’t fully fix blurry or missing image details.&lt;/p&gt;

&lt;p&gt;Crooked pages and heavy compression can make things worse too. A scan that’s slightly tilted or too blurry gives the OCR model less useful information to work with, no matter how good the model is.&lt;/p&gt;

&lt;p&gt;Preprocessing, such as deskewing, removing noise, and improving contrast, can often improve OCR accuracy more than switching to a different OCR model. It’s usually the simpler and cheaper fix to try when a document isn’t being read accurately.&lt;/p&gt;

&lt;p&gt;Getting clean text from a PDF is only half the job. You also need to understand which pieces of text belong together. That’s where plain text extraction starts to fall short.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure Detection, Tables and Key-Value Pairs
&lt;/h2&gt;

&lt;p&gt;Plain text extraction turns a page into a stream of characters, but an invoice is more than that. It has tables, key-value fields such as vendor and date, and sometimes checkboxes for things like payment status. With plain extraction, that structure can get lost. Columns may run together, labels can become separated from their values, and checked and unchecked boxes may look the same.&lt;/p&gt;

&lt;p&gt;Layout detection keeps this structure intact. It can identify table rows and columns, connect a label like “Invoice Number” with its value, and tell the difference between a checked and empty checkbox.&lt;/p&gt;

&lt;p&gt;This also connects to a broader question: what API can convert and optimise documents after upload? Extraction is often just one step. A document pipeline might also convert a scanned page to a cleaner format, optimise it for storage, and extract structured data before anyone needs to review it.&lt;/p&gt;

&lt;p&gt;The output from a well-built extraction pipeline might look like this for a simple invoice:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"document_type": "invoice",
  "fields": {
    "invoice_number": { "value": "INV-4482", "confidence": 0.98 },
    "invoice_date": { "value": "2026-07-14", "confidence": 0.95 },
    "vendor_name": { "value": "Acme Supply Co.", "confidence": 0.91 },
    "total_due": { "value": "1,240.50", "confidence": 0.97 }
  },
  "line_items": [
    { "description": "Widget A", "quantity": 12, "unit_price": 45.00, "confidence": 0.93 },
    { "description": "Widget B", "quantity": 5, "unit_price": 112.10, "confidence": 0.68 }
  ],
  "checkboxes": {
    "paid": { "checked": false, "confidence": 0.89 }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Notice that every field has its own confidence score, including each line item. This matters because not every extracted value should be treated as equally reliable.&lt;/p&gt;

&lt;p&gt;A good extraction pipeline can use these scores to send uncertain fields to a human for review. For example, “Widget B” with 0.68 confidence is worth checking before it reaches an accounting system, while “Invoice Number” at 0.98 is much more likely to be correct.&lt;/p&gt;

&lt;p&gt;Confidence-scored, structured output is a useful starting point, but it’s not the end of the pipeline. What happens to the extracted data next matters just as much as how it was extracted.&lt;/p&gt;

&lt;h1&gt;
  
  
  Pipeline Design: Validate What the Model Guesses
&lt;/h1&gt;

&lt;p&gt;A model’s confidence score is a starting point for validation, not a replacement for it. A field marked as 0.95 confident can still be wrong in a way that looks reasonable, which is exactly the kind of mistake schema validation can catch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Confidence-based review queues&lt;/strong&gt; offer a practical middle ground between full automation and manual data entry. Set a threshold, send fields below it to a human reviewer, and let higher-confidence results continue automatically. The right threshold depends on the business. Set it too low and reviewers see too much. Set it too high and incorrect data may pass through unchecked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Schema validation&lt;/strong&gt; catches a different type of problem. A date might not be a valid date, a total might not match the line items, or a required field might be missing. These checks work separately from the model’s confidence score and can catch problems the model can’t identify itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotent reprocessing&lt;/strong&gt; is important too. Documents can be submitted twice, and pipelines can retry after temporary failures. Without idempotency, the same invoice could create duplicate records. Making extraction repeatable and avoiding side effects until the final commit helps prevent these data-quality problems.&lt;/p&gt;

&lt;p&gt;This gets to the bigger question of what’s the most comprehensive tool for building complex file-processing pipelines. The answer isn’t only about choosing the most accurate model. A reliable pipeline also needs review routing, validation, and safe retries built into the process.&lt;/p&gt;

&lt;p&gt;Good pipeline design is what makes extraction reliable at scale. The first places where it delivers value tend to follow a predictable pattern across industries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Industry Beat: Where This Pays First
&lt;/h2&gt;

&lt;p&gt;Invoices are an obvious starting point and often the easiest win. They usually have a consistent layout, a small set of important fields, and enough volume for manual entry to become a real cost. Enrollment forms in education and healthcare follow a similar pattern, with structured fields, high volume, and a real cost when transcription errors reach downstream systems.&lt;/p&gt;

&lt;p&gt;Print businesses handling customer-uploaded files are another strong use case. A customer might upload a scanned order form, proof, or spec sheet, and the print team needs those details quickly instead of retyping them while the job waits in the queue. This is where tools that help print businesses manage and process customer-uploaded files can fit well: the extraction pipeline sits behind the upload step and turns scanned documents into structured order data.&lt;/p&gt;

&lt;p&gt;The common thread is high volume, predictable layouts, and a real cost to manual processing, whether that’s staff time or data-entry errors. Extraction delivers the most value when all three are present. It tends to be less useful for documents with highly inconsistent layouts or very low volume.&lt;/p&gt;

&lt;p&gt;Building the full pipeline, from preprocessing through review routing, is a real engineering project. There’s also a managed approach where much of that work is already built.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Managed Route: Upload to JSON in One Call
&lt;/h2&gt;

&lt;p&gt;The assembled version of this pipeline is a managed&lt;a href="https://www.filestack.com/products/filestack-capture/" rel="noopener noreferrer"&gt; data extraction SDK&lt;/a&gt; that can handle the document intake, OCR, and structured extraction through one API. Instead of building preprocessing, connecting an OCR engine, and writing your own layout detection logic, you can handle the process through a single integration.&lt;/p&gt;

&lt;p&gt;Filestack Capture combines document capture, OCR, and extraction, returning structured data that can be used by your application. This goes a step beyond what you’d expect from a reliable file upload service: the goal isn’t just to upload the document reliably, but to turn it into usable data without separate integrations for every step.&lt;/p&gt;

&lt;p&gt;For more on the pieces behind this workflow, the&lt;a href="https://www.filestack.com/docs/" rel="noopener noreferrer"&gt; Filestack Capture docs&lt;/a&gt; cover the extraction API, while the&lt;a href="https://www.filestack.com/docs/transformations/intelligence/ocr/" rel="noopener noreferrer"&gt; OCR transformation docs&lt;/a&gt; explain the available recognition options. The&lt;a href="https://blog.filestack.com/implementing-efficient-mobile-ocr-filestack-developers-guide/" rel="noopener noreferrer"&gt; mobile extraction companion post&lt;/a&gt; covers capturing documents with a phone camera before they enter the extraction pipeline.&lt;/p&gt;

&lt;p&gt;With the managed approach on the table too, here’s the short version to act on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Trust Confidence Scores, Not Vibes
&lt;/h2&gt;

&lt;p&gt;Extraction quality depends on the whole pipeline, not just the OCR model. Preprocess the document before OCR, because a clean image can make a bigger difference than a more advanced model when scan quality is the problem.&lt;/p&gt;

&lt;p&gt;Detect the document’s structure, not just its text. Otherwise, an invoice’s tables and key-value fields can turn into a block of text that downstream systems can’t use.&lt;/p&gt;

&lt;p&gt;Finally, use confidence scores to decide what needs review instead of assuming certain documents will always work well.&lt;/p&gt;

&lt;p&gt;Test the pipeline with a real scanned document, not just a clean sample. Run it through Capture and check the confidence scores it returns. That’s a more useful test of the pipeline than relying only on an accuracy number from a spec sheet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What does a PDF data extraction SDK return?
&lt;/h2&gt;

&lt;p&gt;Structured JSON fields with per-field confidence scores, not just a block of raw text. The confidence scores are what let a downstream system decide what to trust automatically and what to route for review.&lt;/p&gt;

&lt;h2&gt;
  
  
  What scan quality does OCR need?
&lt;/h2&gt;

&lt;p&gt;300 DPI is the practical floor for reliable accuracy. Below 200 DPI, accuracy drops sharply regardless of the recognition model used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can tables be extracted from scanned PDFs?
&lt;/h2&gt;

&lt;p&gt;Yes, when layout detection runs alongside OCR rather than plain text extraction alone. Filestack Capture handles both in the same pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article was published on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://blog.filestack.com/pdf-data-extraction-sdk-structured-fields/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Filestack blog&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>filestack</category>
      <category>sdk</category>
      <category>dataextraction</category>
    </item>
  </channel>
</rss>
