# Media sync

> For AI agents: the full docs index is at https://brixsignage.com/llms.txt, and every page has a markdown twin (add .md to the path).

Base URL `https://api.brixsignage.com`. Send `Authorization: Bearer $BRIX_API_KEY` unless an operation says Auth: none or Auth: no API key. The Permission line names what the key must hold. See [Authentication and scopes](https://brixsignage.com/developers/authentication.md), [Errors and rate limits](https://brixsignage.com/developers/errors-and-rate-limits.md) and [Pagination](https://brixsignage.com/developers/pagination.md).

- [GET /v1/media-sync](#get-v1-media-sync)
- [DELETE /v1/media-sync/{id}](#delete-v1-media-sync-id)
- [POST /v1/media-sync/{id}/sync](#post-v1-media-sync-id-sync)

Every 4xx and 5xx response below returns this body:

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | Machine-readable code: `unauthorized`, `forbidden`, `not_found`, `validation_error`, `conflict`, `rate_limited`, `internal_error`, … |
| `message` | string | Human-readable explanation. Safe to show an operator. |
| `requestId` | string | Present on 5xx: quote it to support. |

## GET /v1/media-sync

List synced folders

Return the workspace's synced folders, including the remote path, the destination folder in Brix, the connected account, sync status, the last error, the last check time, and the number of files synced. Only folders connected at locations where the caller holds the integration view permission are returned.

Auth: Bearer token. Permission: `integration.view`.

```bash
curl "https://api.brixsignage.com/v1/media-sync" \
  -H "Authorization: Bearer $BRIX_API_KEY"
```

Response 200: Success.

| Field | Type | Description |
| --- | --- | --- |
| `data` | array of object |  |
| `data[].id` | string |  |
| `data[].provider` | string | `onedrive` or `sharepoint`. |
| `data[].remotePath` | string |  |
| `data[].folderId` | string | The library folder the files land in. |
| `data[].folderName` | string \| null |  |
| `data[].accountLabel` | string \| null |  |
| `data[].accountConnected` | boolean | False when the connected account was removed: syncing stops until it is connected again. |
| `data[].status` | "ok" \| "error" \| "paused" |  |
| `data[].lastError` | string \| null |  |
| `data[].lastSyncAt` | string \| null |  |
| `data[].itemsSynced` | integer |  |
| `data[].createdAt` | string | ISO-8601 timestamp (UTC). |
| `data[].updatedAt` | string | ISO-8601 timestamp (UTC). |

Response 401: Missing, expired or revoked bearer token.

Response 403: The token lacks the permission this operation needs (see `x-brix-permission`).

Response 5XX: Server error. The body carries a `requestId` to quote to support.

## DELETE /v1/media-sync/{id}

Stop syncing a folder

Stop following a remote folder. The sync source is removed, but files already imported are not affected. This action is recorded in the activity log.

**Notes.**
- The files already synced stay in the library.

Auth: Bearer token. Permission: `integration.delete`.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Synced folder id. |

```bash
curl -X DELETE "https://api.brixsignage.com/v1/media-sync/{id}" \
  -H "Authorization: Bearer $BRIX_API_KEY"
```

Response 200: Success.

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.ok` | true |  |

Response 401: Missing, expired or revoked bearer token.

Response 403: The token lacks the permission this operation needs (see `x-brix-permission`).

Response 5XX: Server error. The body carries a `requestId` to quote to support.

## POST /v1/media-sync/{id}/sync

Sync a folder now

Trigger an immediate sync of one connected folder, bounded to a fixed number of files for the run, and return a summary of what happened. This action is recorded in the activity log.

**Notes.**
- A failed run still answers 200: read `error`.

Auth: Bearer token. Permission: `integration.create`.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Synced folder id. |

```bash
curl -X POST "https://api.brixsignage.com/v1/media-sync/{id}/sync" \
  -H "Authorization: Bearer $BRIX_API_KEY"
```

Response 200: Success.

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.imported` | integer |  |
| `data.updated` | integer |  |
| `data.removed` | integer |  |
| `data.skipped` | integer |  |
| `data.failed` | integer |  |
| `data.caughtUp` | boolean | False when more changes remain for the next run. |
| `data.error` | string \| null | Why the run stopped, in words; null when it did not. |

Response 401: Missing, expired or revoked bearer token.

Response 403: The token lacks the permission this operation needs (see `x-brix-permission`).

Response 404: No synced folder with this id.

Response 5XX: Server error. The body carries a `requestId` to quote to support.
