| 1 | # API conventions and editing contract |
| 2 | |
| 3 | Status: November 1 specification by GPT-6 Astra; independently approved by GPT-6 Astra (review_docs_access). Applies to |
| 4 | the shared delegated operation interface, not a replacement for editor/native |
| 5 | wire protocols. Existing operation contracts remain compatible. |
| 6 | |
| 7 | ## Resource identity and revisions |
| 8 | |
| 9 | Resource IDs are opaque and app-scoped. Never parse one app's ID as another's, |
| 10 | infer team membership from a URL, or use a returned URL as a routing argument. |
| 11 | Existing `id`, `sqid`, `sheet_id` and `tab_id` fields retain their types. Exact |
| 12 | JSON integers must survive all transports without a float conversion. |
| 13 | |
| 14 | New cross-app references use `{team,app,id,url}` with an opaque string ID and a |
| 15 | canonical member-facing URL. A reference grants no access; each destination |
| 16 | checks the current person. It is never a guest invitation or bearer URL. |
| 17 | The configured directory and app routes remain the routing authority. |
| 18 | |
| 19 | An edit supplies a canonical nonzero UUID `client_id` and `expected_revision`. |
| 20 | The precondition has the type and exact value returned by that app's read: |
| 21 | Docs `body_revision`, Sheets/Slides `revision` (decimal strings), Memoria |
| 22 | `revision` and Calendar `sequence` (integers). Revisions are equality tokens, |
| 23 | not a suite-wide clock. A new stale edit is `conflict` with no effects. |
| 24 | |
| 25 | The domain write, revision check and immutable retry receipt share one writer |
| 26 | transaction. Receipts bind authority/subject/client/team/operation/UUID and the |
| 27 | full request, including the target and precondition. Exact completed retries |
| 28 | recheck current access and the live target, return the original applied revision, |
| 29 | and never apply the edit again or overwrite later edits. Reusing a UUID with |
| 30 | different arguments is `conflict`. Removed resources are not recreated. |
| 31 | New edit acknowledgements report their original applied `revision`; read again |
| 32 | for current content. Existing create acknowledgement behavior is unchanged. |
| 33 | |
| 34 | Browser, native and delegated edits use the same canonical domain mutations. |
| 35 | Editable content retains the original app's collaboration, sealing, attribution, |
| 36 | indexing and reminder semantics. An unsupported edit is explicitly refused. |
| 37 | |
| 38 | ## Errors, pagination and compatibility |
| 39 | |
| 40 | HTTP failures use `{error:{code,message}}`. Stable codes map to 401 |
| 41 | `unauthenticated`, 403 `forbidden`, 404 `not_found`, 409 `conflict`, 413 |
| 42 | `too_large`, 415 `unsupported_media_type`, 422 `invalid`, 429 `rate_limited`, |
| 43 | 503 `unavailable`, and 500 `internal`. Gateways and clients retain the code |
| 44 | without forwarding arbitrary remote error prose, HTML or credentials. Neither |
| 45 | a timeout nor `unavailable` proves a write failed: retry with the original |
| 46 | UUID and exact request. Authorization refusals are not automatic retry loops. |
| 47 | |
| 48 | Existing pagination remains as exported: Calls uses `after/next_after/has_more`; |
| 49 | Docs, Sheets and Slides use `cursor/next_cursor`. New paginated operations use |
| 50 | opaque `cursor`, bounded `limit`, and `next_cursor`, empty at the end. Do not |
| 51 | silently rename fields in old operations. Document limits and partial results. |
| 52 | |
| 53 | Exported operation schemas are the machine contract for HTTP, CLI and MCP. |
| 54 | Removing/renaming a field, tightening accepted inputs or changing meaning needs |
| 55 | a new operation/version and a migration path. New operations are additive; |
| 56 | existing scopes do not expand to sharing, deletion or invitation delivery. |
| 57 | App exports and connection routes must agree exactly. Compatibility tests use |
| 58 | real exported contracts and behavior, not a parallel handwritten schema. |
| 59 | |
| 60 | ## Authorized next slice |
| 61 | |
| 62 | `docs_update`, `sheets_set_range`, `slides_update_deck`, `notes_get`, |
| 63 | `notes_update`, and `calendar_update_event` complete the bounded editing loop. |
| 64 | Per-app amendments define supported content and the tests behind each boundary. |
| 65 | The scheduling amendment adds resumable composition of already authorized |
| 66 | creates. Search/export/sharing/history gaps remain listed as gaps; this slice |
| 67 | does not claim every browser action is automated. |
| 68 | |