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}/mediaLocaloy 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
httpsURL, at most 2,048 characters.
What Localoy will download#
httpsonly, 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-Typeyour 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
dryRunbooleanrequiredtruefor a sandbox key.data.urlstring | nullrequired- Localoy's copy.
nullfor 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#
| Status | Code | When |
|---|---|---|
400 | url_required / url_invalid / url_too_long / unknown_field | The body is wrong. |
400 | media_url_invalid | Not https, a private address, a host that does not resolve, credentials in the URL, or a blocked port. The message says which. |
413 | media_too_large | Larger than 10 MB. |
415 | media_type_not_supported | The file is not a JPEG, PNG, WebP, GIF or AVIF image. |
422 | media_fetch_failed | Your 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" }
}