# Platform services

Long-running operations, previews, realtime channels and approval requests.

0 operation(s) for tokens, 9 app-only. The full schemas are in [openapi.json](https://docs.youniton.com/openapi.json) (search the operation ID).

## The workspace's pending client approvals and the requests that need action

`GET /approval-requests`

- Operation ID: `listPendingApprovals`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-14

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `filter[segment]` | query | string | no |  |
| `filter[projectKey]` | query | string | no | One project's requests; an unknown key and a project the reader cannot see both answer an empty list (hidden ≡ missing, REV-POR2-09). |
| `filter[requestedBy]` | query | string | no | me for the caller's own requests. |
| `q` | query | string | no | G-CP-01 (XM-1315): 2–120 characters, case-insensitive: the ticket key starts with the text, or the ticket title that the reader sees contains it. The segment counts do not apply q. |
| `sort` | query | string | no | G-CP-03 (XM-1315): waiting = overdue first, then the oldest request (the default); requestedAt / -requestedAt = the oldest / the newest request first; ticket / -ticket = by project key, then ticket number. The cursor is bound to q and sort. |
| `page[cursor]` | query | string | no | The opaque cursor of the previous page's links.next (05-api §5). |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | Rows in the order of sort (default overdue first then oldest first), with the segment counts. | application/json | `object` |
| 400 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Remind the request's eligible reviewers (at most once per cooldown)

`POST /approval-requests/{requestId}/remind`

- Operation ID: `remindApprovalReviewers`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-14

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `Idempotency-Key` | header | string | yes | Durable command receipt key (05-api §7.2); the generated client sends one UUIDv7 per user intent. |
| `requestId` | path | string (uuid) | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The request with its updated reminders. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 422 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Withdraw an open approval request

`POST /approval-requests/{requestId}/withdraw`

- Operation ID: `withdrawApproval`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-13

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `requestId` | path | string (uuid) | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The withdrawn request. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## The caller's own long-running operations in the tenant, newest first, cursor-paged

`GET /operations`

- Operation ID: `listOperations`
- Call with: Session of the Youniton apps (app only)
- Feature: F-AUD-03

Requester-only (05-api §10.2; XM-16) — never another member's. filter[state] and filter[kind] are comma lists ("any of"); the next link keeps them. A cursor is sealed to its reader, tenant and filters.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `filter[state]` | query | string | no | Any of queued, running, succeeded, failed, cancelled (comma-separated). |
| `filter[kind]` | query | string | no | Any of the operation kinds (comma-separated), e.g. audit_export. |
| `page[size]` | query | integer | no |  |
| `page[cursor]` | query | string | no | The opaque cursor of the previous page's links.next (05-api §5). |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | One page of the caller's operations. | application/json | `object` |
| 400 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 401 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 429 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## One of the caller's long-running operations — its state, progress, result or problem

`GET /operations/{operationId}`

- Operation ID: `getOperation`
- Call with: Session of the Youniton apps (app only)
- Feature: F-AUD-03

Requester-only (05-api §10.2; XM-16). Retry-After tells a poller when to ask again while the operation is queued or running; links.result is the authorised download of an export's file until it expires.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `operationId` | path | string (uuid) | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The operation. | application/json | `object` |
| 401 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 429 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Open or renew View as client for one project's client role — a read-only token of at most 15 minutes

`POST /previews`

- Operation ID: `startClientView`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-05

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |

Request body (application/json, required): `PreviewStartRequest`

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The session, its token and expiry, the role, the project and the organisation. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 422 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Whether View as client is available for a project and which client roles it offers

`GET /previews/options`

- Operation ID: `getPreviewOptions`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-05

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `projectKey` | query | string | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | Availability, the offered roles, the default and whether the selector is shown. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## End View as client; the only operation a preview token may write

`POST /previews/{previewId}/end`

- Operation ID: `endClientView`
- Call with: Session of the Youniton apps (app only)
- Feature: F-POR-05

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `previewId` | path | string (uuid) | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 204 | The session ended (or had already ended). |  |  |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## The reader's current tenant and user channel names, with their audience epochs (XM-116)

`GET /realtime/channels`

- Operation ID: `getRealtimeChannelNames`
- Call with: Session of the Youniton apps (app only)
- Feature: F-WSP-01

`private-tenant.{t}.v{n}` and `private-tenant.{t}.user.{u}.v{n}`: every narrowing of Access's authority-change map that reaches the channels' audience moves `n` (`tenancy.channel-epoch`), publishers publish on the current names only and `/broadcasting/auth` signs only them, so an authorisation fetched before a narrowing subscribes to a name nobody publishes on (`07-…` §5.4; `08-…` §6.9). The workspace shell and the portal read the names when they open and again on `channels.rotated` (and on reconnect). `tenant` is null for a client guest (the tenant channel is internal); a View as client is refused. Members and client guests of the tenant; an operator under a support grant answers 404.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The channel names to subscribe. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
