> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenia.team/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload an Announcement File

> Get a presigned upload URL for a file or cover image to attach to an announcement.

Attaching a file to an announcement takes two steps:

1. Call this endpoint with the file's name. It returns a presigned `url` and a file `key`.
2. `PUT` the file's bytes to `url`.

Then send the `key` in `attachments` or `coverImage` on [Create Announcement](https://docs.xenia.team/api-reference/endpoints/announcements/create-announcement.md) or [Update Announcement](https://docs.xenia.team/api-reference/endpoints/announcements/update-announcement.md).

> [!NOTE]
>
> Announcements must be on your workspace's plan. Otherwise every Announcements endpoint returns `403` with "Workspace doesn't have "Announcements" feature activated."

## Permissions

The key acts as its default user, or the user in the `x-client-user` header (who must be in the workspace). That user needs **Create & Manage Own Announcements** or **Manage All Announcements**.

## Path parameters

**workspaceId** `string\<uuid\>` *required*

UUID of the workspace. Must be the workspace your API key is bound to.

## Body

**fileName** `string` *required*

The file's name, with an extension the app accepts: images, video, audio, PDF, Office and text documents, CSV, email, ZIP and 7z, and some CAD formats. SVG files and executables are refused. Spaces and characters such as `#`, `%`, `&`, `+`, and `?` are replaced with `_` in the returned `key`.

**mimeType** `string`

The file's content type, such as `application/pdf`. Defaults to the type for the file's extension.

## Response

Returns `200` with `{ "data": { "url", "key" }, "meta": {} }`.

* `url` is a presigned upload URL. It's valid for 15 minutes.
* `key` is the file key to send in `attachments` or `coverImage`.

## Uploading the file

`PUT` the file's bytes to `url`, with a `Content-Type` header that matches `mimeType` (or the type for the file's extension, if you didn't send one). Don't send your client key or secret: the URL is already signed.

```bash theme={null}
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: application/pdf" \
  --data-binary @hours.pdf
```

## Errors

| Status | When |
| - | - |
| `401` | Invalid client credentials |
| `403` | Announcements isn't on the workspace's plan |
| `403` | The user doesn't have Create & Manage Own Announcements or Manage All Announcements |
| `415` | The file type isn't allowed, such as "File type ".exe" is not allowed." |
| `422` | `fileName` is missing. This error has the body shown on the [Error handling](https://docs.xenia.team/guides/error-handling.md) page |
| `426` | The workspace has used up its file storage |

```bash cURL theme={null}
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/announcements/attachments/upload-url" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "fileName": "hours.pdf", "mimeType": "application/pdf" }'
```

```json 200 theme={null}
{
  "data": {
    "url": "https://…/4a2e…/9d03…/1795200000000/hours.pdf?X-Amz-Algorithm=…&X-Amz-Signature=…",
    "key": "4a2e…/9d03…/1795200000000/hours.pdf"
  },
  "meta": {}
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.