> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gumnut.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Check asset existence

> Checks which assets exist in the user's library based on checksums or device identifiers. Provide exactly one of: checksums, checksum_sha1s, or (deviceId AND deviceAssetIds). List parameters are limited to 5000 items.



## OpenAPI

````yaml https://api.gumnut.ai/openapi.json post /api/assets/exist
openapi: 3.1.0
info:
  title: Gumnut API
  description: >-
    The Gumnut API manages photo and video libraries: upload and organize
    assets, search by content, group detected faces into people, and curate
    albums and stacks.


    Headless clients authenticate by sending either a Gumnut API key
    (`apikey_...`) or an OAuth access token as a Bearer token in the
    `Authorization` header. The Gumnut web and mobile apps sign in with a
    first-party session (Clerk session JWT) instead, which is also the only
    credential that can manage API keys.
  contact:
    name: Gumnut
    url: https://www.gumnut.ai/contact
  version: 1.0.0
servers:
  - url: https://api.gumnut.ai
    description: Production
security:
  - apiKeyAuth: []
  - oauthJwtAuth: []
tags:
  - name: assets
    description: >-
      Photos and videos in a library: upload, list and filter, update metadata,
      trash and restore.
  - name: search
    description: >-
      Content-based search over a library's assets, with the same filters as
      asset listing.
  - name: albums
    description: User-curated collections of assets.
  - name: album-assets
    description: Link records connecting albums to their member assets.
  - name: stacks
    description: >-
      Groups of related shots of the same moment, presented as a single unit
      with a cover asset.
  - name: people
    description: Named people, each built from clustered faces.
  - name: faces
    description: Detected faces and their assignment to people.
  - name: libraries
    description: Top-level containers that own assets, albums, people, and everything else.
  - name: events
    description: Change-event feed for keeping client state in sync.
  - name: tasks
    description: Status of background processing tasks.
  - name: users
    description: The authenticated user's profile.
  - name: api-keys
    description: >-
      Create and manage Gumnut API keys. Requires a first-party Gumnut app
      session — API keys and OAuth tokens cannot manage credentials.
  - name: oauth
    description: OAuth flow endpoints for obtaining and refreshing access tokens.
  - name: server
    description: Service health.
paths:
  /api/assets/exist:
    post:
      tags:
        - assets
      summary: Check asset existence
      description: >-
        Checks which assets exist in the user's library based on checksums or
        device identifiers. Provide exactly one of: checksums, checksum_sha1s,
        or (deviceId AND deviceAssetIds). List parameters are limited to 5000
        items.
      operationId: check_asset_existence
      parameters:
        - name: library_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Library to check assets in. Optional if the user has a single live
              (non-trashed) library; required when they have multiple.
            title: Library Id
          description: >-
            Library to check assets in. Optional if the user has a single live
            (non-trashed) library; required when they have multiple.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssetExistenceRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetExistenceResponse'
        '401':
          description: Missing, invalid, or expired credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            The credentials are valid but not authorized for this operation —
            for example an API key whose action or library scope excludes it, or
            a credential type this operation does not accept.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limit exceeded. Retry after the interval in the `Retry-After`
            header.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AssetExistenceRequest:
      properties:
        checksums:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Checksums
          description: List of base64-encoded SHA-256 checksums to check for existence
        checksum_sha1s:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Checksum Sha1S
          description: List of base64-encoded SHA-1 checksums to check for existence
        deviceId:
          anyOf:
            - type: string
            - type: 'null'
          title: Deviceid
          description: Device ID to filter assets by (required with deviceAssetIds)
        deviceAssetIds:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Deviceassetids
          description: List of device asset IDs to check for existence (requires deviceId)
      type: object
      title: AssetExistenceRequest
      description: Request body for checking asset existence.
    AssetExistenceResponse:
      properties:
        assets:
          items:
            $ref: '#/components/schemas/AssetLiteResponse'
          type: array
          title: Assets
          description: List of assets matching the query criteria
      type: object
      required:
        - assets
      title: AssetExistenceResponse
      description: Response for asset existence check endpoint.
    ErrorResponse:
      title: ErrorResponse
      type: object
      properties:
        detail:
          title: Detail
          type: string
          description: Human-readable explanation of the error.
      required:
        - detail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AssetLiteResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique asset identifier with 'asset_' prefix
        device_asset_id:
          type: string
          title: Device Asset Id
          description: Original asset identifier from the device that uploaded this asset
        device_id:
          type: string
          title: Device Id
          description: Identifier of the device that uploaded this asset
        checksum:
          type: string
          title: Checksum
          description: >-
            Base64-encoded SHA-256 hash of the asset contents for duplicate
            detection and integrity
        checksum_sha1:
          anyOf:
            - type: string
            - type: 'null'
          title: Checksum Sha1
          description: >-
            Base64-encoded SHA-1 hash of the asset contents. May be null for
            older assets.
      type: object
      required:
        - id
        - device_asset_id
        - device_id
        - checksum
      title: AssetLiteResponse
      description: Lightweight asset response for existence checks.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Gumnut API key (`apikey_...`) sent as a Bearer token in the
        `Authorization` header. Create and manage keys in the Gumnut app, or
        with the API key endpoints while signed in to it.
    oauthJwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Short-lived JWT obtained from the OAuth token exchange, sent as a Bearer
        token in the `Authorization` header.

````