Skip to content
helmstudio
Contents

gallery

GET /gallery/items

Query items, scoped to the caller unless scope=all.

R38. `scope=all` needs `gallery.read_all` (403 otherwise). `studio` narrows `scope=all` to one studio. Filters combine with AND; `tag` repeats and every tag must be present. `q` is full-text over title and `params.prompt` (Q17), FTS5 query syntax. Ordered `created_at` descending, `id` breaking ties, with or without `q`. Deleted items are never returned.

Needs the gallery capability.

GoQuery(ctx context.Context, params *GalleryQueryParams) (*ItemPage, error)
Pythondef query(self, *, scope: Optional[Any] = None, studio: Optional[Any] = None, kind: Optional[Any] = None, tag: Optional[Sequence[str]] = None, session_id: Optional[Any] = None, starred: Optional[Any] = None, asset_id: Optional[Any] = None, since: Optional[Any] = None, until: Optional[Any] = None, q: Optional[Any] = None, limit: Optional[Any] = None, cursor: Optional[Any] = None) -> Any
JavaScriptquery(params = {})
ParameterInTypeAbout
scopequerystring (self | all)
studioqueryStudioIdValue
kindqueryAssetKind
tagquerystring[]
session_idqueryULID
starredqueryboolean
asset_idqueryULID
sincequerystringItems created at or after this time.
untilquerystringItems created before this time.
qquerystring
limitqueryinteger
cursorquerystringThe `next_cursor` of the previous page, unchanged.
StatusBodyMeans
200ItemPageA page of items.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).

POST /gallery/items

Record an output with its params, inputs, tags and session. One call per generation.

07 §5. The item, its inputs, its tags and its search entry are written in one transaction (06 §8). `asset_id` and every input's `asset_id` must be readable by the caller (Q9), else 404; `session_id` must be one of the caller's live sessions, else 422 `unknown_session` (Q15). Duplicate `(asset_id, role)` inputs and duplicate tags are collapsed.

Needs the gallery capability.

GoAdd(ctx context.Context, body ItemCreate) (*Item, error)
Pythondef add(self, body: Dict[str, Any]) -> Any
JavaScriptadd(body)

Request body: ItemCreate (application/json)

StatusBodyMeans
201ItemThe recorded item.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.
413ErrorThe body is over its limit. Code `too_large`, with `details.limit` in bytes.
422ErrorWell-formed but refused. Codes: `outside_roots`, `cross_device`, `not_a_file`, `unknown_session`, `self_handoff`, `not_launchable`, `blocked`, `not_linkable`.

GET /gallery/items/{id}

One item. Another studio's without gallery.read_all, or a deleted one, is 404.

Needs the gallery capability.

GoGet(ctx context.Context, id string) (*Item, error)
Pythondef get(self, id: str) -> Any
JavaScriptget(id)
ParameterInTypeAbout
idpath · requiredULID
StatusBodyMeans
200ItemThe item.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.

PATCH /gallery/items/{id}

Star, tag or rename one of the caller's own items.

07 §3, Q16, M4 first review #11. A JSON merge patch: `tags`, an array, replaces the whole set; `title: null` clears the title. Params, inputs, asset and session are provenance and cannot change. Another studio's item is 404, even with `gallery.read_all`.

Needs the gallery capability.

GoUpdate(ctx context.Context, id string, body map[string]any) (*Item, error)
Pythondef update(self, id: str, body: Dict[str, Any]) -> Any
JavaScriptupdate(id, body)
ParameterInTypeAbout
idpath · requiredULID

Request body: ItemUpdate (application/merge-patch+json)

StatusBodyMeans
200ItemThe updated item.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.

DELETE /gallery/items/{id}

Soft-delete one of the caller's own items.

Q16, M4 first review #1. The item leaves every query, and every lineage result. Its row, inputs and tags stay until an asset reclaim takes one of the assets it names, which hard-deletes it (see POST /assets:reclaim). Until then the delete loses nothing. Its asset, and the assets it used as inputs, stop counting as referenced by it.

Needs the gallery capability.

GoDelete(ctx context.Context, id string) error
Pythondef delete(self, id: str) -> Any
JavaScriptdelete(id)
ParameterInTypeAbout
idpath · requiredULID
StatusBodyMeans
204Deleted.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.

GET /gallery/items/{id}/lineage

Upstream provenance — the items whose outputs this item was made from, recursively.

Q16. From the item's inputs to the items whose asset is that input, then onward. Inputs no item produced (a user import) end the walk and are visible in each item's `inputs`. Other studios' items are left out unless the caller holds `gallery.read_all`; the walk still passes through them. Soft-deleted items are left out of the result, and the walk passes through them too. Ordered `created_at` descending.

Needs the gallery capability.

GoLineage(ctx context.Context, id string, params *GalleryLineageParams) (*ItemPage, error)
Pythondef lineage(self, id: str, *, limit: Optional[Any] = None, cursor: Optional[Any] = None) -> Any
JavaScriptlineage(id, params = {})
ParameterInTypeAbout
idpath · requiredULID
limitqueryinteger
cursorquerystringThe `next_cursor` of the previous page, unchanged.
StatusBodyMeans
200ItemPageA page of items.
400ErrorThe request is malformed. Codes: `bad_request`, `bad_filter`, `bad_cursor`, `invalid_document`.
401ErrorNo studio token, or a revoked or unknown one. Code `unauthenticated`.
403ErrorThe token lacks a capability (`capability_required`, with `details.capability`), the job is not a task the studio may change (`not_a_task`), or the request came from another origin (`bad_origin`).
404ErrorAbsent, deleted, or not the caller's to see. Code `not_found`.