# Image proxy

> Load token and media images from Proxima's image proxy instead of third-party CDNs.

`getImageUrl()` rewrites known image hosts to `https://img.proxima.tools`, so images load from one origin with usable CORS headers (needed to draw them on a canvas or download them as files). URLs already on `img.proxima.tools` pass through, unknown hosts are used as-is.

| Original host | Proxied as |
| --- | --- |
| `https://proximaimage.hel1.your-objectstorage.com/{path}` | `/proxima/{path}` |
| `https://edge.uxento.io/.../{id}` | `/uxento/{id}` |
| `https://ipfs.io/ipfs/{cid}` | `/ipfs/{cid}` |
| `https://static.four.meme/market/{id}` | `/four/{id}` |
| `https://cdn.anoncoin.it/{path}` | `/anoncoin/{path}` |
| `https://cdn.printr.money/{path}` (a leading `t/` is dropped) | `/printr/{path}` |
| `https://axiomtrading-v2.axiom-cdn.io/{path}` | `/axiom/{path}` |

Query strings are dropped when rewriting (except for the Proxima bucket, whose path is kept verbatim).

Base URL: `https://api-mig.proxima.tools`

## Endpoints

- `GET https://img.proxima.tools/{source}/{path}`: Retrieve a proxied image

### Retrieve a proxied image

`GET https://img.proxima.tools/{source}/{path}`

Returns an image from one of the supported origins. (No auth)

- Token: None. This endpoint is public.
- Retry: Safe to retry.

Used as an `<img>` source across the app and fetched as a blob by `downloadImage()` (image croppers, PnL card export). `downloadImage()` rejects responses smaller than 200 bytes as broken images.

#### Path parameters

- `source` (enum, required): Origin the image is fetched from (see the table above). Possible values: `proxima`, `uxento`, `ipfs`, `four`, `anoncoin`, `printr`, `axiom`.
- `path` (string, required): Image ID or path on the origin; may contain `/`.

#### Returns 200 OK

The image bytes.

#### Example request

```bash
curl "https://img.proxima.tools/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG"
```

#### Example response

```text
<binary>
```
