Assets

Save a file to your asset library

Copies a file into the key's library (your personal library, or the team's shared library for a team key), where it is kept until it is deleted, the owner closes the account or the team is deleted. Choose one source:

  • source: task_output with taskId and either the output key or its zero-based index (the order of output.assets in recordInfo). The task must be one of your own successful tasks; with a team key, a task of that team.
  • source: upload with the fileId of a committed upload.
  • source: url with a public http or https address on port 80 or 443, without a username or password. The whole file is downloaded once through a fetcher that refuses private and internal addresses, and its type is read from the file itself: only JPEG, PNG, WebP and GIF images, MP4 and WebM video, and MP3, WAV, FLAC and Ogg audio are accepted. Links to SpicyAPI storage are refused; save those with task_output or upload instead.

Idempotency-Key is required and bound to the request for 24 hours. Saving the same source again returns the existing asset without using more space. Dimensions and durations are measured by the server.

Storage unlocks with the owner's lifetime top-ups (see GET /api/v1/assets/usage); the owner's personal library and all of their team libraries share one allowance. Without any top-up, saving returns 400 (data.reason asset_library_locked) explaining how much to top up. A full allowance (asset_library_full) or a file above the plan's per-file limit (asset_file_too_large) also returns 400 naming the plan and what the next plan unlocks; for team members who cannot top up, the message asks the team owner to upgrade instead of naming an amount. Lowering a plan never deletes saved assets. Saving is limited to 30 requests per minute and a daily number of new assets per allowance (429 with Retry-After until 00:00 UTC, asset_daily_limit). If storage is full across the platform the request returns 503 (asset_storage_full). A team role that cannot save gets 403 (asset_permission_denied).

post/api/v1/assets

Request

  • Base URL: https://api.spicyapi.ai
  • URL: https://api.spicyapi.ai/api/v1/assets
  • Auth: HTTP bearer

Headers

Idempotency-Keystring required

Request body

source'task_output' | 'upload' | 'url' required
taskIdstring

source=task_output: one of your own successful tasks.

keystring

source=task_output: the output key. Send key or index.

indexinteger

source=task_output: zero-based position in output.assets. Send key or index.

fileIdstring

source=upload: a committed upload (fil_… or spicy://f/fil_…).

urlstring

source=url: a public http or https address on port 80 or 443, without credentials.

namestring

Defaults to "Saved asset".

Response

The saved (or already saved) asset.

code200 required
msg'success' required
request_idstring required

Correlation identifier. Include it in support requests.

Changes

No recorded changes to this operation across all 1 revision of this API.