<!-- Markdown twin of https://pixelvault.dev/blog/migrate-imgbb-image-library/ -->

[← Back to blog](/blog/)

By [PixelVault](/about/) November 19, 2026

# Migrate an ImgBB image library without breaking your app.

Treat migration as a mapping problem: discover every URL your application uses, copy reachable bytes, verify the result, and switch references from a durable manifest.

![An image library migrating through an old-to-new URL manifest into verified permanent hosted copies](https://img.pixelvault.dev/proj_mkoboesmx25d/img_khsyg3gustle.png?w=1400&h=788&fit=cover&fmt=auto&q=auto)

Every old ImgBB URL is paired with a verified replacement before application references change. This illustration is hosted on PixelVault.

ImgBB’s public API is an upload API, not a library-management API. It documents no endpoint that lists all images in an account, and its `delete_url` opens a web page rather than a programmable `DELETE` endpoint. A safe migration therefore begins with the references you already control: source code, Markdown, database rows, CMS exports, email templates, and deployment configuration.

This guide copies images to PixelVault, but the migration shape applies to any destination. Keep the old URL and new URL together until every consumer has moved.

## 1\. Build the inventory from your application

Search for both common ImgBB hosts. `i.ibb.co` usually serves image files; `ibb.co` usually identifies a page. Also inspect database and CMS fields that never appear in the repository.

rg \-n \--hidden 'https?://(i\\.)?ibb\\.co/' . \# Extract candidate URLs from text files, then review the output. rg \-o \--no-filename 'https?://\[^\[:space:\]"'"'"'<>\]\*(i\\.ibb\\.co|ibb\\.co)\[^\[:space:\]"'"'"'<>\]\*' . \\ | sort \-u > imgbb-urls.txt

Review `imgbb-urls.txt` by hand. Remove page URLs, trailing punctuation, duplicates, and anything you do not own or have permission to copy. An HTML or database export may need a format-aware parser rather than a regular expression.

## 2\. Test the sources before starting

A migration can only import an image that ImgBB still serves publicly. Fetch a sample from the same environment that will run the migration:

curl \-sS \-o /dev/null \\ \-w 'status=%{http\_code} type=%{content\_type} bytes=%{size\_download}\\n' \\ 'https://i.ibb.co/…/example.jpg'

Expect `200`, an `image/*` content type, and a plausible byte count. If a URL returns HTML, a block page, or a missing response, recover that item from your original files instead of recording a false success.

## 3\. Import sequentially and write the manifest after every success

The script below reads one source URL per line, imports it through PixelVault’s [URL-upload API](/image-hosting-api/), and writes `imgbb-migration.json` after each successful copy. Sequential requests are slower than a large burst but easier to resume and less likely to trigger an undocumented source-host limit.

migrate-imgbb.mjs

// migrate-imgbb.mjs — Node.js 22+ import { createHash } from "node:crypto"; import { readFile, writeFile } from "node:fs/promises"; const key = process.env.PIXELVAULT\_API\_KEY; if (!key) throw new Error("Set PIXELVAULT\_API\_KEY"); const sources = \[...new Set( (await readFile("imgbb-urls.txt", "utf8")) .split(/\\r?\\n/) .map((line) => line.trim()) .filter(Boolean) )\]; let manifest = \[\]; try { manifest = JSON.parse(await readFile("imgbb-migration.json", "utf8")); } catch (error) { if (error.code !== "ENOENT") throw error; } const completed = new Set(manifest.map((row) => row.source\_url)); for (const sourceUrl of sources) { if (completed.has(sourceUrl)) continue; const idempotencyKey = "imgbb-" + createHash("sha256") .update(sourceUrl) .digest("hex") .slice(0, 48); const response = await fetch("https://api.pixelvault.dev/v1/images", { method: "POST", headers: { Authorization: "Bearer " + key, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey, }, body: JSON.stringify({ url: sourceUrl, folder: "imgbb-import", metadata: { source\_host: "imgbb", source\_url: sourceUrl }, }), signal: AbortSignal.timeout(30\_000), }); const body = await response.json(); if (!response.ok) { console.error(sourceUrl, response.status, body.error?.code); continue; } manifest.push({ source\_url: sourceUrl, pixelvault\_id: body.data.id, pixelvault\_url: body.data.url, size: body.data.size, }); await writeFile( "imgbb-migration.json", JSON.stringify(manifest, null, 2) + "\\n" ); console.log(sourceUrl, "→", body.data.url); }

export PIXELVAULT\_API\_KEY=pv\_live\_… node migrate-imgbb.mjs

The stable `Idempotency-Key` makes a retry return the first stored image instead of creating another. Custom metadata keeps the source URL attached to the new image.

## Know the size mismatch before a long run

ImgBB documents uploads up to 32 MB. PixelVault allows 5 MB per image on Free, 10 MB on Starter, and 15 MB on Pro. A source that exceeds the destination limit will fail; the script leaves it out of the manifest and continues.

Download those large files, preserve the original separately, then resize or re-encode a delivery copy with the [image compressor](/tools/image-compressor/) or `pixelvault optimize`. Do not silently compress archival images if exact bytes matter.

## 4\. Verify the destination, not just the API response

For each manifest row, fetch the new URL and compare at least MIME type, byte size, dimensions, and a visual sample. Byte-for-byte hashes may differ if you deliberately optimized an image, so record that transformation rather than treating it as an identical copy.

Run the application against a staging copy of the new mapping. Check pages, social cards, email templates, API payloads, and mobile clients. A successful migration script does not prove every consumer read the new field.

## 5\. Switch references in reversible batches

Replace URLs from the manifest, not with a broad host-name substitution. ImgBB paths do not map mechanically to PixelVault paths. Start with one route or content collection, deploy it, watch for broken images, then continue.

-   Keep the old URL in migration metadata or a separate audit table.
-   Use the exact CDN URL returned by the API; do not construct it from the image ID.
-   Update cached HTML, RSS output, email templates, and generated static files—not only the source database.
-   Leave ImgBB copies in place until logs and a crawl show no remaining requests.

## 6\. Remove the old dependency last

ImgBB’s documented API does not provide programmable deletion. If you retained each upload’s `delete_url`, a person can open those pages after the cutover. If you did not retain them, account-level cleanup is separate from the application migration.

For ImgBB’s upload parameters and the operations it does and does not expose, see the [ImgBB API guide](/alternatives/imgbb-api/). The migration is complete when your application, generated output, and monitoring no longer depend on the old URLs—not when the copy script reaches the end of its input file.

## More in Rescue broken image links

-   [ImageVenue thumbnail temporarily unavailable? Recover it](/blog/imagevenue-thumbnails-not-loading/) A failed ImageVenue thumbnail does not always mean the original is gone. Find it, save reachable files, migrate them and replace broken embeds safely.
-   [private-user-images.githubusercontent.com broken? Why, and the fix](/blog/private-user-images-githubusercontent-broken/) Private-repo image links carry a token that expires in minutes, so a copied or cached one turns into "page can't be found". How to recover the image and stop it breaking.
-   [Confluence export images broken? Get them out and re-host them](/blog/confluence-export-images-broken/) Confluence images are login-only attachments, so they break when pages move to Markdown, a docs site or another wiki. Export the files, then rewrite the links in one pass.

[All posts in Rescue broken image links →](/blog/topics/rescue/)
