---
title: "media"
method: POST
path: "/campaigns/{campaign}/media"
tags: ["Media"]
---

# media

`POST /campaigns/{campaign}/media`

Add an image to the campaign media library. Accepts either a `multipart/form-data` upload or an `application/json` body with a `url` to fetch server-side. Accepted formats: PNG, JPG, GIF, WebP, SVG (max 20 MB). SVG files are sanitised before upload. An optional `folder` field (default: `"uploads"`) organises the upload; only lowercase letters, numbers, hyphens, and underscores are accepted. On success the new item is prepended to the campaign media library.

#### For custom components:
`RaiselyComponents.api.one('campaigns', '{campaign}').all('media').post(data = {}, params = {}, headers = {}) => Promise<{result}>`

 :fa-gears: See [Restie Response Data](https://github.com/raisely/restie#reading-and-handling-responses) for a more detailed overview of responses through the client wrapper

## Path parameters

- `campaign` string, required

## Headers

- `Authorization` string

## Request body

- object
  - `url` string, required — Public URL of the image to fetch
  - `folder` string — Organising folder for the upload (optional, default "uploads")

## Response `200`

Successfully uploaded media item

- object
  - `data` object
    - `uuid` string
    - `url` string
    - `file` string
    - `type` string
    - `folder` string

## Other responses

- `400` — Validation error (invalid file type, size exceeded, or unreachable URL)
- `401` — Authorization credentials were missing or invalid
- `403` — The user is authenticated, but is not allowed to perform the requested operation
- `408` — URL fetch timed out
- `410` — The requested record no longer exists, or that API has been deprecated
- `429` — You have made too many requests to the given endpoint, please try again later
- `500` — An unexpected error has occurred with Raisely. If the error persists you can contact support@raisely.com

---

[API](https://skmtc.dev/raisely/apis/raisely-api.md) · [All operations](https://skmtc.dev/raisely/apis/raisely-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/raisely/raisely-api/revisions/d7f8dd294cb0/schema)
