assets

Get asset counts

Changed on

Counts assets bucketed by time period — use this to summarize a library (or a filtered slice) without paging through the full timeline. Returns one row per bucket, newest-first by default or oldest-first when order=asc, with optional filtering by album, album membership, people, rating, media type, date range, location, or trash state.

To list the actual assets within a bucket, call list_assets with the same filters and a local_datetime_after / local_datetime_before window matching the bucket. Does not filter by image content; for content-based search use search_assets.

Pagination: When has_more is true, pass the last time_bucket from data as starting_after_bucket. Repeat the same group_by, order, date bounds, and non-date filters. Count bounds, the cursor, and returned bucket starts are timezone-naive local-calendar values.

get/api/assets/counts

Request

  • Base URL: https://api.gumnut.ai
  • URL: https://api.gumnut.ai/api/assets/counts
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer

Query parameters

library_idstring nullable

Library to count assets in. Optional if the user has a single live (non-trashed) library; required when they have multiple.

group_by'day' | 'week' | 'month' | 'year'

Calendar period for asset-count buckets: day, week, month, or year.

Week buckets run Sunday through Saturday.

Calendar period to use for each count bucket.

album_idstring nullable

Return only assets in this album — the album's album_ ID, not its name.

album_filter'all' | 'in_album' | 'not_in_album'

Which assets to include, based on album membership: in_album returns assets filed into at least one album; not_in_album returns assets in no album at all — the ones still waiting to be organized; all returns both.

Filter by album membership in general, rather than by membership of one specific album. This filter is independent of album_id, but combining not_in_album with album_id is contradictory and returns 422. Defaults to all.

person_idstring nullable

Deprecated compatibility alias for one person_ids value. Do not combine it with person_ids.

person_idsstring[] nullable

Filter to assets containing faces belonging to ALL of these people (intersection, not union). Accepts up to 200 IDs across repeated person_ids= query params or comma-delimited values. Person IDs are carried by the entries of an asset's people field (returned with include=people).

media_type'image' | 'video'

Which media class an asset belongs to.

Every image format is image and every video format is video. An asset's class is fixed by the file originally uploaded, so an edited photo is still image.

Filter to one media class (image or video). Omit to include both images and videos.

ratingsinteger[] nullable

Return assets whose effective rating is one of these exact values. Values must be integers from 0 through 5; 5 is a favorite. 0 matches every unrated form: an explicit zero, a null or legacy out-of-range effective rating, or an asset with no metadata. Accepts repeated ratings= parameters or one comma-delimited value. Omit the parameter for no rating filter.

local_datetime_afterstring date-time nullable

Only include assets captured strictly after this local wall-clock datetime (ISO 8601; exclusive). Asset counts accept timezone-naive values only; a Z suffix or timezone offset returns 422. Repeat this bound unchanged on every pagination page.

local_datetime_beforestring date-time nullable

Only include assets captured strictly before this local wall-clock datetime (ISO 8601; exclusive). Asset counts accept timezone-naive values only; a Z suffix or timezone offset returns 422. Repeat this bound unchanged on every pagination page.

centerstring nullable

Center point of a radius location filter: two comma-separated decimal-degree numbers longitude,latitude, e.g. -77.05,38.95. Supply with radius. Mutually exclusive with bbox.

radiusnumber nullable

Radius of the center location filter, in meters (greater than 0, at most 50,000). Supply with center. Mutually exclusive with bbox.

bboxstring nullable

Bounding-box (map viewport) location filter: four comma-separated decimal-degree numbers min_longitude,min_latitude,max_longitude,max_latitude (west,south,east,north), e.g. -77.1,38.9,-77.0,39.0. A box whose min_longitude exceeds max_longitude crosses the antimeridian: it selects the band running east from min_longitude over ±180° to max_longitude, so there is no need to split it client-side. Longitude order is therefore significant — transposed corners read as a crossing viewport, not as an error. A viewport 360° or wider must be sent as the full range -180,...,180,..., which the wrapped form cannot express. Mutually exclusive with center/radius.

starting_after_bucketstring date-time nullable

Cursor for time-bucket pagination. Pass the last returned time_bucket unchanged; buckets after it in the requested order are returned. Omit for the first page.

state'live' | 'trashed' | 'all'

Which set of assets to count: live (default — excludes trashed assets), trashed (only trashed assets), or all (both live and trashed).

order'asc' | 'desc'

Sort direction for capture-date buckets: desc returns newest buckets first; asc returns oldest buckets first.

limitinteger

Maximum number of time buckets to return per page (1–200). Defaults to 20.

Response

Successful Response

has_moreboolean required

True if there are more time buckets. To fetch the next page, pass the last time_bucket as starting_after_bucket. Keep the library scope, group_by, order, state, date bounds, and every population filter unchanged.

Changes

    • breaking

      the query request parameter group_by was restricted to a list of enum values

    • info

      added the new optional query request parameter bbox

    • info

      added the new optional query request parameter center

    • info

      added the new optional query request parameter media_type

    • info

      added the new optional query request parameter order

    • info

      added the new optional query request parameter radius

    • info

      added the new optional query request parameter ratings

    • info

      added the new optional query request parameter starting_after_bucket

    • info

      added the new enum value day to the query request parameter group_by

    • info

      added the new enum value month to the query request parameter group_by

    • info

      added the new enum value week to the query request parameter group_by

    • info

      added the new enum value year to the query request parameter group_by

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the new optional query request parameter person_ids

    • info

      query request parameter person_id was deprecated