---
title: "Media (Services)"
description: "A piece of media"
---

> Documentation Index
> Fetch the complete documentation index at: https://planningcenterkit.mackenly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Media (Services)

A piece of media

| Property | Value |
| --- | --- |
| Product | [Services](/reference/services/) (`pco.services`, API version `2018-11-01`) |
| Resource type | `Media` |
| TypeScript | `Services.Media`, attributes `Services.MediaAttributes`, schema `Services.MediaSchema` |
| Planning Center path | `/services/v2/media` |
| Planning Center docs | [Media](https://api.planningcenteronline.com/docs/apps/services/versions/2018-11-01/vertices/media) |

## How to reach it

| Client path | Returns | Filters | Create |
| --- | --- | --- | --- |
| `pco.services.media` | Collection | `archived`, `audio`, `background_audio`, `background_image`, `background_video`, `countdown`, `curriculum`, `document`, `drama`, `image`, `not_archived`, `powerpoint`, `song_video`, `video` | Yes |
| `pco.services.songs.id(songId).last_scheduled_item.id(itemId).media` | Collection |  | No |

From a collection, `.id(mediaId)` addresses one Media: `pco.services.media.id(mediaId)`. Collections support [`where`, `include`, `order`, and pagination](/guides/querying/); single resources have `get()`.

## Attributes

On `Services.MediaAttributes`. Every resource also has `id` and `type` (`'Media'`) next to its attributes.

| Name | Type | Description |
| --- | --- | --- |
| `created_at` | `string \| null` |  |
| `creator_name` | `string \| null` |  |
| `image_url` | `string \| null` |  |
| `length` | `number \| null` |  |
| `media_type` | `string \| null` | See [details](#media-type). |
| `media_type_name` | `string \| null` |  |
| `preview_content_type` | `string \| null` |  |
| `preview_file_name` | `string \| null` |  |
| `preview_file_size` | `number \| null` |  |
| `preview_updated_at` | `string \| null` |  |
| `preview_url` | `string \| null` |  |
| `themes` | `string \| null` |  |
| `thumbnail_content_type` | `string \| null` |  |
| `thumbnail_file_name` | `string \| null` |  |
| `thumbnail_file_size` | `number \| null` |  |
| `thumbnail_updated_at` | `string \| null` |  |
| `thumbnail_url` | `string \| null` |  |
| `title` | `string \| null` |  |
| `updated_at` | `string \| null` |  |

### Attribute details

#### `media_type` {#media-type}

Possible Values:

- `audio`

- `background_audio`

- `background_image`

- `background_video`

- `countdown`

- `curriculum`

- `document`

- `drama`

- `image`

- `powerpoint`

- `song_video`

- `video`

## Relationships and includes

Side-load with `include()` (or `get({ include })`) and read with `related(resource, name)`: `attachments`.

## Querying

### Where

`where(field, value)` for equality; `where(field, op, value)` with the operators listed.

| Field | Value type | Operators |
| --- | --- | --- |
| `creator_name` | `string` | Equality only |
| `id` | `string` | Equality only |
| `themes` | `string` | Equality only |
| `title` | `string` | Equality only |

### Order

`order(...)` accepts these fields, ascending, or descending with a `-` prefix: `created_at`, `title`, `updated_at`.

### Filters

`filter(...)` names depend on the edge you query through:

| Edge | Filters |
| --- | --- |
| `pco.services.media` | `archived`, `audio`, `background_audio`, `background_image`, `background_video`, `countdown`, `curriculum`, `document`, `drama`, `image`, `not_archived`, `powerpoint`, `song_video`, `video` |

## Edges

Follow these from one Media, `ref = pco.services.media.id(mediaId)`:

| Edge | Leads to | Returns | Filters | Create |
| --- | --- | --- | --- | --- |
| `ref.attachments` | [Attachment](/reference/services/attachment/) | Collection |  | Yes |
| `ref.media_schedules` | [MediaSchedule](/reference/services/media-schedule/) | Collection |  | No |
| `ref.tags` | [Tag](/reference/services/tag/) | Collection |  | No |

## Writing

| Property | Value |
| --- | --- |
| Create | Yes, `create()` on `pco.services.media` |
| Update | Yes, `update()` on a reference |
| Delete | Yes, `delete()` on a reference |

### Create attributes

Typed as `Services.MediaSchema['create']`.

| Attribute | Type |
| --- | --- |
| `creator_name` | `string \| null` |
| `media_type` | `string \| null` |
| `minutes` | `unknown` |
| `seconds` | `unknown` |
| `themes` | `string \| null` |
| `title` | `string \| null` |

### Update attributes

Typed as `Services.MediaSchema['update']`.

| Attribute | Type |
| --- | --- |
| `creator_name` | `string \| null` |
| `media_type` | `string \| null` |
| `minutes` | `unknown` |
| `seconds` | `unknown` |
| `themes` | `string \| null` |
| `title` | `string \| null` |

See [Writing data](/guides/writing-data/).

## Actions

Run with `ref.action(name, body?)`. Bodies are untyped: see Planning Center's docs for each action.

| Action | Path | Description |
| --- | --- | --- |
| `archive` | `POST /services/v2/media/{media_id}/archive` | Archive a Media. |
| `assign_tags` | `POST /services/v2/media/{media_id}/assign_tags` | Used to assign tags to a media. |
| `unarchive` | `POST /services/v2/media/{media_id}/unarchive` | Restore an archived Media. |

## Example

```ts
import type { Services } from '@mackenly/planningcenterkit';

const page = await pco.services.media.order('created_at').perPage(25).list();
const items: Services.Media[] = page.data;
```

Source: https://planningcenterkit.mackenly.com/reference/services/media/index.mdx
