---
title: "Generate a presigned upload URL for a user-scoped image"
method: POST
path: "/activity/images/generate-upload-url"
tags: ["activity"]
---

# Generate a presigned upload URL for a user-scoped image

`POST /activity/images/generate-upload-url`

## Request

- Base URL: `https://api.focusbear.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.focusbear.io/activity/images/generate-upload-url`
- Auth: HTTP bearer

Not tied to an existing activity, so it can back habits that are not persisted yet (new habits, habits inside a pack). The image is stored under the caller’s own namespace.

## Request body

- GenerateActivityImageUploadUrlDto
  - `file_name` string, required: Original file name of the image
  - `content_type` 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp', required: MIME type of the image

## Response `201`

Presigned upload URL generated successfully

- GenerateActivityImageUploadUrlResponseDto
  - `uploadUrl` string, required: Presigned URL the client should PUT the image to
  - `fileKey` string, required: Storage key/path of the uploaded image

## Other responses

- `404`: User not found

---

[API](https://skmtc.dev/focusbear/apis/focusbear-api.md) - [All operations](https://skmtc.dev/focusbear/apis/focusbear-api/llms.txt) - [OpenAPI document](https://skmtc.dev/focusbear/apis/focusbear-api/revisions/3a83a3b9a811?raw)
