# Uploads ## Create `uploads.create(UploadCreateParams**kwargs) -> UploadCreateResponse` **post** `/uploads` Create a temporary upload URL for a file. Support multipart uploads. Return a list of URLs for each part of the file. ### Parameters - `asset_options: Optional[AssetOptions]` Asset extra options. Only available for kinds which produce an asset. (Not available for model kind) - `collection_ids: Optional[Sequence[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `civitai_model_url: Optional[str]` The civitai.com url of the model (example: "https://civitai.com/models/370194/translucent-subsurface-scattering-test?modelVersionId=413566"). - `content_type: Optional[str]` Required for multipart upload. The MIME type of the file (example: "image/jpeg") - `file_name: Optional[str]` Required for multipart upload. The original file name of the image (example: "low-res-image.jpg"). It will be ignored if assetId is provided. - `file_size: Optional[float]` Required for multipart upload. The size of the file in bytes - `hugging_face_model_name: Optional[str]` The huggingface.co modelName (example: "stabilityai/stable-diffusion-xl-base-1.0"). No need to setup other fields if you setup huggingFaceModelName - `kind: Optional[Literal["3d", "asset", "audio", 4 more]]` Required for multipart upload and url. The purpose of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `parts: Optional[float]` Required for multipart upload. The number of parts the file will be uploaded in - `url: Optional[str]` The url where to download the file. If you setup url you MUST setup kind as well. ### Returns - `class UploadCreateResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]` ### 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 ) upload = client.uploads.create() print(upload.upload) ``` #### Response ```json { "upload": { "id": "id", "authorId": "authorId", "createdAt": "createdAt", "fileName": "fileName", "kind": "3d", "ownerId": "ownerId", "source": "civitai", "status": "complete", "updatedAt": "updatedAt", "assetOptions": { "collectionIds": [ "string" ], "hide": true, "parentId": "parentId" }, "config": {}, "contentType": "contentType", "entityId": "entityId", "errorMessage": "errorMessage", "fileSize": 0, "jobId": "jobId", "originalFileName": "originalFileName", "parts": [ { "expires": "expires", "number": 0, "url": "url" } ], "partsCount": 0, "provider": "civitai", "url": "url" } } ``` ## Retrieve `uploads.retrieve(strupload_id) -> UploadRetrieveResponse` **get** `/uploads/{uploadId}` Get the details of an existing upload ### Parameters - `upload_id: str` ### Returns - `class UploadRetrieveResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]` ### 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 ) upload = client.uploads.retrieve( "uploadId", ) print(upload.upload) ``` #### Response ```json { "upload": { "id": "id", "authorId": "authorId", "createdAt": "createdAt", "fileName": "fileName", "kind": "3d", "ownerId": "ownerId", "source": "civitai", "status": "complete", "updatedAt": "updatedAt", "assetOptions": { "collectionIds": [ "string" ], "hide": true, "parentId": "parentId" }, "config": {}, "contentType": "contentType", "entityId": "entityId", "errorMessage": "errorMessage", "fileSize": 0, "jobId": "jobId", "originalFileName": "originalFileName", "parts": [ { "expires": "expires", "number": 0, "url": "url" } ], "partsCount": 0, "provider": "civitai", "url": "url" } } ``` ## Trigger Action `uploads.trigger_action(strupload_id, UploadTriggerActionParams**kwargs) -> UploadTriggerActionResponse` **post** `/uploads/{uploadId}/action` Trigger an action on upload ### Parameters - `upload_id: str` - `action: Literal["complete"]` The action to perform on an upload, currently only "upload-complete" is supported - `"complete"` ### Returns - `class UploadTriggerActionResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]` ### 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 ) response = client.uploads.trigger_action( upload_id="uploadId", action="complete", ) print(response.upload) ``` #### Response ```json { "upload": { "id": "id", "authorId": "authorId", "createdAt": "createdAt", "fileName": "fileName", "kind": "3d", "ownerId": "ownerId", "source": "civitai", "status": "complete", "updatedAt": "updatedAt", "assetOptions": { "collectionIds": [ "string" ], "hide": true, "parentId": "parentId" }, "config": {}, "contentType": "contentType", "entityId": "entityId", "errorMessage": "errorMessage", "fileSize": 0, "jobId": "jobId", "originalFileName": "originalFileName", "parts": [ { "expires": "expires", "number": 0, "url": "url" } ], "partsCount": 0, "provider": "civitai", "url": "url" } } ``` ## Domain Types ### Upload Create Response - `class UploadCreateResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]` ### Upload Retrieve Response - `class UploadRetrieveResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]` ### Upload Trigger Action Response - `class UploadTriggerActionResponse: …` - `upload: Upload` - `id: str` - `author_id: str` - `created_at: str` - `file_name: str` - `kind: Literal["3d", "asset", "audio", 4 more]` The kind of the file once validated (example: "model") - `"3d"` - `"asset"` - `"audio"` - `"avatar"` - `"image"` - `"model"` - `"video"` - `owner_id: str` - `source: Literal["civitai", "huggingface", "multipart", 2 more]` - `"civitai"` - `"huggingface"` - `"multipart"` - `"other"` - `"url"` - `status: Literal["complete", "failed", "imported", 3 more]` - `"complete"` - `"failed"` - `"imported"` - `"pending"` - `"validated"` - `"validating"` - `updated_at: str` - `asset_options: Optional[UploadAssetOptions]` - `collection_ids: Optional[List[str]]` The collection ids to add the asset to. - `hide: Optional[bool]` Specify if the asset should be hidden from the user. - `parent_id: Optional[str]` The parentId of the asset. - `config: Optional[object]` - `content_type: Optional[str]` - `entity_id: Optional[str]` - `error_message: Optional[str]` - `file_size: Optional[float]` - `job_id: Optional[str]` - `original_file_name: Optional[str]` - `parts: Optional[List[UploadPart]]` - `expires: str` - `number: float` - `url: str` - `parts_count: Optional[float]` - `provider: Optional[Literal["civitai", "huggingface", "other"]]` - `"civitai"` - `"huggingface"` - `"other"` - `url: Optional[str]`