# Uploads an activity image to public storage blob.

`POST /api/images/activities`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Uploads an activity image to public storage blob.](https://support.gladstonesoftware.cloud/reference/configuration/uploads-an-activity-image-to-public-storage-blob)

## Overview

Uploads an image for use on an activity — the picture shown on a class or session in a timetable — and returns the public URL you then store against the activity.

Send the request as `multipart/form-data` with two parts:

| Part | Required | Description |
|------|----------|-------------|
| `imageFile` | Yes | The image itself. **JPEG and PNG only**, and the check reads the file's actual header rather than trusting its extension or `Content-Type`, so renaming a GIF to `.jpg` is rejected. Maximum 10 MB; an empty file is rejected too. |
| `imageName` | Yes | The name to store the image under, **without an extension** — the extension is taken from `imageFile`'s own file name and appended for you. Maximum 100 characters. Letters, numbers, hyphens and underscores only: no spaces, no dots, no other punctuation, and it may not start or end with a hyphen or underscore. The value is lower-cased before storage, so `Poolside` and `poolside` are the same image. |

The saved file name is `{imageName}.{extension}` — so `imageName=poolside` with a file called `photo.JPG` is saved as `poolside.jpg`.

**Names are unique and uploads never overwrite.** Re-uploading to an existing name fails with `409` rather than replacing the image, so to change a picture you delete the old one first or pick a new name. List what already exists with [List activity images](retrieves-a-list-of-activity-images-from-public-storage-blob-with-optional-pagin.md).

The returned `url` is publicly readable — anyone with the link can fetch the image without authenticating. Do not upload anything that identifies a member here.

A successful upload returns `200 OK` with the URL and file name, and the new image appears in the activity image list straight away.

## Endpoint

`POST {base_url}/api/images/activities`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Sample request

```bash title="cURL"
curl -X POST '{base_url}/api/images/activities' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -F 'imageFile=@poolside-photo.jpg' \
  -F 'imageName=poolside'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | The image's full public URL. Store this against the activity — it is what a client fetches to display the picture, and it needs no authentication. The path includes your tenant identifier and the `images/activities` folder, so it is stable for as long as the image exists. |
| `fileName` | string | The stored file name including its extension — your lower-cased `imageName` plus the extension taken from the uploaded file, for example `poolside.jpg`. This is the value you pass to the retrieve and delete endpoints, which take the file name rather than the URL. |

## Sample response

```json title="200 OK"
{
  "url": "string",
  "fileName": "string"
}
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `imageFile` is missing — `An image file is required.` |
| `400` | Bad request | `imageFile` is larger than 10 MB — `File "{name}" is {size}MB in size which is larger than the maximum size of 10MB.` The name in the message is truncated to 20 characters. |
| `400` | Bad request | `imageFile` is zero bytes — `File "{name}" is empty and cannot be uploaded.` |
| `400` | Bad request | `imageFile` is not a JPEG or PNG by its actual file header — `File "{name}" is not a valid image, only image files of type "jpg", "jpeg" and "png" can be saved.` |
| `400` | Bad request | `imageName` is missing or blank (`Image name cannot be empty.`), over 100 characters (`Image name cannot exceed 100 characters.`), contains a space (`Image name cannot contain spaces. Use hyphens (-) or underscores (_) instead.`), contains any other disallowed character including a dot (`Image name can only contain letters, numbers, hyphens, and underscores.`), or starts or ends with a hyphen or underscore (`Image name cannot start or end with a hyphen or underscore.`). |
| `409` | Conflict | An activity image with that name already exists — `An activity image named '{imageName}' already exists`. Nothing is overwritten; delete the existing image or choose another name. |
| `500` | Internal server error | The upload was rejected for any reason other than the name already existing. The response body is empty. |
