---
title: "Uploads an image."
method: POST
path: "/api/image"
tags: ["Images"]
---

# Uploads an image.

`POST /api/image`

## Request

- Base URL: `https://passivelogic.com` (the document declares no server; this is the origin it was published from)
- URL: `https://passivelogic.com/api/image`
- Auth: one of:
  - API key in header `X-PL-AUTH`
  - API key in header `Authorization: PL-API-KEY`
  - API key in header `PL-API-KEY`
  - HTTP basic
- TypeScript: <https://skmtc.dev/passivelogic/apis/passivelogic-http-api/docs/api/image/post.ts> (a function with typed inputs; its response is checked against the schema)

Uploads an image to the server, setting its new stored url & checksum in the database. If an existing ID is given, this will
attempt an update of the image data. The data may be sent in either multipart/form-data or JSON format. If using JSON, the
image file must be Base64-encoded. Using multipart/form-data is recommended as it is a more efficient way to transmit binary
data.

This endpoint is intended for associating image file data with an existing `Image` node in the Quantum schema.

## Request body

- UploadImageData: Data required to upload an image.
  - `ID` string, uuid, required: UUID of the quantum image node that you want to associate this image file with.
  - `image` string, byte, required: File data to write to the server. Must be Base64-encoded if sending as JSON.
  - `fileType` string, required: The type of file the given data represents, from a list of allowed files.

## Response `200`

OK

- ImageUploadResponse: Image response definition
  - `message` string, required: Informative message relating to image upload. Updated image url with cache bust.
  - `url` string, nullable

---

[API](https://skmtc.dev/passivelogic/apis/passivelogic-http-api.md) - [All operations](https://skmtc.dev/passivelogic/apis/passivelogic-http-api/llms.txt) - [OpenAPI document](https://skmtc.dev/passivelogic/apis/passivelogic-http-api/revisions/28fce63bcdbb?raw)
