---
title: "Convert a PocketBase component image to a data URL"
method: POST
path: "/api/convert-image"
tags: ["sharing"]
---

# Convert a PocketBase component image to a data URL

`POST /api/convert-image`

## Request

- Base URL: `https://voltplan.app`
- URL: `https://voltplan.app/api/convert-image`
- Auth: none declared

Fetches `imageUrl` server-side (`User-Agent: VoltPlan/1.0`) and returns it base64-encoded as a data URL. Only URLs containing `/api/files/components/` are accepted. Independent of share tokens. No authentication.

## Request body

- ConvertImageRequest: Body of POST /api/convert-image.
  - `imageUrl` string, required: Absolute URL that must contain `/api/files/components/` (PocketBase component file).

## Response `200`

Image as data URL.

- ConvertImageResponse: Result of POST /api/convert-image.
  - `dataUrl` string, required: `data:<upstream Content-Type, default image/png>;base64,<bytes>`.

## Other responses

- `400`: `imageUrl` missing/empty or not a PocketBase component file URL.
- `404`: Upstream answered a non-2xx status.
- `500`: Malformed JSON body, non-string `imageUrl`, or network error.

---

[API](https://skmtc.dev/voltplan/apis/voltplan-api.md) · [All operations](https://skmtc.dev/voltplan/apis/voltplan-api/llms.txt) · [OpenAPI document](https://skmtc.dev/voltplan/apis/voltplan-api/revisions/575b86a7af92?raw)
