Skip to main content
const photos = await client.getPhotos()
Returns every photo in the project that has been approved by the photographer. Sorted by position ascending, then createdAt ascending.
Only photos with status = "approved" are returned. Rejected, unselected, or in-progress photos are never exposed through the gallery API.

Parameters

None.

Returns

interface GalleryPhoto {
  id:        string
  position:  number | null         // Display order (lower = first)
  createdAt: string                // ISO-8601
  versions:  GalleryPhotoVersion[]
}

interface GalleryPhotoVersion {
  id:          string
  versionType: string         // "webp_thumb" | "webp_medium" | "webp_full"
  url:         string         // Direct URL to the stored file
  mimeType:    string         // "image/webp"
  width:       number | null
  height:      number | null
  sizeBytes:   number | null
}

Version types

versionTypeMax dimensionBest for
webp_thumb400px wideGrid thumbnails, cards
webp_medium1200px wideDetail views, lightbox
webp_full2400px wideDownloads, large displays
See Photo Versions for the full guide.

Example

grid.ts
const photos = await client.getPhotos()

// Render a grid using thumbs
for (const photo of photos) {
  const thumb = photo.versions.find(v => v.versionType === "webp_thumb")
  if (thumb) renderThumbnail(thumb.url, thumb.width, thumb.height)
}

// Pick the largest available version for a lightbox
function getLightboxUrl(photo: GalleryPhoto): string {
  const full   = photo.versions.find(v => v.versionType === "webp_full")
  const medium = photo.versions.find(v => v.versionType === "webp_medium")
  return (full ?? medium)?.url ?? ""
}

Errors

StatusCodeCause
401UNAUTHORIZEDToken missing, invalid, revoked, or expired
500INTERNAL_ERRORServer error