Assets
Assets are images, video, audi, and text that you can use to build your videos. We'll look at how to query, upload, update, and delete assets.
The asset model
The asset model has the following properties:
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the Asset.
- Name
keyname
- Type
- string
- Description
Unique key used to generate and adjust the asset without an API key.
- Name
url
- Type
- string
- Description
URL to embed the asset if generation is complete.
- Name
download_url
- Type
- string
- Description
URL to download the file if generation is complete.
- Name
asset_path
- Type
- string
- Description
Path to the asset in the storage bucket.
- Name
asset_type
- Type
- string
- Description
The type of asset generated.
- Name
created_at
- Type
- timestamp
- Description
Timestamp of when the asset was created.
- Name
status
- Type
- string
- Description
Status of the asset generation. Null if the asset is uploaded.
- Name
uploaded
- Type
- boolean
- Description
True if the asset is uploaded.
List all assets
This endpoint allows you to retrieve a paginated list of all your assets for a project. By default, a maximum of ten attachments are shown per page.
Optional attributes
- Name
limit
- Type
- integer
- Description
Limit the number of Assets returned.
Request
from videojungle import ApiClient
client = ApiClient(token)
client.assets.list()
Response
[
{
"id": "e7cdb22b-2dd4-4e05-b05e-1ba1dc874af6",
"keyname": "9594f44b-769f-4331-b8ff-b5a8b80d9725",
"url": "https://video-jungles.s3.us-east-1.amazonaws.com/612afec9-bcb2-47ca-807b-756d6e83b4b7/9c5e9ddd-2b99-49a5-9188-9dc10e06de67/9594f44b-769f-4331-b8ff-b5a8b80d9725?AWSAccessKeyId=AKIAQJX2XANMJM4ARNVV&Signature=%2FOw3yuebm68rDl7FXONpASVC5oA%3D&Expires=1716907275",
"download_url": "https://video-jungles.s3.us-east-1.amazonaws.com/612afec9-bcb2-47ca-807b-756d6e83b4b7/9c5e9ddd-2b99-49a5-9188-9dc10e06de67/9594f44b-769f-4331-b8ff-b5a8b80d9725?response-content-disposition=attachment%3B%20filename%3Dhoroscope-2024-03-07T14%3A30%3A17.942088.mp4&AWSAccessKeyId=AKIAQJX2XANMJM4ARNVV&Signature=jxuLXF7uaWKVeob0LieQm5KzU5Q%3D&Expires=1716907275",
"asset_path": null,
"asset_type": "finished_video",
"created_at": "2024-03-07T14:30:17.942088",
"status": null,
"uploaded": false
}
]
Generate an Asset
This endpoint allows you to run a script to generate an asset. This endpoint uses a script to generate the final asset, and may take in parameters to set custom inputs.
Required attributes
- Name
q
- Type
- query parameter
- Description
Parameters necessary for the script generation. These depend on the script being run.
Optional attributes
- Name
prompt
- Type
- str
- Description
The prompt to generate the asset from. Use this to test out changes to your script.
- Name
prompt_persona
- Type
- str
- Description
The persona to generate prompt for the asset from.
Request
from videojungle import ApiClient
client = ApiClient(token)
client.project.create({ "date": "2024-05-29", "horoscope": "aries", "seed": 42 })
Response
{
"url": "https://presigned_upload_url/with_keys",
"asset_id": "ffff-ffff-ffff-ffff",
"asset_key": "ffff-ffff-ffff-ffff"
}
Retrieve an asset
Get an asset using its asset id key.
Request
from videojungle import ApiClient
client = ApiClient(token)
client.project.assets.get("Nc6yKKMpcxiiFxp6")
Response
{
"asset_path": null,
"id": "07f0af3e-63ae-447b-b790-c8b535f93b7c",
"created_at": "2024-05-29T17:53:31.542046",
"key": "756a7f80-8dec-4b50-a32d-53d5703761dc",
"project_id": "9c5e9ddd-2b99-49a5-9188-9dc10e06de67",
"keyname": "ca8e8db3-a7a2-45d7-8dcb-9fe4ce88a00f",
"asset_type": "generated_video",
"status": "uploaded",
"uploaded": true,
"project": {
"data": "",
"name": "horoscope",
"id": "9c5e9ddd-2b99-49a5-9188-9dc10e06de67",
"description": null,
"created_at": "2024-01-18T01:59:24.936952",
"owner_id": "612afec9-bcb2-47ca-807b-756d6e83b4b7"
}
}
Check an Asset
Check if the asset has been created and successfully uploaded yet.
Request
from videojungle import ApiClient
client = ApiClient(token)
client.assets.check("Nc6yKKMpcxiiFxp6")
Response
{"uploaded": true}
Delete an Asset
This endpoint allows you to delete attachments. Note: This will permanently delete the file.
Request
from videojungle import ApiClient
client = ApiClient(token)
client.assets.delete("Nc6yKKMpcxiiFxp6")