# publishSpacePage

Publish HTML as a Library Page that opens rendered (strict page CSP: HTML loading anything from outside Goliath is refused). Lands in `destination`, else your Pages folder. `actorGrn` (required): the dev session.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "publishSpacePage", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `input`: `PublishSpacePageInput!` (required)
  - `title`: `String!` (required). The page's title; its file name is the title with .html.
  - `html`: `String!` (required). The whole HTML document. It runs under the strict page CSP: nothing loads from outside Goliath.
  - `destination`: `SpaceDestinationInput`. Where it lands; omitted, the key owner's own Pages folder.
    - `spaceId`: `ID!` (required)
    - `folderId`: `ID`. Null for the space root.
  - `creationKey`: `String`. Any unique string, so a retry returns the page it already made.
  - `actorGrn`: `String!` (required). Who is making it: `DevSession_<sessionId>`, a dev session working for the key's owner.

## Response (data, an example)

```json
{
  "spacesMutation": {
    "publishPage": {
      "id": "<ID>",
      "spaceId": "<ID>",
      "parentId": "<ID>",
      "name": "…",
      "fileType": "…",
      "sizeBytes": 0,
      "currentVersion": {
        "id": "<ID>",
        "versionNumber": 0
      }
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "publishSpacePage",
    "variables": {
      "input": {
        "title": "<String>",
        "html": "<String>",
        "actorGrn": "<String>"
      }
    }
  }'
```
