# Update image for membership type

`PUT /api/configuration/membership-types/{id}/image`

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

HTML version: [Update image for membership type](https://support.gladstonesoftware.cloud/reference/configuration/update-image-for-membership-type)

## Overview

Uploads an image and points a membership type at it, replacing whatever image that membership type
was using. The image is what member-facing joining and membership screens show for the type.

**Send this as `multipart/form-data` with a single part named `imageFile`.** There is no JSON body.
The part is the file itself; nothing else is sent.

The file must satisfy these image rules:

- **10 MB maximum**, and it may not be empty.
- **`jpg`, `jpeg` or `png` only** — the check inspects the file, so renaming an extension does not
  get another format through.

The call happens in two steps, and it is not all-or-nothing:

1. The file is uploaded and stored.
2. A reference to the stored file is written to the membership type.

**The membership type is not checked until step 2.** An identifier that does not exist therefore
returns `404` *after* the file has already been uploaded, leaving an orphaned uploaded image
behind. Verify the membership type first.

This is a targeted update — only the image reference is written, and no other membership type
configuration is touched. There is no way to clear an image with this call; you can only replace it.

On success the response is `204 No Content`, and the change is visible on the next read of the
membership types for every site the type is available at.

## Endpoint

`PUT {base_url}/api/configuration/membership-types/{id}/image`

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

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | Yes | Identifier of the membership type whose image is replaced, as returned by the membership type configuration endpoints. Not validated before the upload: an unrecognised value fails at the second step with `404 Unable to find Membership Type {id} to update.`, after the file has been stored. |

## Sample request

```bash title="cURL"
curl -X PUT '{base_url}/api/configuration/membership-types/{id}/image' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -F 'imageFile=@/path/to/gold-membership.png'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | No `imageFile` part was sent — body is the string `An image is required`. |
| `400` | Bad request | The file is larger than 10 MB — body is `File "{name}" is {size}MB in size which is larger than the maximum size of 10MB.`, with the name truncated to 20 characters. |
| `400` | Bad request | The file is zero bytes — `File "{name}" is empty and cannot be uploaded.` |
| `400` | Bad request | The file is not a jpg, jpeg or png — `File "{name}" is not a valid image, only image files of type "jpg", "jpeg" and "png" can be saved.` |
| `404` | Not found | No membership type matches `{id}` — `Unable to find Membership Type {id} to update.` Raised only after the upload has succeeded, so the stored file is left behind. |
| `500` | Internal server error | The file could not be stored, the reference update failed for an unexpected reason, or any other unexpected server-side failure. No detail is returned. |
| `503` | Service unavailable | The reference could not be written because a required part of the platform was unavailable. **The body is empty.** The file has already been uploaded, so retry the whole call later. |
