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

# Fields, values, counts and ranges for a query



## OpenAPI

````yaml /api-reference/openapi.json get /assets/facets
openapi: 3.1.0
info:
  title: Patch API
  version: 1.0.0
  description: >-
    The public API behind patch.gg, the desktop app and pch. Changes within v1
    are additive only. Errors are { error: { code, message, details } }; branch
    on code.
servers:
  - url: https://patch.gg/api/v1
security: []
paths:
  /assets/facets:
    get:
      tags:
        - Assets
      summary: Fields, values, counts and ranges for a query
      parameters:
        - schema:
            type: string
            maxLength: 200
            description: Text to search for
            example: crate
          required: false
          description: Text to search for
          name: q
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: Asset types (repeat or comma-separate)
            example: model
          required: false
          description: Asset types (repeat or comma-separate)
          name: type
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: Source ids or names, e.g. polyhaven
          required: false
          description: Source ids or names, e.g. polyhaven
          name: source
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: SPDX ids, or "safe" (every license in the registry; the default)
          required: false
          description: SPDX ids, or "safe" (every license in the registry; the default)
          name: license
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: >-
              Capabilities the asset must keep on the runtime, e.g. collision (a
              higher one counts)
          required: false
          description: >-
            Capabilities the asset must keep on the runtime, e.g. collision (a
            higher one counts)
          name: cap
          in: query
        - schema:
            type: string
            description: Runtime the capabilities and variants are for
            example: patch-web@1
          required: false
          description: Runtime the capabilities and variants are for
          name: runtime
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: indexed, converting, ready or failed (failed is hidden by default)
          required: false
          description: indexed, converting, ready or failed (failed is hidden by default)
          name: prep
          in: query
        - schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: >-
              Filters on facets, field<op>value: "triangles<=5000", "texture_px
              between 512,2048", "cap has collision". Repeat for several.
          required: false
          description: >-
            Filters on facets, field<op>value: "triangles<=5000", "texture_px
            between 512,2048", "cap has collision". Repeat for several.
          name: where
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
            description: Only AI-generated, or none
          required: false
          description: Only AI-generated, or none
          name: ai
          in: query
      responses:
        '200':
          description: Facets
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetFacets'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AssetFacets:
      type: object
      properties:
        total:
          type: number
        runtime:
          type: string
        global:
          type: object
          properties:
            type:
              type: object
              additionalProperties:
                type: number
            source:
              type: object
              additionalProperties:
                type: number
            license:
              type: object
              additionalProperties:
                type: number
            prep:
              type: object
              additionalProperties:
                type: number
            ai:
              type: object
              additionalProperties:
                type: number
          required:
            - type
            - source
            - license
            - prep
            - ai
        types:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              label:
                type: string
              count:
                type: number
              folder:
                type: string
              fields:
                type: array
                items:
                  type: object
                  properties:
                    f:
                      type: string
                    label:
                      type: string
                    kind:
                      type: string
                      enum:
                        - number
                        - enum
                        - bool
                    unit:
                      type: string
                    count:
                      type: number
                    counts:
                      type: object
                      additionalProperties:
                        type: number
                    range:
                      type: array
                      prefixItems:
                        - type: number
                        - type: number
                  required:
                    - f
                    - label
                    - kind
                    - count
              capabilities:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    label:
                      type: string
                    count:
                      type: number
                    supported:
                      type: boolean
                  required:
                    - id
                    - label
                    - count
                    - supported
              traits:
                type: object
                additionalProperties:
                  type: number
            required:
              - type
              - label
              - count
              - folder
              - fields
              - capabilities
              - traits
        ops:
          type: array
          items:
            type: string
        where_forms:
          type: array
          items:
            type: string
        unapplied:
          type: array
          items:
            type: string
      required:
        - total
        - runtime
        - global
        - types
        - ops
        - where_forms
        - unapplied
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.