Import an image

Give Localoy the URL of an image and get back Localoy's own copy to use in your listings.

POST{BASE_URL}/media

Localoy downloads the image at url and stores its own copy, resized for the apps. Listings show Localoy's copy, never a link to your server, so your server's uptime and bandwidth never affect customers. Requires the REGISTRATION scope.

Each call stores a new copy, even for a URL you sent before — keep the returned url and reuse it.

Body

urlstringrequired
A public https URL, at most 2,048 characters.

What Localoy will download#

  • https only, on a public address. URLs that point at private, loopback or link-local addresses are refused, as are URLs with a username or password in them.
  • At most 3 redirects, and each one must meet the same rules.
  • At most 10 MB, downloaded within 10 seconds.
  • JPEG, PNG, WebP, GIF or AVIF. The file's content decides its type, not the Content-Type your server sends.

Sandbox keys store nothing

A sandbox key's call downloads and checks the image the same way, then answers 200 with "dryRun": true and url: null. Only a production key stores a copy.

Response

dryRunbooleanrequired
true for a sandbox key.
data.urlstring | nullrequired
Localoy's copy. null for a sandbox key.
data.mimeTypestringrequired
The stored type. Large photos are usually stored as image/webp.
data.sizeBytesintegerrequired
The stored size.
data.sourceUrlstringrequired
The URL the image was finally downloaded from, after redirects.

Errors#

StatusCodeWhen
400url_required / url_invalid / url_too_long / unknown_fieldThe body is wrong.
400media_url_invalidNot https, a private address, a host that does not resolve, credentials in the URL, or a blocked port. The message says which.
413media_too_largeLarger than 10 MB.
415media_type_not_supportedThe file is not a JPEG, PNG, WebP, GIF or AVIF image.
422media_fetch_failedYour server answered an error, an empty body or a redirect with no Location; there were more than 3 redirects; or the download took longer than 10 seconds.
cURL
curl -X POST "$LOCALOY_BASE_URL/media" \
  -H "Authorization: Bearer $LOCALOY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://shop.example.com/images/kacchi.jpg" }'
Response · 201
{
  "success": true,
  "message": "Image stored",
  "dryRun": false,
  "data": {
    "url": "https://…/open_network/2026-11-10/6f1c2d0e-3b8a-4f5e-9d21-7a4c0b9e1f22.webp",
    "mimeType": "image/webp",
    "sizeBytes": 184213,
    "sourceUrl": "https://shop.example.com/images/kacchi.jpg"
  }
}
Response · 400
{
  "success": false,
  "message": "url points at 169.254.169.254, a private, loopback or link-local address",
  "code": "media_url_invalid",
  "details": { "field": "url" }
}