# Publications

Publish documents and files with a link, change who can open them, and unpublish.

Web version: https://www.svanja.com/docs/api/publications/

A publication is a document or a set of files from a Space that people can open with a link. You can use these endpoints to publish a finished report for a client, change who can open it, or take it down.

Reading publications requires the Publications area, which Full access and Read-only both include. Publishing requires Full access or Publications set to **Read and write**. Every time you publish something or change who can open it, a person has to approve the change in the app, even if it is only for your own team. For more details, see [Publishing and sharing](https://www.svanja.com/docs/publishing/).

Use `GET /publications` and `GET /publications/{id}` to read existing publications. Use `POST /publications` to publish one of two things:

- A version of a document: set `source_type` to `artifact`, and pass the `artifact_id` and `version_id` from [Artifacts](https://www.svanja.com/docs/api/artifacts/).
- Files from a Space: set `source_type` to `folder`, and pass the `space_id` along with the `paths` you want to include.

Include an `audience` to control who can open the link: `private`, `team`, `space`, `link`, `named_recipients`, or `public`, depending on what your plan allows. You can also call `POST /publications/{id}/actions` with `make_live`, `audience`, `revoke_recipient`, or `unpublish`, which waits for the same approval in the app.

For general API details, see [The REST API](https://www.svanja.com/docs/api/). If you prefer working from a terminal, see [svanja publish](https://www.svanja.com/docs/cli/artifacts-and-publishing/).

## Operations

| Operation | What it does | Effect | Endpoints |
| --- | --- | --- | --- |
| `publication.audience` | Change publication audience. | Acts outside Svanja | `POST /publications/{id}/actions` |
| `publication.publish` | Publish content. | Acts outside Svanja | `POST /publications` |
| `publication.read` | Read publication status. | Reads only | `GET /publications`<br>`GET /publications/{id}` |

## Endpoints

### GET /api/v1/publications

List publications

### POST /api/v1/publications

Publish content

### GET /api/v1/publications/{id}

Read a publication

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### PATCH /api/v1/publications/{id}

Update a publication

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### POST /api/v1/publications/{id}/actions

Run a publication action

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
