# Assets

Source: https://kirora.io/docs/api/reference/assets

An asset is an image you upload for a template's image blocks, served from a public URL. Anyone with the URL can see it, so never upload anything private.

## Endpoints

- [List assets](https://kirora.io/docs/api/reference/listAssets): `GET /v1/assets`
- [Upload an image](https://kirora.io/docs/api/reference/uploadAsset): `POST /v1/assets`
- [Copy an image into the library](https://kirora.io/docs/api/reference/importAsset): `POST /v1/assets/import`
- [Rename an asset](https://kirora.io/docs/api/reference/updateAsset): `PATCH /v1/assets/{id}`
- [Delete an asset](https://kirora.io/docs/api/reference/deleteAsset): `DELETE /v1/assets/{id}`
- [Retrieve an asset's usage](https://kirora.io/docs/api/reference/getAssetUsage): `GET /v1/assets/{id}/usage`

## The Asset object

```json
{
  "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
  "type": "image",
  "name": "name_example",
  "filename": "filename_example",
  "url": "https://example.com",
  "mimeType": "image/png",
  "sizeBytes": 1,
  "width": 1,
  "height": 1,
  "createdAt": "2030-03-14T09:30:00Z"
}
```

- `id` (string, required, uuid)
- `type` (string, required, one of `image`) — The kind of file: `image`. More kinds, such as `video`, may be added: branch on `type` and keep the ones you do not know.
- `name` (string, required) — The name the library shows.
- `filename` (string, required) — The file's name as uploaded or copied.
- `url` (string, required, uri) — The file's public address, such as an image `src`.
- `mimeType` (string, required, one of `image/png`, `image/jpeg`, `image/gif`) — The file's format.
- `sizeBytes` (integer, required, min > 0) — File size in bytes.
- `width` (integer, required, min > 0) — The file's width in px.
- `height` (integer, required, min > 0) — The file's height in px.
- `createdAt` (string, required, date-time)
