Skip to content
Get started

Trigger Action

client.uploads.triggerAction(stringuploadID, UploadTriggerActionParams { action } body, RequestOptionsoptions?): UploadTriggerActionResponse { upload }
POST/uploads/{uploadId}/action

Trigger an action on upload

ParametersExpand Collapse
uploadID: string
body: UploadTriggerActionParams { action }
action: "complete"

The action to perform on an upload, currently only “upload-complete” is supported

ReturnsExpand Collapse
UploadTriggerActionResponse { upload }
upload: Upload { id, authorId, createdAt, 18 more }
id: string
authorId: string
createdAt: string
fileName: string
kind: "3d" | "asset" | "audio" | 4 more

The kind of the file once validated (example: “model”)

One of the following:
"3d"
"asset"
"audio"
"avatar"
"image"
"model"
"video"
ownerId: string
source: "civitai" | "huggingface" | "multipart" | 2 more
One of the following:
"civitai"
"huggingface"
"multipart"
"other"
"url"
status: "complete" | "failed" | "imported" | 3 more
One of the following:
"complete"
"failed"
"imported"
"pending"
"validated"
"validating"
updatedAt: string
assetOptions?: AssetOptions { collectionIds, hide, parentId }
collectionIds?: Array<string>

The collection ids to add the asset to.

hide?: boolean

Specify if the asset should be hidden from the user.

parentId?: string

The parentId of the asset.

config?: unknown
contentType?: string
entityId?: string
errorMessage?: string
fileSize?: number
jobId?: string
originalFileName?: string
parts?: Array<Part>
expires: string
number: number
url: string
partsCount?: number
provider?: "civitai" | "huggingface" | "other"
One of the following:
"civitai"
"huggingface"
"other"
url?: string

Trigger Action

import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const response = await client.uploads.triggerAction('uploadId', { action: 'complete' });

console.log(response.upload);
{
  "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"
  }
}
Returns Examples
{
  "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"
  }
}