---
title: "Upload a new asset"
method: POST
path: "/api/assets"
tags: ["asset"]
---

# Upload a new asset

`POST /api/assets`

Uploads a new asset to the system with associated metadata.
Supports two upload methods:
1. Direct file upload (multipart/form-data)
2. URL-based upload (application/json with source: "url")

If an asset with the same hash already exists, returns the existing asset.

## Request body

- object
  - `url` string, uri, required — HTTP/HTTPS URL to download the asset from
  - `name` string, required — Display name for the asset (used to determine file extension)
  - `tags` string[] — Freeform tags for the asset. Common types include "models", "input", "output", and "temp", but any tag can be used in any order.
  - `user_metadata` object — Custom metadata to store with the asset
  - `preview_id` string, uuid — Optional preview asset ID

## Response `200`

Asset already exists (returned existing asset)

- AssetCreated
  - `id` string, uuid, required — Unique identifier for the asset
  - `name` string, required — Name of the asset file
  - `asset_hash` string — Blake3 hash of the asset content
  - `size` integer, required — Size of the asset in bytes
  - `mime_type` string — MIME type of the asset
  - `tags` string[] — Tags associated with the asset
  - `user_metadata` object — Custom user metadata for the asset
  - `preview_url` string, uri — URL for asset preview/thumbnail
  - `preview_id` string, uuid, nullable — ID of the preview asset if available
  - `prompt_id` string, uuid, nullable — ID of the job/prompt that created this asset, if available
  - `created_at` string, date-time, required — Timestamp when the asset was created
  - `updated_at` string, date-time, required — Timestamp when the asset was last updated
  - `last_access_time` string, date-time — Timestamp when the asset was last accessed
  - `is_immutable` boolean — Whether this asset is immutable (cannot be modified or deleted)
  - `created_new` boolean, required — Whether this was a new asset creation (true) or returned existing (false)

## Other responses

- `201` — Asset created successfully
- `400` — Invalid request (bad file, invalid URL, invalid content type, etc.)
- `401` — Unauthorized
- `403` — Source URL requires authentication or access denied
- `404` — Source URL not found
- `413` — File too large
- `415` — Unsupported media type
- `422` — Download failed due to network error or timeout
- `500` — Internal server error

---

[API](https://skmtc.net/ac/apis/comfy-api.md) · [All operations](https://skmtc.net/ac/apis/comfy-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ac/comfy-api/revisions/c1893dffe250/schema)
