# Search ## Asset Search `search.asset_search(SearchAssetSearchParams**kwargs) -> SyncSearchHitsOffset[SearchAssetSearchResponse]` **post** `/search/assets` Search for assets. At least one of the following fields must have a value: `query`, `filter`, `image`, or `images`. `image`, `images` are mutually exclusive. ### Parameters - `original_assets: Optional[bool]` If set to true, returns the original asset without transformation - `filter: Optional[str]` Filter queries by an attribute's value - `hits_per_page: Optional[float]` Maximum number of documents returned for a page. Must be used with `page`. - `image: Optional[str]` Search for similar images with `image` as a reference. Must be an existing `AssetId` or a valid data URL. - `images: Optional[Images]` Search for similar images with `images.like` and `images.unlike` as a reference Must be arrays of existing `AssetId` or valid data URLs. - `like: Optional[Sequence[str]]` Search for similar images with `images.like` as a reference. Must be an array of existing `AssetId` or valid data URLs. - `unlike: Optional[Sequence[str]]` Search for images that are not similar to `images.unlike` as a reference. Must be an array of existing `AssetId` or valid data URLs. - `image_semantic_ratio: Optional[float]` Image embedding ratio for hybrid search, applied when `image`, `images.like`, or `images.unlike` are provided - `limit: Optional[float]` Maximum number of documents returned. Must be used with `offset`. - `offset: Optional[float]` Number of documents to skip. Must be used with `limit`. Starts from 0. - `page: Optional[float]` Request a specific page of results. Must be used with `hitsPerPage`. - `public: Optional[bool]` Search for public images not necessarily belonging to the current `ownerId` - `query: Optional[str]` A string used for querying search results. - `query_semantic_ratio: Optional[float]` Query embedding for hybrid search, if possible - `sort_by: Optional[Sequence[str]]` Sort the search results by the given attributes. Each attribute in the list must be followed by a colon (`:`) and the preferred sorting order: either ascending (`asc`) or descending (`desc`). Example: `['createdAt:desc']` ### Returns - `class SearchAssetSearchResponse: …` - `id: str` Unique identifier for the asset (e.g., "asset_GTrL3mq4SXWyMxkOHRxlpw") - `author_id: str` User ID of the asset creator/author - `collection_ids: List[str]` Array of collection IDs this asset belongs to - `created_at: str` Creation timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `metadata: Metadata` Metadata containing detailed information about the asset's properties and generation parameters - `aspect_ratio: Optional[str]` Aspect ratio of the asset (e.g., "1:1", "16:9") - `base_model_id: Optional[str]` ID of the base model used for generation - `guidance: Optional[float]` Guidance scale used for diffusion models to control prompt adherence - `height: Optional[float]` Height of the asset in pixels - `kind: Optional[str]` Classification of the asset (e.g., "image", "video") - `model_id: Optional[str]` ID of the specific model used if asset is model-based - `model_type: Optional[str]` Type of model used for generation (e.g., "sd-1_5", "flux.1") - `name: Optional[str]` Custom name given to the asset - `negative_prompt: Optional[str]` Negative prompt used during generation to specify what to avoid - `negative_prompt_strength: Optional[float]` For Flux models: controls the influence of the negative prompt - `num_inference_steps: Optional[float]` Number of inference steps used during generation - `parent_job_id: Optional[str]` ID of the parent job that created this asset - `prompt: Optional[str]` Text prompt used to generate the asset - `scheduler: Optional[str]` Scheduler algorithm used during generation - `seed: Optional[str]` Random seed used for generation, enables reproducibility - `size: Optional[float]` File size of the asset in bytes - `text: Optional[str]` Text used to generate the asset: mainly for speech to text - `thumbnail: Optional[MetadataThumbnail]` Thumbnail image information for the asset. Ex. Canvas thumbnail - `asset_id: str` ID of the asset used as thumbnail - `type: Optional[str]` Specific type/category of the asset (e.g., "canvas", "inference-txt") - `width: Optional[float]` Width of the asset in pixels - `mime_type: str` MIME type of the asset (e.g., "image/png", "image/jpeg") - `nsfw: List[str]` Array of detected NSFW categories - `owner_id: str` Project ID of the asset owner - `privacy: str` Privacy setting of the asset ("public", "private", or "unlisted") - `tags: List[str]` Array of user-assigned tags for categorization - `team_id: str` Team ID of the asset owner - `updated_at: str` Last modification timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `url: str` Signed URL of the asset - `description: Optional[str]` Textual description of the asset. Can be either: - User-provided description for training images - Automatically generated caption for images and videos assets - Automatically generated description for audio assets - `score: Optional[float]` Score assigned to the asset based on usage and popularity - `thumbnail: Optional[Thumbnail]` Thumbnail preview of the asset 3D, video... - `asset_id: str` ID of the asset used as thumbnail - `url: str` Signed URL of the thumbnail - `transcription: Optional[str]` Transcription of the asset. Can be either: - Automatically generated transcription for audio assets with speech ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) page = client.search.asset_search() page = page.hits[0] print(page.id) ``` #### Response ```json { "hits": [ { "id": "id", "authorId": "authorId", "collectionIds": [ "string" ], "createdAt": "createdAt", "metadata": { "aspectRatio": "aspectRatio", "baseModelId": "baseModelId", "guidance": 0, "height": 0, "kind": "kind", "modelId": "modelId", "modelType": "modelType", "name": "name", "negativePrompt": "negativePrompt", "negativePromptStrength": 0, "numInferenceSteps": 0, "parentJobId": "parentJobId", "prompt": "prompt", "scheduler": "scheduler", "seed": "seed", "size": 0, "text": "text", "thumbnail": { "assetId": "assetId" }, "type": "type", "width": 0 }, "mimeType": "mimeType", "nsfw": [ "string" ], "ownerId": "ownerId", "privacy": "privacy", "tags": [ "string" ], "teamId": "teamId", "updatedAt": "updatedAt", "url": "url", "description": "description", "score": 0, "thumbnail": { "assetId": "assetId", "url": "url" }, "transcription": "transcription" } ], "limit": 0, "offset": 0, "estimatedTotalHits": 0, "hitsPerPage": 0, "page": 0, "totalHits": 0, "totalPages": 0 } ``` ## Model Search `search.model_search(SearchModelSearchParams**kwargs) -> SyncSearchHitsOffset[SearchModelSearchResponse]` **post** `/search/models` Search for models. At least one of the following fields must have a value: `query`, `filter`, `image`, or `images`. `image`, and `images` are mutually exclusive. ### Parameters - `original_assets: Optional[bool]` If set to true, returns the original asset without transformation - `original_models: Optional[object]` - `filter: Optional[str]` Filter queries by an attribute's value - `hits_per_page: Optional[float]` Maximum number of documents returned for a page. Must be used with `page`. - `image: Optional[str]` Search for model with `image` as a reference Must be an existing `AssetId` or a valid data URL. - `images: Optional[Images]` Search for model with `images.like` and `images.unlike` as a reference Must be an array of existing `AssetId` or valid data URLs. - `like: Optional[Sequence[str]]` Search for model images with `images.like` as a reference Must be an array of existing `AssetId` or valid data URLs. - `unlike: Optional[Sequence[str]]` Search for model images that are not similar to `images.unlike` as a reference Must be an array of existing `AssetId` or valid data URLs. - `image_semantic_ratio: Optional[float]` Image embedding ratio for hybrid search, applied when `image`, `images.like`, or `images.unlike` are provided - `limit: Optional[float]` Maximum number of documents returned. Must be used with `offset`. - `offset: Optional[float]` Number of documents to skip. Must be used with `limit`. Starts from 0. - `page: Optional[float]` Request a specific page of results. Must be used with `hitsPerPage`. - `public: Optional[bool]` Search for public images not necessarily belonging to the current `ownerId` - `query: Optional[str]` A string used for querying search results. - `query_semantic_ratio: Optional[float]` Query embedding for hybrid search, if possible - `sort_by: Optional[Sequence[str]]` Sort the search results by the given attributes. Each attribute in the list must be followed by a colon (`:`) and the preferred sorting order: either ascending (`asc`) or descending (`desc`). Example: `['createdAt:desc']` ### Returns - `class SearchModelSearchResponse: …` - `id: str` Unique identifier for the model (e.g., "model_GTrL3mq4SXWyMxkOHRxlpw") - `author_id: str` User ID of the model creator/author - `capabilities: List[str]` Array of model capabilities - `collection_ids: List[str]` Array of collection IDs this model belongs to - `concepts: List[Concept]` Array of concept models associated with this model Each concept contains a reference to its source model - `model_id: str` ID of the concept's source model - `created_at: str` Creation timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `example_asset_ids: List[str]` Array of example asset IDs associated with this model - `name: str` Display name of the model - `owner_id: str` Project ID of the model owner - `privacy: str` Privacy setting of the model ("public", "private", or "unlisted") - `short_description: str` Short description of the model - `source: str` Source/origin of the model (e.g., "training", "import") - `tags: List[str]` Array of user-assigned tags for categorization - `team_id: str` Team ID of the model owner - `training_images_number: float` Number of images used to train this model - `type: str` Type of the model (e.g., "sd-1_5", "flux.1") - `updated_at: str` Last modification timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `parent_model_id: Optional[str]` ID of the parent model this model was derived from - `score: Optional[float]` Score assigned to the model based on usage and popularity - `thumbnail: Optional[Thumbnail]` Thumbnail image information for the model - `asset_id: str` ID of the asset used as thumbnail - `url: str` Signed URL of the thumbnail ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) page = client.search.model_search() page = page.hits[0] print(page.id) ``` #### Response ```json { "hits": [ { "id": "id", "authorId": "authorId", "capabilities": [ "string" ], "collectionIds": [ "string" ], "concepts": [ { "modelId": "modelId" } ], "createdAt": "createdAt", "exampleAssetIds": [ "string" ], "name": "name", "ownerId": "ownerId", "privacy": "privacy", "shortDescription": "shortDescription", "source": "source", "tags": [ "string" ], "teamId": "teamId", "trainingImagesNumber": 0, "type": "type", "updatedAt": "updatedAt", "parentModelId": "parentModelId", "score": 0, "thumbnail": { "assetId": "assetId", "url": "url" } } ], "limit": 0, "offset": 0, "estimatedTotalHits": 0, "hitsPerPage": 0, "page": 0, "totalHits": 0, "totalPages": 0 } ``` ## Domain Types ### Search Asset Search Response - `class SearchAssetSearchResponse: …` - `id: str` Unique identifier for the asset (e.g., "asset_GTrL3mq4SXWyMxkOHRxlpw") - `author_id: str` User ID of the asset creator/author - `collection_ids: List[str]` Array of collection IDs this asset belongs to - `created_at: str` Creation timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `metadata: Metadata` Metadata containing detailed information about the asset's properties and generation parameters - `aspect_ratio: Optional[str]` Aspect ratio of the asset (e.g., "1:1", "16:9") - `base_model_id: Optional[str]` ID of the base model used for generation - `guidance: Optional[float]` Guidance scale used for diffusion models to control prompt adherence - `height: Optional[float]` Height of the asset in pixels - `kind: Optional[str]` Classification of the asset (e.g., "image", "video") - `model_id: Optional[str]` ID of the specific model used if asset is model-based - `model_type: Optional[str]` Type of model used for generation (e.g., "sd-1_5", "flux.1") - `name: Optional[str]` Custom name given to the asset - `negative_prompt: Optional[str]` Negative prompt used during generation to specify what to avoid - `negative_prompt_strength: Optional[float]` For Flux models: controls the influence of the negative prompt - `num_inference_steps: Optional[float]` Number of inference steps used during generation - `parent_job_id: Optional[str]` ID of the parent job that created this asset - `prompt: Optional[str]` Text prompt used to generate the asset - `scheduler: Optional[str]` Scheduler algorithm used during generation - `seed: Optional[str]` Random seed used for generation, enables reproducibility - `size: Optional[float]` File size of the asset in bytes - `text: Optional[str]` Text used to generate the asset: mainly for speech to text - `thumbnail: Optional[MetadataThumbnail]` Thumbnail image information for the asset. Ex. Canvas thumbnail - `asset_id: str` ID of the asset used as thumbnail - `type: Optional[str]` Specific type/category of the asset (e.g., "canvas", "inference-txt") - `width: Optional[float]` Width of the asset in pixels - `mime_type: str` MIME type of the asset (e.g., "image/png", "image/jpeg") - `nsfw: List[str]` Array of detected NSFW categories - `owner_id: str` Project ID of the asset owner - `privacy: str` Privacy setting of the asset ("public", "private", or "unlisted") - `tags: List[str]` Array of user-assigned tags for categorization - `team_id: str` Team ID of the asset owner - `updated_at: str` Last modification timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `url: str` Signed URL of the asset - `description: Optional[str]` Textual description of the asset. Can be either: - User-provided description for training images - Automatically generated caption for images and videos assets - Automatically generated description for audio assets - `score: Optional[float]` Score assigned to the asset based on usage and popularity - `thumbnail: Optional[Thumbnail]` Thumbnail preview of the asset 3D, video... - `asset_id: str` ID of the asset used as thumbnail - `url: str` Signed URL of the thumbnail - `transcription: Optional[str]` Transcription of the asset. Can be either: - Automatically generated transcription for audio assets with speech ### Search Model Search Response - `class SearchModelSearchResponse: …` - `id: str` Unique identifier for the model (e.g., "model_GTrL3mq4SXWyMxkOHRxlpw") - `author_id: str` User ID of the model creator/author - `capabilities: List[str]` Array of model capabilities - `collection_ids: List[str]` Array of collection IDs this model belongs to - `concepts: List[Concept]` Array of concept models associated with this model Each concept contains a reference to its source model - `model_id: str` ID of the concept's source model - `created_at: str` Creation timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `example_asset_ids: List[str]` Array of example asset IDs associated with this model - `name: str` Display name of the model - `owner_id: str` Project ID of the model owner - `privacy: str` Privacy setting of the model ("public", "private", or "unlisted") - `short_description: str` Short description of the model - `source: str` Source/origin of the model (e.g., "training", "import") - `tags: List[str]` Array of user-assigned tags for categorization - `team_id: str` Team ID of the model owner - `training_images_number: float` Number of images used to train this model - `type: str` Type of the model (e.g., "sd-1_5", "flux.1") - `updated_at: str` Last modification timestamp in ISO 8601 format (e.g., "2025-01-16T11:19:41.579Z") - `parent_model_id: Optional[str]` ID of the parent model this model was derived from - `score: Optional[float]` Score assigned to the model based on usage and popularity - `thumbnail: Optional[Thumbnail]` Thumbnail image information for the model - `asset_id: str` ID of the asset used as thumbnail - `url: str` Signed URL of the thumbnail