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

# Delivery URLs

> Transform an asset at delivery time with client.url().

Appends transform parameters to an asset's delivery URL. Pure string work — no network
call, no API key — so it's safe in a render path.

```python theme={null}
client.url(asset, {"width": 400, "height": 400, "fit": "cover", "format": "webp"})
# …/fetch/2f928a3f-1d2a-4a2b?fit=cover&format=webp&height=400&width=400
```

## Signature

```python theme={null}
client.url(target, transform=None) -> str
```

| Parameter | Type | Description |
| :- | :- | :- |
| `target` | `AssetLike \| str` | **Required.** An asset, or a URL it previously returned |
| `transform` | `Transform` | The transform to apply. Omit for the original |

It never builds a URL from scratch. The delivery host and API version come from server
configuration — a project can serve from its own CDN domain — so the only correct base is
the one the API already returned. If you store URLs rather than whole assets, pass the
string:

```python theme={null}
client.url(stored_url, {"width": 400})
```

Anything with an `id` and a `url` works as `target`: `Asset`, `MediaItem`,
`BackgroundRemovedAsset`, `ConvertedDocument`.

Transforms run on the fly and are cached, so one original serves every size you ask for.

## Parameters

`Transform` is a `TypedDict`; every key is optional.

| Key | Applies to | Description |
| :- | :- | :- |
| `format` | all | Output format. Also drives OCR (`txt`), document conversion (`pdf`, `docx`, …) and video thumbnails |
| `width`, `height` | image, video | Target size in pixels, max 4000 |
| `fit` | image, video | `cover`, `contain`, `fill`, `inside`, `outside` |
| `quality` | image, video | 1–100 |
| `gravity` | image | Crop anchor: `center`, `north`, …, `attention`, `entropy` |
| `crop` | image | `"left,top,width,height"`, or a 4-tuple of ints |
| `dpr` | image | Device pixel ratio multiplier, max 3 |
| `rotate` | image | `90`, `180` or `270` |
| `blur` | image | Blur sigma, 0.3–100 |
| `bg` | image | Hex fill colour without `#`: `fff`, `ffffff` or `ffffffcc` |
| `radius` | image | Corner radius in px, or `"max"` for a circle |
| `trim_start`, `trim_end` | video | Trim points in seconds |
| `video_codec` | video | `h264`, `vp8`, `vp9`, `hevc` |
| `fps` | video | Output frame rate |
| `page` | PDF | Page to render when converting a PDF to `png` or `jpeg`. Defaults to 1 |
| `preset` | image, video | A saved preset key, applied instead of individual fields |

Snake\_case keys are converted to the names the API reads, so `trim_start` becomes
`trimStart` on the wire.

See [Image Transformations](https://docs.dreep.cloud/transformations/images.md),
[Video Transformations](https://docs.dreep.cloud/transformations/videos.md) and
[Document Conversions](https://docs.dreep.cloud/transformations/documents.md) for what each does.

## Type safety

Enum-like parameters are `Literal` unions, so a wrong value is caught by your type checker
rather than silently ignored as an unknown query parameter:

```python theme={null}
client.url(asset, {"fit": "squish"})  # type error — not a Fit
client.url(asset, {"rotate": 45})     # type error — 90, 180 or 270
```

A misspelled key is caught at runtime too, instead of quietly returning the original:

```python theme={null}
client.url(asset, {"widht": 400})     # raises TypeError, listing the valid keys
```

## Presets

```python theme={null}
client.url(asset, {"preset": "thumbnail"})
# …/fetch/2f928a3f-1d2a-4a2b?p=thumbnail
```

The SDK maps `preset` onto the `p` query parameter the API reads. See
[`create_preset()`](https://docs.dreep.cloud/python-sdk/presets/create-preset).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.