# Bildeheim API for assistants

Bildeheim is a private photo and video library. This API lets an assistant find photos, read their
details and fetch them as JPEGs. Base address: `https://bildeheim.com/v1`.

## Getting access

Your person makes a token for you in Bildeheim › Settings › Agents and gives it to you. Send it on every
request:

    Authorization: Bearer bh_…

A token sees everything its person can see, including libraries other people share with them.
Keep it secret and never post it anywhere.

## Find photos

    GET /v1/photos?person=Jeremy&from=2026-11-01&to=2026-11-09&place=Tennessee&tag=beach&q=kids+on+a+beach&limit=100&cursor=…

Every filter is optional and they combine:

| Filter | Meaning |
|---|---|
| `person` | A person's name (part of it is fine) or id. Repeat it for photos with several people together. |
| `from`, `to` | Date taken, local time: `2026`, `2026-11` or `2026-11-09`. Both ends are included. |
| `place` | City, state or country, for example `Tennessee`, `Wilmington`, `United States`. |
| `tag` | An exact tag, for example `beach`. |
| `kind` | `photo` or `video`. |
| `type` | `screenshot`, `selfie`, `panorama`, `live` (Live Photos) or `video`. |
| `favorite` | `1`: only your person's favorites. |
| `missing` | `place` (photos with no place) or `date` (only a rough date: from the folder, the file's save date, or a neighbouring file). |
| `receipts` | `1`: photos of receipts and invoices (found by the AI description), archived or not when `archived=any`. |
| `archived` | Photos your person archived are left out by default (archive is each person's own). `1`: only archived photos; `any`: both. |
| `album` | An album id (normal or smart). |
| `bbox` | `south,west,north,east` in degrees: photos taken inside that box. |
| `q` | Free text. It searches captions, tags, names and places, and also what the photo shows. |
| `sort` | `newest` (default), `oldest`, or `relevance` (default when `q` is given). |
| `limit` | 1–500, default 100. |
| `cursor` | The `next_cursor` from the previous page. `null` means there are no more. |

The answer is `{ "photos": [...], "next_cursor": "…" | null }`, and each photo looks like this:

```json
{
  "id": "Ab3dE5fG7hJk", "kind": "photo", "path": "/Camera Uploads/2026-05-25 14.10.11.heic", "filename": "2026-05-25 14.10.11.heic",
  "owner": "Dave", "taken_at": "2026-05-25T14:10:11-04:00", "taken_at_source": "metadata", "timezone_known": true,
  "width": 3024, "height": 4032, "format": "heic", "bytes": 2831220, "duration": null,
  "location": { "lat": 35.96, "lon": -83.92, "city": "Knoxville", "state": "Tennessee", "country": "United States" },
  "people": [ { "person_id": "p1…", "name": "Jeremy Emerson", "face_id": "f1…", "box": { "x": 0.31, "y": 0.18, "w": 0.2, "h": 0.33 }, "confidence": 1, "source": "imported" } ],
  "unnamed_faces": [ { "face_id": "f2…", "box": { "x": 0.6, "y": 0.2, "w": 0.1, "h": 0.15 } } ],
  "tags": ["beach", "sunset"], "caption": "Two people walking on a beach at sunset.", "camera": "Apple iPhone 15 Pro",
  "duplicate_group": "2026-05-25T14:10:11|4032x3024", "hash": "…", "in_trash": false,
  "files": { "thumb": "…/file?size=thumb", "preview": "…/file?size=preview", "full": "…/file?size=full", "original": "…/file?size=original" }
}
```

- `box` values are fractions of the picture (0–1) from the top-left corner.
- `taken_at_source` is `metadata` (from the file), `filename`, `dropbox` (when the file was saved) or `folder`
  (only the year is known). `timezone_known: false` means `taken_at` is local time without a zone.
- Photos with the same `duplicate_group` are the same moment saved more than once. Identical files are
  stored once, so the same photo under two file names is a single photo with one id.

Every photo also says `favorite`, `media_type`, `live_photo` (with `live_video`, the clip to download) and
`text_in_photo` (words the AI read on signs, documents, receipts or screens; `q` searches them too).

Hidden photos and hidden albums never appear in this API in any way. That includes photos that are in a hidden album: asking for one by id answers "not found". Treat "not found" as "not there".

## One photo

    GET /v1/photos/{id}

## The picture itself

    GET /v1/photos/{id}/file?size=thumb|preview|full|original&format=jpg

- `thumb` is about 960×480 and `preview` is up to 2048 px. Both are cheap, so check candidates with them first.
- `full` is the whole picture as a JPEG, converted from HEIC for you.
- `original` is the untouched original file (HEIC, MOV…). Videos are only available as `original` for now.
- `format=webp` works for `thumb` and `preview`. The default is `jpg`.

## People

    GET /v1/people

Everyone with a name, with how many photos they are in and one face to show
(`face.photo_id`, `face.box`, `face.thumb`).

## How much is indexed

    GET /v1/stats

Totals, the date range, photos per year, how many have exact dates, GPS and place names, how many the AI
has described, and import progress. If a search finds nothing, check here whether that period is in
the library at all before saying so.

## Albums

    GET  /v1/albums                          your person's albums, plus albums others shared with them (to view, or to view and add)
    GET  /v1/albums/{id}
    POST /v1/albums  { "name": "Tennessee trip", "photo_ids": ["…"] }        a normal album
    POST /v1/albums  { "name": "Jeremy at the beach", "query": { "person": "Jeremy", "q": "beach" } }   a smart album (fills itself)
    POST /v1/albums/{id}/items  { "photo_ids": ["…"] }                       add photos (albums your person owns, or was allowed to add to)

Albums are private to the person who made them unless they share one. List an album's photos with `GET /v1/photos?album={id}`. You can make albums and add to them, never delete or remove.

## Favorites

    POST /v1/photos/{id}/favorite  { "favorite": true }      (or false)

## Links to share

    POST /v1/links  { "photo_ids": ["…"], "title": "Thanksgiving", "include_gps": false, "expires_days": 30 }   or { "album_id": "…" }
    GET  /v1/links

The answer has `url`: anyone with it can view and download without an account. Places are removed from downloads unless
`include_gps` is true. Make a link only when your person asks for one; they see in Bildeheim that you made it.

## Corrections you may make

Only on photos in your person's own library (not on shared ones):

    POST /v1/photos/{id}/faces/{face_id}   { "name": "Jeremy Emerson" }   or { "person_id": "…" }   or { "person": null } to clear
    POST /v1/photos/{id}/tags              { "tag": "thanksgiving" }

Use these when your person corrects you ("that's not Jeremy"). Every change records that an assistant made it.
Assistants cannot delete anything.

## Place names

City, state and country come from GeoNames (https://www.geonames.org, CC BY 4.0): the nearest place with at
least 1,000 people, so a photo taken just outside a city may name the neighbouring town.

## Errors

Errors are JSON, `{ "error": "…" }`, with a normal HTTP status: 400 for a wrong request, 401 for a missing or
revoked token, 404 when nothing is found, and 429 when you should slow down.
