memories.repair API
For scripts, programs and AI agents that repair photos without the website. The website uses this same API (v1), so everything the result viewer can do, a script can do too.
What it costs: uploading a photo, its diagnosis, the watermarked preview and changing the repair are free and need no account. Downloading the repaired photo in full quality costs 1 credit, paid with an API key; see "Credits and API keys".
Who can open a photo: a photo that belongs to an account (uploaded with its API key or signed in, added to it on signing in, or unlocked by it) answers only that account: send the key with every request on it (403 otherwise). A photo uploaded without an account is open to whoever has its id (20 random characters, like a private link) until an account unlocks it.
Base URL: https://memories.repair/api/v1
Upload a photo
# the file as the request body
curl -X POST --data-binary @IMG_0042.JPG -H "x-filename: IMG_0042.JPG" https://memories.repair/api/v1/photos
# or as a form
curl -F photo=@IMG_0042.JPG https://memories.repair/api/v1/photosThe answer (201) is the photo: what is wrong with it, the automatic repair, and links. With an API key (or signed in) the photo is added to your photos (GET /photos lists them) and opens only with your key; an account keeps up to 500 at a time (403 when full; photos are deleted after 7 days). Without a key the answer also has claim, which the website uses to add the photo to an account after signing in.
A photo that takes long: with a lot of damage (hundreds of damaged places) the repair can take a few minutes. Then the answer is 202 with { "id", "filename", "created", "expires", "repairing": true } (and claim, links) instead: the repair goes on. GET /photos/:id answers the same 202 until it is ready, then the photo as below (Retry-After says when to ask again). Other requests for the photo meanwhile answer 409. Opening a photo again later (after the service restarted) can answer 202 for a moment too.
Limits: a file up to 40 MB, a picture up to about 120 megapixels (413 otherwise). 60 uploads an hour without a key (counted per address), 300 an hour with one (429 otherwise; Retry-After says how many seconds to wait). Send 2 or 3 photos at a time at most: more at once answer 503, also with Retry-After; just send them again.
{
"id": "wDK9wshakj8ZMzxPaAc4",
"filename": "IMG_0042.JPG",
"created": "2026-10-17T19:54:49.031Z",
"expires": "2026-10-24T19:54:49.031Z", // deleted automatically after 7 days (unlocked: 7 days after unlocking, if later)
"version": 0, // goes up with every change
"copies": 0, // other copies of the same photo put into it (see below)
"orientation": 1, // how the photo is turned to view it (EXIF: 1, 3 = upside down, 6 / 8 = a quarter
// clockwise / counter-clockwise): the camera's, or what was set with "orient"
"diagnosis": {
"picture": { "width": 1600, "height": 1200, "camera": "Canon PowerShot A60", "taken": "2004:10:07 19:28:58", "orientation": 1 },
"header": "intact", // | "start of the picture data lost" | "rebuilt from the file" | "taken from another photo" | "lost"
"thumbnail": "intact", // the camera's own preview: | "damaged" | "recovered" | "mismatch" (shows another picture or crop: not used) | "none"
"lostBytes": 16384, "lostPlaces": 8, "lostPercent": 7, "realPercent": 92.8,
"verdict": "automatic", // "intact" | "automatic" (all pieces placed with confidence) | "check" | "manual"
"summary": "7% of the picture data was lost in 8 places. ...",
"notes": [],
"bands": [ /* per piece: index, firstRow, lastRow, confidence, basis */ ]
},
"canRender": true, // false: nothing could be decoded, or a donor photo is needed
"needsDonor": false, // true: the file's beginning was lost; send an intact photo from the same camera (below)
"hasThumbnail": true,
"thumbnailCrop": null, // a thumbnail with black bars (phones): { x, y, w, h, fullW, fullH } = the part with the picture
"thumbnailArea": null, // a thumbnail that shows only the middle of the photo: { x, y, w, h } = that part, as fractions of the photo
"thumbnailTurn": 0, // 1 or -1: the thumbnail is shown turned a quarter (clockwise or not) to fit the photo
"picture": { "width": 1600, "height": 1200, "mcuW": 16, "mcuH": 8, "cols": 100, "rows": 150, "blocks": 15000 },
"levelStep": { "Y": 4, "C": 4 },
"bands": [
{
"index": 1,
"blocks": 2365, // blocks of real picture data in this piece
"start": 709, // where its first block is now (block number, row by row: row = start / cols)
"autoStart": 709, // where the automatic repair put it
"confidence": "good", // "exact" | "good" (green) | "check" (yellow) | "unsure" (red)
"basis": "matched with the camera's thumbnail",
"how": "preview", // "exact" | "preview" | "restart" (the file's restart markers) | "rows above" | "rows below" | "estimate" | "preview+bytes"
"colour": "preview",
"level": { "Y": -10, "C1": 1, "C2": 0 },
"levelSetByHand": false
}
],
"links": { "self": "...", "viewer": "https://memories.repair/photo/wDK9...", "image": "...", "mask": "...", "maskPng": "...", "thumbnail": "...", "edit": "...", "donor": null }
}A "piece" (bands in the JSON) is a stretch of real picture data that survived between two lost parts of the file. Pieces are counted in blocks (MCUs, mcuW x mcuH pixels), row by row.
The photo
GET /photos/:id | the photo as above |
GET /photos/:id/image | the repaired photo (JPEG) as it is now; ?download to save it as <name> repaired.jpg (only once unlocked, else 402) |
GET /photos/:id/screen | the same, at most 2048 pixels on its longest side (a smaller copy for big photos): quick to load after every change |
| until the photo is unlocked, both give the free preview: at most 1280 pixels, with a watermark (an intact upload, where nothing was repaired, as it is) | |
POST /photos/:id/unlock | pay 1 credit for the full-quality photo, once (see below); the photo is then kept 7 days from the unlock, if that is later than its expires |
GET /photos/:id/mask | one byte per block, row by row (cols x rows): 1 = filled in, not real picture data |
GET /photos/:id/mask.png | the same as a black-and-white PNG the size of the photo (white = filled in), turned like the photo, to lay over it in a retouching program; ?download to save it as <name> mask.png |
GET /photos/:id/thumbnail | the camera's own preview (JPEG), for comparing: the small thumbnail, or the bigger preview many cameras keep after the photo when that one came through whole |
GET /photos/:id/original | the file as it was uploaded |
GET /photos/:id/small | a small picture of the repair (at most 360 pixels), for lists |
GET /photos | your photos (API key), newest first: { photos: [...], max }. Each photo in a few words: id, filename, created, expires, verdict (as above; null: nothing could be repaired), canRender, needsDonor, copies, pieces, toCheck (pieces marked yellow or red), paid, unlocked, links |
POST /photos/zip | several repaired photos as one zip file (API key): JSON { "ids": ["...", "..."] }, at most 100 photos and 3.5 GB. Only your unlocked photos are put in; a NOT INCLUDED.txt in the zip lists the others and why |
DELETE /photos/:id | delete it now |
Change the repair
POST /photos/:id/edit with one JSON operation; the answer is the photo with its new version. { "op": "addRow" } adds a row of blocks at the bottom of the picture (at most 16), so the pieces can move further down, the last one too (picture then has the taller size, addedRows says how many); { "op": "removeRow" } takes the last added one off again (a piece that reached into it moves back up); set takes rows too (undo / redo).
{ "op": "move", "band": 3, "delta": 1 } // one block right (-1: left)
{ "op": "move", "band": 3, "delta": -100 } // one row up (delta = ± cols for rows)
{ "op": "move", "band": 3, "delta": 100, "withBelow": true } // the pieces below move with it
{ "op": "level", "band": 3, "Y": 1 } // brighter by one step (-1: darker)
{ "op": "level", "band": 3, "C1": 1, "C2": -1 } // bluer (C1 -: yellower), greener (C2 +: redder)
{ "op": "level", "band": 3, "Y": 1, "withBelow": true } // the pieces below change by the same steps too
{ "op": "level", "band": 3, "C1": 0.25 } // a fine change: a quarter of a step (about 1 level of 255)
{ "op": "reset", "band": 3 } // back to the automatic position and colours
{ "op": "resetAll" }
{ "op": "set", "starts": [0, 709, 3238], "manual": [null, null, { "Y": 4, "C1": 0, "C2": 0 }] } // everything at once (undo/redo)
{ "op": "cut", "band": 3, "at": 250 } // cut piece 3 in two: a new piece from its block 250 on
{ "op": "join", "band": 4 } // a piece that was cut off joined again with the one before
{ "op": "cutBreaks" } // cut at every likely break the photo's "breaks" lists
{ "op": "orient", "orientation": 6 } // turn it: the downloaded file gets this EXIF orientationCutting a piece: where the picture visibly breaks inside one piece (the colours go wrong from some block on, a few wrong bytes the repair couldn't find), cut it there: the new piece starts at block at of the piece (counted from its first block), right where it was, and gets its own automatic colours; it can then be moved and recoloured like any other. The cut moves to the block where the colours change most within a row of at. A piece made that way says "cut": true; join puts it back. The photo's breaks lists places inside pieces where the colours jump much more than usual ({ "band", "at", "ratio" }): likely breaks, never cut on their own, since a sharp edge in the picture (a horizon, a black border) can look the same. The photo's cuts (where its pieces were cut, as positions in the file) go with set, so an undo can go back across a cut: { "op": "set", "starts": [...], "manual": [...], "cuts": [...] }.
Positions are always counted in the picture as it is stored in the file, whichever way it is turned.
A piece can't overlap its neighbours or leave the picture: a move is shortened to what fits. Colour levels that weren't set by hand follow the piece when it moves.
A photo whose header was lost or damaged
When needsDonor is true, the information needed to decode the picture was lost with the file's beginning. Send an intact photo taken with the same camera at the same size and quality (it is only used for that information):
curl -X POST --data-binary @intact.jpg https://memories.repair/api/v1/photos/wDK9wshakj8ZMzxPaAc4/donorThe same helps when diagnosis.donorAdvice is "recommended": the header was rebuilt from what survived, but the tables that set contrast and colours had to be guessed, so the colours are probably wrong. ("possible": rebuilt and probably right, or another photo's header is in use already; a better fitting one can still be sent.)
If the photo doesn't fit, nothing changes and the answer has donorRejected, the reasons, for example ["it is 640x480 (landscape), this picture is 480x640 (portrait)"]; try another one. When it fits, the repair starts again from the automatic one with the new header (and version goes up).
Another copy of the same photo
Copies of the same photo (from different CDs, cards or backups) usually lost different parts. Send another copy and what was lost in this one is taken from it, where it survived there: real picture data, nothing filled in.
curl -X POST --data-binary @copy2.jpg https://memories.repair/api/v1/photos/wDK9wshakj8ZMzxPaAc4/copyThe answer is the photo, with copyResult: { "found": 0.8, "stillMissing": 0.2 } (fractions of what was missing; found: 1, stillMissing: 0 = complete again), or { "rejected": "it is a different photo: ..." }. When nothing was found, or the file is not a copy, nothing changes; otherwise the repair starts again from the automatic one (version goes up, copies too). More copies can be sent one after the other.
Credits and API keys
Create a key on the account page (https://memories.repair/account, "API keys"). Send it as x-api-key: mr_... or Authorization: Bearer mr_.... Credits are bought on the account page too; one credit unlocks one photo, and an unlocked photo can be downloaded as often as needed (with the key of the account that unlocked it).
curl -X POST -H "x-api-key: mr_..." https://memories.repair/api/v1/photos/wDK9wshakj8ZMzxPaAc4/unlock
# { "unlocked": true, "charged": true, "credits": 28 } (charged: false when it was unlocked already)
curl -o repaired.jpg "https://memories.repair/api/v1/photos/wDK9wshakj8ZMzxPaAc4/image?download"The photo's JSON says "unlocked" (paid for) and "paid" (it costs a credit: something was repaired; an intact upload costs nothing). Unlocking answers 401 without a valid key, 402 with no credits left (credits in the answer), 409 when there is nothing to pay for (nothing could be repaired yet, or nothing needed repairing).
Credits are used in the order they were bought. A pack nobody has used yet can be refunded within 14 days; the first download with its credits ends that. With a key, unlocking doesn't ask first (making the key is the agreement), and an email confirms it when a pack starts. Without a key (signed in, as the website does), the first credit of a pack that can still be refunded answers 409 with consent: { ref, credits, bought }: send { "consent": "<ref>" } as the body to agree and unlock.
Errors
Errors are JSON with a plain-language message: { "error": "This is a PNG file, not a JPEG photo. ..." }.
| Status | When |
|---|---|
| 400 | no file, or not a photo |
| 401 | unlocking without a valid API key (or sign-in), or a key that isn't valid |
| 402 | downloading a photo that isn't unlocked, or unlocking with no credits left |
| 403 | the photo belongs to an account, and the request has no key (or another account's) |
| 404 | no such photo (or deleted after 7 days) |
| 409 | the photo can't be rendered (yet): see needsDonor; or it is still being repaired (see "A photo that takes long") |
| 413 | the file is over 40 MB, or the picture over about 120 megapixels |
| 415 | not a JPEG that can be repaired (PNG, HEIC, RAW, progressive JPEG, ...); a RAW file is also told by its name (.CR2, .NEF, .ARW, .DNG...) |
| 422 | the file took too long to work out and was stopped: it can't be repaired here |
| 429 | too many uploads in an hour (Retry-After: seconds until the next one is allowed) |
| 503 | too many uploads at the same time, or the repair service is busy or starting: try again in a few seconds |
Questions, or bigger numbers of photos? Write to [email protected]. API keys are made on your account page.