> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hypastack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CDN

> Public, permanent asset hosting endpoints.

Public, permanent assets on a global edge. Images are re-encoded on upload and their EXIF, GPS, and camera metadata is stripped, see [Permanent CDN Hosting](/cdn-hosting) for the product-level details.

## List CDN assets

`GET /cdn/assets`. Requires `cdn.read`.

| Query param | Type    | Description                                                      |
| ----------- | ------- | ---------------------------------------------------------------- |
| `limit`     | integer | How many to return. Default 50, maximum 100.                     |
| `cursor`    | string  | The `next_cursor` from a previous page. Omit for the first page. |

## Retrieve a CDN asset

`GET /cdn/assets/{id}`. One asset by id. Requires `cdn.read`.

## Start a CDN upload

`POST /cdn/assets`. Same three-step flow as files, see [Uploading](/api-reference/uploading). CDN assets are public and permanent, they never expire and are not encrypted, because a browser has to be able to render them. Requires `cdn.write`.

| Body param     | Type    | Required | Description                                      |
| -------------- | ------- | -------- | ------------------------------------------------ |
| `name`         | string  | Yes      | Filename. Becomes part of the public URL.        |
| `size`         | integer | Yes      | Size in bytes, within your plan's per-asset cap. |
| `content_type` | string  | Yes      | MIME type, e.g. `text/css`.                      |

## Finish a CDN upload

`POST /cdn/assets/{id}/complete`. Commits a new upload or a swap. The size is read back from storage, so your quota is charged for the bytes that actually landed. Requires `cdn.write`.

## Swap an asset in place

`POST /cdn/assets/{id}/swap`. Replaces the bytes behind an existing asset while keeping its id and public URL, so anything already linking to it picks up the new version. PUT the bytes, then call complete. Requires `cdn.write`.

| Body param     | Type    | Required | Description                       |
| -------------- | ------- | -------- | --------------------------------- |
| `size`         | integer | Yes      | Size of the replacement in bytes. |
| `content_type` | string  | Yes      | MIME type of the replacement.     |

## Delete a CDN asset

`DELETE /cdn/assets/{id}`. Removes the asset and its bytes. The public URL stops working immediately. Requires `cdn.delete`.

```json Example asset object theme={null}
{
  "object": "cdn_asset",
  "id": "17agm92ngc43",
  "name": "styles.css",
  "size": 17,
  "content_type": "text/css",
  "created_at": "2026-07-19T21:04:12.000Z",
  "url": "https://r2.hypastack.com/cdn/17agm92ngc43/styles.css"
}
```
