{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-assets-v1-lookup-assets-by-field-request-schema.json",
  "title": "LookupAssetsByFieldRequest",
  "description": "The parameters for `LookupAssetsByField`",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/safetyculture-assets-api-openapi.yml#/components/schemas/s12.assets.v1.LookupAssetsByFieldRequest",
  "type": "object",
  "properties": {
    "page_token": {
      "type": "string",
      "description": "OPTIONAL. The value of next_page_token from a previous response. If\nspecified, the API will return the next batch of results following the\nprevious list assets request."
    },
    "page_size": {
      "type": "integer",
      "format": "int32",
      "description": "OPTIONAL. The number of assets to return. By default, each request\nreturns 50 assets. You can specify a page_size value between 1 to 100."
    },
    "asset_filters": {
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/s12.assets.v1.AssetFilter"
      },
      "description": "OPTIONAL. The array of asset filters to apply in your request. You can\napply multiple filters in a single request."
    },
    "order_by": {
      "description": "OPTIONAL. The sorting order for the assets in the response. By default,\nassets are sorted by creation date from the most recent to the least\nrecent.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.assets.v1.AssetsOrderBy"
        }
      ]
    },
    "field_name": {
      "type": "string",
      "description": "REQUIRED. The name of the asset field to match."
    },
    "string_value": {
      "type": "string",
      "description": "REQUIRED. The string value of the asset field to match."
    }
  },
  "required": [
    "field_name"
  ],
  "$defs": {
    "s12.assets.v1.AssetFilter": {
      "type": "object",
      "properties": {
        "site_id": {
          "type": "string",
          "description": "The unique identifier of the assigned site to filter by."
        },
        "state": {
          "description": "The asset state to filter by. Either active or archived.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.assets.v1.AssetState"
            }
          ]
        },
        "type_id": {
          "type": "string",
          "description": "The unique identifier of the asset type to filter by."
        },
        "asset_id": {
          "type": "string",
          "description": "The unique identifier of the asset to filter by."
        },
        "asset_code": {
          "type": "string",
          "description": "The user-defined unique identifier id of the asset to filter by."
        },
        "motion_status": {
          "allOf": [
            {
              "$ref": "#/$defs/s12.assets.v1.MotionStatus"
            }
          ],
          "description": "The motion status filter used for filtering connected assets"
        },
        "location_source": {
          "allOf": [
            {
              "$ref": "#/$defs/s12.assets.v1.AssetLocationSource"
            }
          ],
          "description": "The location source filter used for filtering where the location was updated"
        },
        "status_option": {
          "description": "Filter by status option id, or by \"not set\" (assets with no active\nstatus option).",
          "allOf": [
            {
              "$ref": "#/$defs/s12.assets.v1.AssetStatusOptionFilter"
            }
          ]
        }
      },
      "description": "Describes the filter options for the list assets endpoint.."
    },
    "s12.assets.v1.AssetLocationSource": {
      "type": "string",
      "enum": [
        "ASSET_LOCATION_SOURCE_UNSPECIFIED",
        "ASSET_LOCATION_SOURCE_INSPECTION",
        "ASSET_LOCATION_SOURCE_GEO",
        "ASSET_LOCATION_SOURCE_MOBILE_DEVICE"
      ],
      "default": "ASSET_LOCATION_SOURCE_UNSPECIFIED",
      "description": "Describes the source of asset location.\n\n - ASSET_LOCATION_SOURCE_UNSPECIFIED: Indicates that the source of asset location is unspecified.\n - ASSET_LOCATION_SOURCE_INSPECTION: Indicates that the source of asset location is inspection.\n - ASSET_LOCATION_SOURCE_GEO: Indicates that the source is GEO location.\n - ASSET_LOCATION_SOURCE_MOBILE_DEVICE: Indicates that the source is mobile device location."
    },
    "s12.assets.v1.AssetState": {
      "type": "string",
      "enum": [
        "ASSET_STATE_UNSPECIFIED",
        "ASSET_STATE_ACTIVE",
        "ASSET_STATE_ARCHIVED"
      ],
      "default": "ASSET_STATE_UNSPECIFIED",
      "description": "Describes the state of an asset. Either active or archived.\n\n - ASSET_STATE_UNSPECIFIED: Indicates that an asset state is unspecified.\n - ASSET_STATE_ACTIVE: Indicates that an asset is active.\n - ASSET_STATE_ARCHIVED: Indicates that an asset is archived."
    },
    "s12.assets.v1.AssetStatusOptionFilter": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Match assets whose active status option is this id."
        },
        "not_set": {
          "type": "boolean",
          "description": "Match assets that have no active status option set."
        }
      },
      "description": "Describes a status option filter matching either a specific status option\nor assets with no status set."
    },
    "s12.assets.v1.AssetsOrderBy": {
      "type": "object",
      "properties": {
        "sort_field": {
          "description": "The field to sort by.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.assets.v1.AssetsOrderBy.SortField"
            }
          ]
        },
        "sort_direction": {
          "description": "The order to sort by.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.common.SortDirection"
            }
          ]
        },
        "field_id": {
          "type": "string",
          "description": "Field_id is required while sorting by an asset-field\ni.e., When SortField = SORT_FIELD_ASSET_FIELD."
        }
      },
      "description": "Describes the sorting options for the list assets endpoint. By default,\nassets are sorted by creation date from the most recent to the least recent."
    },
    "s12.assets.v1.AssetsOrderBy.SortField": {
      "type": "string",
      "enum": [
        "SORT_FIELD_UNSPECIFIED",
        "SORT_FIELD_CREATED_AT",
        "SORT_FIELD_MODIFIED_AT",
        "SORT_FIELD_CODE",
        "SORT_FIELD_ASSET_FIELD",
        "SORT_FIELD_INSPECTED_AT",
        "SORT_FIELD_STATUS_OPTION_NAME"
      ],
      "default": "SORT_FIELD_UNSPECIFIED",
      "description": "Defaults to SORT_FIELD_CODE.\n\n - SORT_FIELD_UNSPECIFIED: The sort field is unspecified.\n - SORT_FIELD_CREATED_AT: Sort assets by `created_at`.\n - SORT_FIELD_MODIFIED_AT: Sort assets by `modified_at`.\n - SORT_FIELD_CODE: Sort assets by `code`.\n - SORT_FIELD_ASSET_FIELD: Sort assets by an asset-field.\n - SORT_FIELD_INSPECTED_AT: Sort assets by `inspected_at`.\n - SORT_FIELD_STATUS_OPTION_NAME: Sort assets by status option name (alphabetical)."
    },
    "s12.assets.v1.MotionStatus": {
      "type": "string",
      "enum": [
        "LOCATION_MOTION_STATUS_UNSPECIFIED",
        "LOCATION_MOTION_STATUS_PARKED",
        "LOCATION_MOTION_STATUS_IDLING",
        "LOCATION_MOTION_STATUS_MOVING",
        "LOCATION_MOTION_STATUS_OFFLINE"
      ],
      "default": "LOCATION_MOTION_STATUS_UNSPECIFIED",
      "description": "Status of the motion.\n\n - LOCATION_MOTION_STATUS_UNSPECIFIED: Indicates the status of the motion is unspecified.\n - LOCATION_MOTION_STATUS_PARKED: Indicates the status of the motion is parked.\n - LOCATION_MOTION_STATUS_IDLING: Indicates the status of the motion is idling.\n - LOCATION_MOTION_STATUS_MOVING: Indicates the status of the motion is moving.\n - LOCATION_MOTION_STATUS_OFFLINE: Indicates the offline status of the telematic device"
    },
    "s12.common.SortDirection": {
      "type": "string",
      "enum": [
        "SORT_DIRECTION_UNSPECIFIED",
        "SORT_DIRECTION_ASC",
        "SORT_DIRECTION_DESC"
      ],
      "default": "SORT_DIRECTION_UNSPECIFIED",
      "title": "Common set of sorting directions as used by lists"
    }
  }
}