# Zilfu — Media

4 operations. Schemas referenced below are documented at https://zilfu.app/docs/api/schemas.md.

## Servers

- `https://zilfu.app/api`

## Operations

### List a space's reusable media library

- **Method:** `GET`
- **Path:** `/spaces/{space}/media`
- **Tags:** Media

#### Parameters

##### `space` required

- **In:** `path`

The space ID

`integer`

#### Responses

##### Status: 200 Paginated set of \`MediaResource\`

###### Content-Type: application/json

- **`data` (required)**

  `array`

  **Items:**

  - **`alt` (required)**

    `string`

  - **`height` (required)**

    `string`

  - **`id` (required)**

    `string`

  - **`mime` (required)**

    `string`

  - **`name` (required)**

    `string`

  - **`order` (required)**

    `string`

  - **`size` (required)**

    `string`

  - **`type` (required)**

    `string`

  - **`url` (required)**

    `string`

  - **`width` (required)**

    `string`

- **`links` (required)**

  `object`

  - **`first` (required)**

    `string | null`

  - **`last` (required)**

    `string | null`

  - **`next` (required)**

    `string | null`

  - **`prev` (required)**

    `string | null`

- **`meta` (required)**

  `object`

  - **`current_page` (required)**

    `integer`

  - **`from` (required)**

    `integer | null`

  - **`last_page` (required)**

    `integer`

  - **`links` (required)**

    `array` — Generated paginator links.

    **Items:**

    - **`active` (required)**

      `boolean`

    - **`label` (required)**

      `string`

    - **`url` (required)**

      `string | null`

  - **`path` (required)**

    `string | null` — Base path for paginator generated URLs.

  - **`per_page` (required)**

    `integer` — Number of items shown per page.

  - **`to` (required)**

    `integer | null` — Number of the last item in the slice.

  - **`total` (required)**

    `integer` — Total number of items being paginated.

**Example:**

```json
{
  "data": [
    {
      "id": "",
      "type": "",
      "url": "",
      "name": "",
      "mime": "",
      "width": "",
      "height": "",
      "size": "",
      "alt": "",
      "order": ""
    }
  ],
  "links": {
    "first": null,
    "last": null,
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": null,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "",
        "active": true
      }
    ],
    "path": null,
    "per_page": 0,
    "to": null,
    "total": 0
  }
}
```

##### Status: 401 Unauthenticated

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 403 Authorization error

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 404 Not found

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

### Ingest a completed upload into the space's media library

- **Method:** `POST`
- **Path:** `/spaces/{space}/media`
- **Tags:** Media

#### Parameters

##### `space` required

- **In:** `path`

The space ID

`integer`

#### Request Body

##### Content-Type: application/json

- **`url` (required)**

  `string`

- **`mime`**

  `string | null`

- **`name`**

  `string | null`

- **`type`**

  `string | null`

**Example:**

```json
{
  "url": "",
  "type": null,
  "mime": null,
  "name": null
}
```

#### Responses

##### Status: 200 \`MediaResource\`

###### Content-Type: application/json

- **`data` (required)**

  `object`

  - **`alt` (required)**

    `string`

  - **`height` (required)**

    `string`

  - **`id` (required)**

    `string`

  - **`mime` (required)**

    `string`

  - **`name` (required)**

    `string`

  - **`order` (required)**

    `string`

  - **`size` (required)**

    `string`

  - **`type` (required)**

    `string`

  - **`url` (required)**

    `string`

  - **`width` (required)**

    `string`

**Example:**

```json
{
  "data": {
    "id": "",
    "type": "",
    "url": "",
    "name": "",
    "mime": "",
    "width": "",
    "height": "",
    "size": "",
    "alt": "",
    "order": ""
  }
}
```

##### Status: 401 Unauthenticated

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 403 Authorization error

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 404 Not found

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 422 Validation error

###### Content-Type: application/json

- **`errors` (required)**

  `object` — A detailed description of each field that failed validation.

- **`message` (required)**

  `string` — Errors overview.

**Example:**

```json
{
  "message": "",
  "errors": {
    "additionalProperty": [
      ""
    ]
  }
}
```

### Remove a media asset from the space library

- **Method:** `DELETE`
- **Path:** `/spaces/{space}/media/{media}`
- **Tags:** Media

#### Parameters

##### `space` required

- **In:** `path`

The space ID

`integer`

##### `media` required

- **In:** `path`

The media ID

`integer`

#### Responses

##### Status: 200

###### Content-Type: application/json

- **`deleted` (required)**

  `boolean`

**Example:**

```json
{
  "deleted": true
}
```

##### Status: 401 Unauthenticated

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 403 Authorization error

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 404 Not found

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

### Get an upload URL

- **Method:** `POST`
- **Path:** `/media/sign`
- **Tags:** Media

PUT the file to the returned `upload_url` with `Content-Type: <mime>`, then send `url` back when creating or updating a post.

#### Request Body

##### Content-Type: application/json

- **`mime` (required)**

  `string`, possible values: `"image/jpeg", "image/png", "image/webp", "video/mp4", "video/quicktime"`

**Example:**

```json
{
  "mime": "image/jpeg"
}
```

#### Responses

##### Status: 200

###### Content-Type: application/json

- **`expires_at` (required)**

  `string`

- **`path` (required)**

  `string`

- **`upload_url` (required)**

  `string`

- **`url` (required)**

  `string`

**Example:**

```json
{
  "upload_url": "",
  "url": "",
  "path": "",
  "expires_at": ""
}
```

##### Status: 401 Unauthenticated

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 403 Authorization error

###### Content-Type: application/json

- **`message` (required)**

  `string` — Error overview.

**Example:**

```json
{
  "message": ""
}
```

##### Status: 422 Validation error

###### Content-Type: application/json

- **`errors` (required)**

  `object` — A detailed description of each field that failed validation.

- **`message` (required)**

  `string` — Errors overview.

**Example:**

```json
{
  "message": "",
  "errors": {
    "additionalProperty": [
      ""
    ]
  }
}
```
