Passer à la navigation

Create Asset

Register a media URL as a reusable asset and get back its id. Use the id as input[].assetId in a generation or as a voice clone sample.

To add a local file, get an upload URL from POST /v2/assets/upload, PUT the file there, then register the returned url here. Registration checks that the upload exists and applies your plan’s file size limit.

projectId is optional. An id that isn’t a project in your organization returns 422 project_not_found.

A link to a single TikTok, Instagram, Facebook, or YouTube video is imported instead. It returns 409 import_in_progress until the download finishes; send the same request again after Retry-After to get the VIDEO asset, named after the video. Import errors are listed in Asset Uploads.

Authentification

x-api-keystring
Authentification par clé API via en-tête

Requête

This endpoint expects an object.
urlstringRequis

The public URL of the media to register — e.g. the url returned by POST /v2/assets/upload. Registration verifies the upload happened and enforces plan limits on the actual file size. A link to a single TikTok, Instagram, Facebook, or YouTube video is imported as a VIDEO asset instead.

typeenumRequis
The type of asset.
Valeurs autorisées:
namestringOptionnel
An optional display name for the asset.
visibilityenumOptionnelPar défaut USER
Who can see the asset. Defaults to USER.
Valeurs autorisées:
projectIdstringOptionnel

Optionally attach the asset to a project (created via POST /v2/projects) so it appears in Studio under that project’s media. Must reference a project in your organization — otherwise the request is rejected with 422.

inputTypeenumOptionnel
The source of the asset.
thumbnailUrlstring or nullOptionnel
Optional thumbnail URL for the asset.
sizelongOptionnel
File size in bytes.
formatstringOptionnel
File format or extension.
durationSecondsdoubleOptionnel
Media duration in seconds.
widthintegerOptionnel
Width in pixels for video or image assets.
heightintegerOptionnel
Height in pixels for video or image assets.
contentSha256stringOptionnelformat: "^[a-f0-9]{64}$"

SHA-256 digest of the file’s bytes, as 64 lowercase hex characters.

Réponse

Asset registered successfully
idstring
A unique identifier for an asset.
createdAtdatetime
The date and time the asset was created.
updatedAtdatetime
The date and time the asset was last updated.
typeenum
The type of asset file.
Valeurs autorisées:
visibilityenum
Visibility scope for the asset.
Valeurs autorisées:
namestringOptionnel
The filename of the asset.
urlstringOptionnel
The URL to access the asset media.
sizelongOptionnel
File size in bytes.
formatstringOptionnel

File format/extension (e.g., “mp4”, “wav”).

inputTypeenumOptionnel
The source type of the asset.
durationSecondsdoubleOptionnel

Duration of the media in seconds (for audio/video).

thumbnailUrlstringOptionnel
URL to the asset's thumbnail image.
widthintegerOptionnel

Width in pixels (for video/image).

heightintegerOptionnel

Height in pixels (for video/image).

projectIdstringOptionnel
The id of the project this asset is attached to, or null when it belongs to no project.
proxyPathstring or nullOptionnel
Stable API proxy path for authenticated media playback.

Erreurs

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
409
Link Import IN Progress Error
422
Unprocessable Entity Error
429
Link Import Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error