{"openapi":"3.1.0","info":{"title":"Peony Public API","version":"1.0.0","description":"Peony's public API v1 currently exposes 17 operations for listing, retrieving, creating, replacing, and deleting folder links, managing their access rules, preparing an invitation-email logo, uploading and deleting files, creating and sending agreements from templates, and reading data rooms, their viewer groups and recipient activity.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip) for a dependency-free Node.js package covering every workflow. You can also import [/api/v1/openapi.json](/api/v1/openapi.json) into Postman or Insomnia.\n\n## Finding a folder ID\n\nFolder discovery and creation are not currently available through the public API.\n\n**Folder:** Open the folder in Peony. Its URL contains `/folders/{folderId}`. Copy the UUID immediately after `/folders/` and before any following slash, query string, or fragment.\n\n**Data room:** Open the data room from **Data rooms** and stay at its top-level folder. Copy the UUID after `/folders/` from the `/folders/{rootFolderId}` URL. Use that UUID when creating or listing links for the data room or uploading a file at its root.\n\n## Authentication\n\nAPI keys are server-side credentials: never embed one in browser code, a mobile app, or a public repository. Send your key to Peony as `Authorization: Bearer <api-key>`. Do not send `X-API-Key`; these operations reject it even when the Bearer credential is valid. New keys start with no access, so select only the scopes your integration needs: `links:read` — Read Folder Links, their access-rule collections, and their granular permission entries. `links:write` — Create and manage Folder Links, their access rules, their granular permission entries, and supported Link assets. `files:write` — Start and complete uploads into authorised folders. `files:delete` — Permanently delete individual files in authorised folders. `agreements:send` — Create and send agreements from existing templates. `data-rooms:read` — List the data rooms the key's creator can access. `activity:read` — Read data-room viewer groups and their viewing and NDA activity. `qa:read` — Read data-room Q&A question content, including questions in viewer activity. No scope implies another. A missing scope answers `403 insufficient_scope` whose single `details` entry lists the `requiredScopes` of the check that failed. A key acts as the person who created it, in that key's workspace: it stops working if that person leaves the workspace or the workspace turns the API off, and it never bypasses their ordinary folder, template, or plan restrictions.\n\n## Idempotency\n\n`POST /api/v1/folders/{folderId}/links`, `POST /api/v1/link-assets/upload-targets`, `POST /api/v1/folders/{folderId}/uploads`, `PUT /api/v1/links/{linkId}`, `PATCH /api/v1/links/{linkId}/access-rules`, `PATCH /api/v1/links/{linkId}/granular-permissions`, `POST /api/v1/agreements/send` each require a caller-generated `Idempotency-Key` header. Generate a fresh random UUID for each logical operation and never reuse one value across different operations. `POST /api/v1/uploads/complete` does not use this header because its signed completion grant identifies the upload and makes an exact retry safe. `GET /api/v1/folders/{folderId}/links`, `GET /api/v1/links/{linkId}`, `GET /api/v1/links/{linkId}/access-rules`, `GET /api/v1/links/{linkId}/granular-permissions`, `GET /api/v1/data-rooms`, `GET /api/v1/data-rooms/{roomId}/viewers`, `GET /api/v1/data-rooms/{roomId}/activity` are reads and do not use this header; supplying it has no effect. `DELETE /api/v1/links/{linkId}`, `DELETE /api/v1/files/{fileId}` also ignore it: the effect is already idempotent, because repeating one answers `404` rather than repeating the first success.\n\nThis is duplicate suppression, not response replay. For 24 hours Peony remembers that an API key, operation, and `Idempotency-Key` combination was seen. Repeating that combination returns `409 idempotency_request_seen`; it does not return the first response or prove that the first attempt completed.\n\n## Agreements\n\n`POST /api/v1/agreements/send` creates a new agreement from an existing template and sends it in one call; it never sends an existing agreement. A `200` may carry a `warning` when some invitation emails were not submitted: the agreement is still sent, so share it manually and do not repeat the request. The example package includes a runnable client and the AGREEMENTS.md guide to templates, recipients, fields, and retries. [Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip).\n\n## Data rooms and recipient activity\n\n`GET /api/v1/data-rooms` lists the rooms the key's creator can access. `GET /api/v1/data-rooms/{roomId}/viewers` lists the room's observed viewer groups; look one up by `email` or `q`. Pass its `groupId` as the required `viewerGroupId` of `GET /api/v1/data-rooms/{roomId}/activity` to read that group's views, NDA acceptances and questions, newest first, with cursor pagination. Grant `data-rooms:read`, `activity:read` and `qa:read` for the complete flow; an `activity:read`-only key must name the non-question types explicitly. You own polling and storage: activity can arrive late, and these reads are not a change feed.\n\n## Conditional Link operations\n\nCreating a link, retrieving one, replacing its settings, patching its access rules, and patching its granular permissions each return an opaque strong `ETag` for that link's configuration.\n\nRetain the complete quoted string exactly as returned and echo it unchanged as `If-Match` on a conditional operation. `PUT /api/v1/links/{linkId}` and `PATCH /api/v1/links/{linkId}/granular-permissions` both require the header: without it the answer is `428 precondition_required`. With a tag that is weak, was not issued by this API, or is simply no longer current, the answer is `412 precondition_failed` and nothing is changed. Blank, unquoted, or otherwise malformed header syntax, including more than one tag, is caller error and answers `400 validation_failed`.\n\n`If-Match: *` is also accepted and means \"apply to whatever representation exists now\". It is a deliberate force that skips only the revision comparison, so it can overwrite configuration another client committed since you last read the link; every authorization, liveness, locking, and validation rule still applies, and an unreachable link still answers `404`. Prefer the exact returned tag for ordinary read-edit-write clients and reserve `*` for cases where losing a concurrent edit is acceptable.\n\nAfter a `412`, retrieve the link again, reapply your intended edit to the latest state, and send the operation as a fresh logical attempt with a new `Idempotency-Key`.\n\nThe access-rule `PATCH` is a set-semantic delta rather than a rewrite of state you read, so it deliberately takes no `If-Match`. It still returns the link's current tag, and a batch that changed anything supersedes any complete view you were holding. Edits made in the Peony app stale a held tag the same way. `DELETE` is unconditional.\n\nThe tag is transport metadata, not data: it never appears in a response body, it is not a revision number, a timestamp, or a hash of the payload to decode, and it is not a cache validator — link responses remain `Cache-Control: no-store` and these operations do not support `If-None-Match`.\n\n## Direct storage uploads\n\nThe logo-target and file-initiation operations return an `upload` object. Upload the bytes directly to storage before making the next Peony API call:\n\n1. Send a separate request to `upload.url` using `upload.method` and the raw file or logo bytes as the body.\n\n2. Copy every header in `upload.requiredHeaders` without changing or omitting its value. In particular, `Content-Length` must equal the number of bytes in the body.\n\n3. Do not add your Peony `Authorization` or `Idempotency-Key` header, and do not send Peony cookies, to the storage URL. Those credentials belong only on requests to your Peony API origin.\n\nThe target expires at `upload.expiresAt`. `If-None-Match: *` prevents overwriting an existing object. A `412` means this PUT wrote nothing because the reserved object already exists. If you are retrying after losing the first PUT response, continue with the next Peony API call; Peony validates the stored object before accepting it. If the `412` is unexpected, start a new workflow instead of repeatedly retrying the PUT.\n\n## Rate limits\n\nPublic API requests are rate limited. The values below are defaults. Each limit is enforced independently for the API key and for its team, so separate keys in one team still share the team limits. They are separate ceilings that overlap rather than one budget stated several ways: a request is admitted only if it passes every ceiling that applies to it.\n\n- For any one operation, at most 1 request is admitted per second. This applies per operation, so two different operations do not share that slot.\n- Across different operations, at most 3 writes are admitted per second. A coupled pair such as initiating and then completing an upload therefore needs no artificial delay.\n- 50 writes per 60 seconds and 200 writes per 300 seconds across all operations.\n- Read operations admit 5 per second, 100 per 60 seconds, and 400 per 300 seconds.\n- Across reads and writes together, at most 6 requests per second, 125 per 60 seconds, and 500 per 300 seconds are admitted.\n- File-upload initiation also counts the declared `contentLength` against a rolling 24-hour byte budget equal to the workspace's current storage allowance. This abuse limit is not a storage reservation; ordinary file-size and workspace-capacity checks still apply.\n\nThe class and all-operation windows are additional aggregate ceilings above the per-operation one, so the per-operation rule is usually what a caller meets first. Reads of different operations share the aggregate read ceiling, so paging several read operations at once can meet it.\n\n`HEAD` is admitted as the matching `GET` operation rather than receiving a budget of its own, so a `HEAD` and a `GET` on one route compete for the same slot.\n\nA request over any limit returns HTTP `429` with error code `rate_limited` and a `Retry-After` header in whole seconds. Wait for at least that many seconds before trying again."},"servers":[{"url":"https://app.peony.ink"}],"components":{"securitySchemes":{"bearerApiKey":{"type":"http","scheme":"bearer","description":"Send the Peony API key only as `Authorization: Bearer <api-key>`. Do not send `X-API-Key`; these operations reject it even when the Bearer credential is valid."}},"schemas":{"Links_LinkTarget":{"type":"object","properties":{"type":{"type":"string","enum":["folder"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},"Links_GranularPermissionMode":{"type":"string","minLength":1,"maxLength":64,"description":"Resolution mode for this link's granular permissions, applied to non-root descendants of its target folder while `enabled` is true. `inherit`: a descendant with no stored entry is visible. `hidden_by_default`: a descendant with no stored entry is hidden. Under either mode a descendant is only effectively visible while every non-root ancestor folder resolves visible too, and granular visibility never hides the link's own target folder. While `enabled` is false the stored mode and entries are dormant rather than deleted: they narrow nothing, recipients get the link's ordinary non-granular access, and the stored values apply again once the policy is enabled. The link's other access gates, and the requirement that the resource still be live inside the link's subtree, apply in both states. Read-only: the server owns the mode and no public request accepts it. Ordinary folder links always use `inherit`; exact data-room root links take the Data Room's setting when created, which is changed only in Data Room settings. Treat the value as an extensible string rather than a closed enum.","example":"hidden_by_default"},"Links_CreatedLinkSettings":{"type":"object","properties":{"name":{"type":"string","maxLength":1100},"inviteOnly":{"type":"boolean"},"requireEmail":{"type":"boolean"},"verifyEmail":{"type":"boolean"},"expiresAt":{"type":["string","null"],"format":"date-time"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"},"showVersionHistory":{"type":"boolean"},"aiEnabled":{"type":"boolean"},"welcomeMessage":{"type":["string","null"],"minLength":1,"maxLength":10000},"inviteEmail":{"type":"object","properties":{"enabled":{"type":"boolean"},"subject":{"type":["string","null"],"maxLength":1200},"bodyBeforeCta":{"type":["string","null"],"maxLength":3000},"bodyAfterUrl":{"type":["string","null"],"maxLength":3000},"logoFileId":{"type":["string","null"],"format":"uuid"}},"required":["enabled","subject","bodyBeforeCta","bodyAfterUrl","logoFileId"],"additionalProperties":false},"watermark":{"type":["object","null"],"properties":{"content":{"type":"string","maxLength":2000},"footerContent":{"type":["string","null"],"maxLength":2000},"position":{"type":"string","enum":["top","left","right","bottom","center"]},"textSize":{"anyOf":[{"type":"string","enum":["small","medium","large"]},{"type":"integer","minimum":1,"maximum":500}]},"opacity":{"type":"integer","minimum":1,"maximum":100},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"rotation":{"type":"integer","minimum":0,"maximum":359},"tiled":{"type":"boolean"}},"required":["content","footerContent","position","textSize","opacity","color","rotation","tiled"],"additionalProperties":false},"screenshotProtection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["off"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["basic"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["advanced"]},"heightPercent":{"type":"integer","minimum":10,"maximum":90}},"required":["mode","heightPercent"],"additionalProperties":false}]},"accessQuestions":{"type":"object","properties":{"enabled":{"type":"boolean"},"fields":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","maxLength":2000}},"required":["label"],"additionalProperties":false},"maxItems":50}},"required":["enabled","fields"],"additionalProperties":false},"appearance":{"type":"object","properties":{"theme":{"type":"string","enum":["system","light","dark"]}},"required":["theme"],"additionalProperties":false},"emailAllowList":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false},"emailBlockList":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false},"active":{"type":"boolean"},"granularPermissions":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"$ref":"#/components/schemas/Links_GranularPermissionMode"},"overrides":{"type":"array","items":{"type":"object","properties":{"resource":{"type":"object","properties":{"type":{"type":"string","enum":["folder","file","webLink","agreement","resignableAgreement"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},"visible":{"type":"boolean"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"}},"required":["resource","visible"],"additionalProperties":false},"maxItems":10000}},"required":["enabled","mode","overrides"],"additionalProperties":false},"password":{"anyOf":[{"type":"object","properties":{"enabled":{"type":"boolean","enum":[false]}},"required":["enabled"],"additionalProperties":false},{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]},"value":{"type":"string","minLength":4,"writeOnly":true}},"required":["enabled"],"additionalProperties":false}]},"nda":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","format":"uuid"}},"required":["type","templateId"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},{"type":"null"}]}},"required":["name","inviteOnly","requireEmail","verifyEmail","expiresAt","allowDownloads","allowUploads","showVersionHistory","aiEnabled","welcomeMessage","inviteEmail","watermark","screenshotProtection","accessQuestions","appearance","emailAllowList","emailBlockList","active","granularPermissions","password","nda"],"additionalProperties":false},"Links_LinkCreatedDetails":{"type":"object","properties":{"nda":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"name":{"type":"string","minLength":1,"maxLength":1000}},"required":["type","name"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"name":{"type":"string","minLength":1,"maxLength":1000},"mimeType":{"type":"string","minLength":1,"maxLength":255},"versionNumber":{"type":"integer","minimum":1}},"required":["type","name","mimeType","versionNumber"],"additionalProperties":false},{"type":"null"}]},"accessLists":{"type":"object","properties":{"inviteOnly":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false},"emailAllow":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false},"emailBlock":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false}},"required":["inviteOnly","emailAllow","emailBlock"],"additionalProperties":false}},"required":["nda","accessLists"],"additionalProperties":false},"Links_InvitationsResult":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["submitted"]},"requested":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"submitted":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"failed":{"type":"number","enum":[0]},"failedRecipients":{"type":"array","items":{"type":"string"},"maxItems":0},"reason":{"type":"null"},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["invitation_submission_unknown"]},"message":{"type":"string","enum":["The link was saved, but invitation submission could not be confirmed."]}},"required":["code","message"],"additionalProperties":false},"maxItems":0}},"required":["status","requested","submitted","failed","failedRecipients","reason","warnings"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["failed"]},"requested":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"submitted":{"type":"number","enum":[0]},"failed":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"failedRecipients":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":1000},"reason":{"type":"null"},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["invitation_submission_unknown"]},"message":{"type":"string","enum":["The link was saved, but invitation submission could not be confirmed."]}},"required":["code","message"],"additionalProperties":false},"maxItems":0}},"required":["status","requested","submitted","failed","failedRecipients","reason","warnings"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["unknown"]},"requested":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"submitted":{"type":"null"},"failed":{"type":"null"},"failedRecipients":{"type":"array","items":{"type":"string"},"maxItems":0},"reason":{"type":"null"},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["invitation_submission_unknown"]},"message":{"type":"string","enum":["The link was saved, but invitation submission could not be confirmed."]}},"required":["code","message"],"additionalProperties":false},"minItems":1,"maxItems":1}},"required":["status","requested","submitted","failed","failedRecipients","reason","warnings"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_requested"]},"requested":{"type":"integer","minimum":0,"maximum":1000},"submitted":{"type":"number","enum":[0]},"failed":{"type":"number","enum":[0]},"failedRecipients":{"type":"array","items":{"type":"string"},"maxItems":0},"reason":{"type":["string","null"],"enum":["link_inactive"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["invitation_submission_unknown"]},"message":{"type":"string","enum":["The link was saved, but invitation submission could not be confirmed."]}},"required":["code","message"],"additionalProperties":false},"maxItems":0}},"required":["status","requested","submitted","failed","failedRecipients","reason","warnings"],"additionalProperties":false}]},"Links_LinkMutationResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","maxLength":2000,"format":"uri","description":"Recipient URL of the Link, of the form https://<host>/view/<link id>. The host follows the workspace's current domain settings: a data room's selected domain for links to that room's root folder, otherwise the workspace default domain. It can change when those settings change; the Link ID stays the same. It contains no query, fragment, recipient identity, verification or access code, or signed token."},"target":{"$ref":"#/components/schemas/Links_LinkTarget"},"settings":{"$ref":"#/components/schemas/Links_CreatedLinkSettings"},"details":{"$ref":"#/components/schemas/Links_LinkCreatedDetails"},"invitations":{"$ref":"#/components/schemas/Links_InvitationsResult"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","url","target","settings","details","invitations","createdAt","updatedAt"],"additionalProperties":false},"Links_LinkMutationResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Links_LinkMutationResource"}},"required":["data"],"additionalProperties":false},"PublicApiValidationDetail":{"type":"object","properties":{"path":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,300}$"},"code":{"type":"string","enum":["unknown_field","missing_field","invalid_type","invalid_format","invalid_value","too_small","too_large","too_many_items","invalid_combination"]},"message":{"type":"string","minLength":1,"maxLength":500}},"required":["path","code","message"],"additionalProperties":false},"PublicApiRequiredScopesDetail":{"type":"object","properties":{"requiredScopes":{"type":"array","items":{"type":"string","enum":["agreements:send","links:read","links:write","files:write","files:delete","data-rooms:read","activity:read","qa:read"]},"minItems":1,"maxItems":8}},"required":["requiredScopes"],"additionalProperties":false,"description":"The API-key scopes required by the permission check that failed. Every listed scope is required. The list names requirements, not the scopes the key holds."},"PublicApiIdempotencyKey":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[!-~]+$"},"Links_CreateFolderLinkRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":1100},"inviteOnly":{"type":"boolean"},"requireEmail":{"type":"boolean"},"verifyEmail":{"type":"boolean"},"expiresAt":{"type":["string","null"],"format":"date-time"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"},"showVersionHistory":{"type":"boolean"},"aiEnabled":{"type":"boolean"},"welcomeMessage":{"type":["string","null"],"minLength":1,"maxLength":10000},"inviteEmail":{"type":"object","properties":{"enabled":{"type":"boolean"},"subject":{"type":["string","null"],"maxLength":1200},"bodyBeforeCta":{"type":["string","null"],"maxLength":3000},"bodyAfterUrl":{"type":["string","null"],"maxLength":3000},"logoFileId":{"type":["string","null"],"format":"uuid"}},"required":["enabled","subject","bodyBeforeCta","bodyAfterUrl","logoFileId"],"additionalProperties":false},"watermark":{"type":["object","null"],"properties":{"content":{"type":"string","maxLength":2000},"footerContent":{"type":["string","null"],"maxLength":2000},"position":{"type":"string","enum":["top","left","right","bottom","center"]},"textSize":{"anyOf":[{"type":"string","enum":["small","medium","large"]},{"type":"integer","minimum":1,"maximum":500}]},"opacity":{"type":"integer","minimum":1,"maximum":100},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"rotation":{"type":"integer","minimum":0,"maximum":359},"tiled":{"type":"boolean"}},"required":["content","footerContent","position","textSize","opacity","color","rotation","tiled"],"additionalProperties":false},"screenshotProtection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["off"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["basic"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["advanced"]},"heightPercent":{"type":"integer","minimum":10,"maximum":90}},"required":["mode","heightPercent"],"additionalProperties":false}]},"accessQuestions":{"type":"object","properties":{"enabled":{"type":"boolean"},"fields":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","maxLength":2000}},"required":["label"],"additionalProperties":false},"maxItems":50}},"required":["enabled","fields"],"additionalProperties":false},"appearance":{"type":"object","properties":{"theme":{"type":"string","enum":["system","light","dark"]}},"required":["theme"],"additionalProperties":false},"active":{"type":"boolean","default":true,"description":"Whether the created link is active. Defaults to `true`. Create an inactive link to stage its full configuration — including recipients — without sending any invitation; activate it later with a replace request."},"granularPermissions":{"type":"object","properties":{"enabled":{"type":"boolean"},"overrides":{"type":"array","items":{"type":"object","properties":{"resource":{"type":"object","properties":{"type":{"type":"string","enum":["folder","file","webLink","agreement","resignableAgreement"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},"visible":{"type":"boolean"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"}},"required":["resource"],"additionalProperties":false},"maxItems":1000}},"required":["enabled","overrides"],"additionalProperties":false},"inviteAllowList":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1000},"emailAllowList":{"type":"object","properties":{"enabled":{"type":"boolean"},"entries":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1500}},"required":["enabled","entries"],"additionalProperties":false},"emailBlockList":{"type":"object","properties":{"enabled":{"type":"boolean"},"entries":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1500}},"required":["enabled","entries"],"additionalProperties":false},"reservedLinkId":{"type":"string","format":"uuid","description":"The `reservedLinkId` returned by the invite-email logo upload-target operation. Supply it only together with `inviteEmail.logoFileId` from the same response; omit it and the server generates the link ID."},"password":{"anyOf":[{"type":"object","properties":{"enabled":{"type":"boolean","enum":[false]}},"required":["enabled"],"additionalProperties":false},{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]},"value":{"type":"string","minLength":4,"writeOnly":true}},"required":["enabled","value"],"additionalProperties":false}]},"nda":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","format":"uuid"}},"required":["type","templateId"],"additionalProperties":false}},"required":["name","inviteOnly","requireEmail","verifyEmail","expiresAt","allowDownloads","allowUploads","showVersionHistory","aiEnabled","welcomeMessage","inviteEmail","watermark","screenshotProtection","accessQuestions","appearance","granularPermissions","inviteAllowList","emailAllowList","emailBlockList","password","nda"],"additionalProperties":false},"Links_NewLinkAssetUploadTarget":{"type":"object","properties":{"purpose":{"type":"string","enum":["invite_email_logo"]},"fileId":{"type":"string","format":"uuid"},"upload":{"type":"object","properties":{"method":{"type":"string","enum":["PUT"]},"url":{"type":"string","maxLength":4000,"format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"requiredHeaders":{"type":"object","properties":{"If-None-Match":{"type":"string","enum":["*"]},"Content-Type":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"Content-Length":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"}},"required":["If-None-Match","Content-Type","Content-Length"],"additionalProperties":false}},"required":["method","url","expiresAt","requiredHeaders"],"additionalProperties":false},"reservedLinkId":{"type":"string","format":"uuid"}},"required":["purpose","fileId","upload","reservedLinkId"],"additionalProperties":false},"Links_ExistingLinkAssetUploadTarget":{"type":"object","properties":{"purpose":{"type":"string","enum":["invite_email_logo"]},"fileId":{"type":"string","format":"uuid"},"upload":{"type":"object","properties":{"method":{"type":"string","enum":["PUT"]},"url":{"type":"string","maxLength":4000,"format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"requiredHeaders":{"type":"object","properties":{"If-None-Match":{"type":"string","enum":["*"]},"Content-Type":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"Content-Length":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"}},"required":["If-None-Match","Content-Type","Content-Length"],"additionalProperties":false}},"required":["method","url","expiresAt","requiredHeaders"],"additionalProperties":false},"linkId":{"type":"string","format":"uuid"}},"required":["purpose","fileId","upload","linkId"],"additionalProperties":false},"Links_LinkAssetUploadTargetResponse":{"type":"object","properties":{"data":{"anyOf":[{"$ref":"#/components/schemas/Links_NewLinkAssetUploadTarget"},{"$ref":"#/components/schemas/Links_ExistingLinkAssetUploadTarget"}]}},"required":["data"],"additionalProperties":false},"Links_LinkAssetUploadTargetSelector":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["new_link"]},"folderId":{"type":"string","format":"uuid"}},"required":["type","folderId"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["existing_link"]},"linkId":{"type":"string","format":"uuid"}},"required":["type","linkId"],"additionalProperties":false}]},"Uploads_InitiateUploadTarget":{"type":"object","properties":{"method":{"type":"string","enum":["PUT"]},"url":{"type":"string","maxLength":4000,"format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"requiredHeaders":{"type":"object","properties":{"Content-Type":{"type":"string","minLength":1,"maxLength":255},"Content-Length":{"type":"string","pattern":"^[1-9][0-9]{0,18}$"},"If-None-Match":{"type":"string","enum":["*"]}},"required":["Content-Type","Content-Length","If-None-Match"],"additionalProperties":false}},"required":["method","url","expiresAt","requiredHeaders"],"additionalProperties":false},"Uploads_InitiateUploadResponseItem":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":1000},"upload":{"$ref":"#/components/schemas/Uploads_InitiateUploadTarget"}},"required":["fileName","upload"],"additionalProperties":false},"Uploads_InitiateUploadResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"uploadId":{"type":"string","minLength":1,"maxLength":128},"completionGrant":{"type":"string","minLength":1,"maxLength":16384},"grantExpiresAt":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Uploads_InitiateUploadResponseItem"},"minItems":1,"maxItems":1}},"required":["uploadId","completionGrant","grantExpiresAt","items"],"additionalProperties":false}},"required":["data"],"additionalProperties":false},"Uploads_InitiateUploadItem":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":1000},"contentType":{"type":"string","maxLength":255},"contentLength":{"type":"integer","exclusiveMinimum":0,"minimum":-9007199254740991,"maximum":9007199254740991,"description":"Exact number of file bytes you will upload. Peony returns the same value as the `Content-Length` entry in `upload.requiredHeaders`; copy that header unchanged and send a body of exactly this size. Completion rejects a stored object whose verified size differs."}},"required":["fileName","contentLength"],"additionalProperties":false},"Uploads_InitiateUploadRequest":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Uploads_InitiateUploadItem"},"minItems":1,"maxItems":1}},"required":["items"],"additionalProperties":false},"Uploads_CompletedUploadFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"folderId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":1000},"contentType":{"type":"string","minLength":1,"maxLength":255},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"minimum":-9007199254740991,"maximum":9007199254740991,"description":"Server-verified size of the stored object in bytes. After a successful completion this equals the `contentLength` declared when the upload was initiated."},"hasThumbnail":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","folderId","name","contentType","sizeBytes","hasThumbnail","createdAt"],"additionalProperties":false},"Uploads_CompleteUploadResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"uploadId":{"type":"string","minLength":1,"maxLength":128},"file":{"$ref":"#/components/schemas/Uploads_CompletedUploadFile"}},"required":["uploadId","file"],"additionalProperties":false}},"required":["data"],"additionalProperties":false},"Uploads_CompleteUploadRequest":{"type":"object","properties":{"completionGrant":{"type":"string","minLength":1,"maxLength":16384}},"required":["completionGrant"],"additionalProperties":false},"Links_LinkSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","maxLength":2000,"format":"uri","description":"Recipient URL of the Link, of the form https://<host>/view/<link id>. The host follows the workspace's current domain settings: a data room's selected domain for links to that room's root folder, otherwise the workspace default domain. It can change when those settings change; the Link ID stays the same. It contains no query, fragment, recipient identity, verification or access code, or signed token."},"target":{"$ref":"#/components/schemas/Links_LinkTarget"},"name":{"type":"string","minLength":1,"maxLength":1000},"active":{"type":"boolean"},"inviteOnly":{"type":"boolean"},"requireEmail":{"type":"boolean"},"verifyEmail":{"type":"boolean"},"inviteEmailCount":{"type":"integer","minimum":0},"inviteDomainCount":{"type":"integer","minimum":0},"expiresAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","url","target","name","active","inviteOnly","requireEmail","verifyEmail","inviteEmailCount","inviteDomainCount","expiresAt","createdAt","updatedAt"],"additionalProperties":false},"PublicApiOpaqueCursor":{"type":["string","null"],"minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"},"Links_ListFolderLinksResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Links_LinkSummary"},"maxItems":100},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false}},"required":["data","page"],"additionalProperties":false},"Links_LinkSettings":{"type":"object","properties":{"name":{"type":"string","maxLength":1100},"inviteOnly":{"type":"boolean"},"requireEmail":{"type":"boolean"},"verifyEmail":{"type":"boolean"},"expiresAt":{"type":["string","null"],"format":"date-time"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"},"showVersionHistory":{"type":"boolean"},"aiEnabled":{"type":"boolean"},"welcomeMessage":{"type":["string","null"],"minLength":1,"maxLength":10000},"inviteEmail":{"type":"object","properties":{"enabled":{"type":"boolean"},"subject":{"type":["string","null"],"maxLength":1200},"bodyBeforeCta":{"type":["string","null"],"maxLength":3000},"bodyAfterUrl":{"type":["string","null"],"maxLength":3000},"logoFileId":{"type":["string","null"],"format":"uuid"}},"required":["enabled","subject","bodyBeforeCta","bodyAfterUrl","logoFileId"],"additionalProperties":false},"watermark":{"type":["object","null"],"properties":{"content":{"type":"string","maxLength":2000},"footerContent":{"type":["string","null"],"maxLength":2000},"position":{"type":"string","enum":["top","left","right","bottom","center"]},"textSize":{"anyOf":[{"type":"string","enum":["small","medium","large"]},{"type":"integer","minimum":1,"maximum":500}]},"opacity":{"type":"integer","minimum":1,"maximum":100},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"rotation":{"type":"integer","minimum":0,"maximum":359},"tiled":{"type":"boolean"}},"required":["content","footerContent","position","textSize","opacity","color","rotation","tiled"],"additionalProperties":false},"screenshotProtection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["off"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["basic"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["advanced"]},"heightPercent":{"type":"integer","minimum":10,"maximum":90}},"required":["mode","heightPercent"],"additionalProperties":false}]},"accessQuestions":{"type":"object","properties":{"enabled":{"type":"boolean"},"fields":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","maxLength":2000}},"required":["label"],"additionalProperties":false},"maxItems":50}},"required":["enabled","fields"],"additionalProperties":false},"appearance":{"type":"object","properties":{"theme":{"type":"string","enum":["system","light","dark"]}},"required":["theme"],"additionalProperties":false},"emailAllowList":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false},"emailBlockList":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false},"active":{"type":"boolean"},"password":{"anyOf":[{"type":"object","properties":{"enabled":{"type":"boolean","enum":[false]}},"required":["enabled"],"additionalProperties":false},{"type":"object","properties":{"enabled":{"type":"boolean","enum":[true]},"value":{"type":"string","minLength":4,"writeOnly":true}},"required":["enabled"],"additionalProperties":false}]},"nda":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","format":"uuid"}},"required":["type","templateId"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},{"type":"null"}]}},"required":["name","inviteOnly","requireEmail","verifyEmail","expiresAt","allowDownloads","allowUploads","showVersionHistory","aiEnabled","welcomeMessage","inviteEmail","watermark","screenshotProtection","accessQuestions","appearance","emailAllowList","emailBlockList","active","password","nda"],"additionalProperties":false},"Links_GranularPermissionsSummary":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"$ref":"#/components/schemas/Links_GranularPermissionMode"},"entryCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["enabled","mode","entryCount"],"additionalProperties":false},"Links_LinkDetails":{"type":"object","properties":{"nda":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"name":{"type":"string","minLength":1,"maxLength":1000}},"required":["type","name"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"name":{"type":"string","minLength":1,"maxLength":1000},"mimeType":{"type":"string","minLength":1,"maxLength":255},"versionNumber":{"type":"integer","minimum":1}},"required":["type","name","mimeType","versionNumber"],"additionalProperties":false},{"type":"null"}]},"accessLists":{"type":"object","properties":{"inviteOnly":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false},"emailAllow":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false},"emailBlock":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["count"],"additionalProperties":false}},"required":["inviteOnly","emailAllow","emailBlock"],"additionalProperties":false},"granularPermissions":{"$ref":"#/components/schemas/Links_GranularPermissionsSummary"}},"required":["nda","accessLists","granularPermissions"],"additionalProperties":false},"Links_LinkResource":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","maxLength":2000,"format":"uri","description":"Recipient URL of the Link, of the form https://<host>/view/<link id>. The host follows the workspace's current domain settings: a data room's selected domain for links to that room's root folder, otherwise the workspace default domain. It can change when those settings change; the Link ID stays the same. It contains no query, fragment, recipient identity, verification or access code, or signed token."},"target":{"$ref":"#/components/schemas/Links_LinkTarget"},"settings":{"$ref":"#/components/schemas/Links_LinkSettings"},"details":{"$ref":"#/components/schemas/Links_LinkDetails"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","url","target","settings","details","createdAt","updatedAt"],"additionalProperties":false},"Links_LinkResourceResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Links_LinkResource"}},"required":["data"],"additionalProperties":false},"LinkConfigurationEntityTag":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","description":"Opaque strong entity tag for a Link's configuration. Retain the complete quoted string exactly as returned and echo it unchanged; its contents carry no client-readable meaning.","example":"\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""},"LinkConfigurationIfMatch":{"anyOf":[{"$ref":"#/components/schemas/LinkConfigurationEntityTag"},{"type":"string","enum":["*"]}],"description":"Required precondition for a conditional Link operation. Send the exact strong `ETag` of the state you edited to apply it only while that state is still current, or the literal `*` to force the operation against whatever representation exists now. `*` can overwrite configuration committed since you last read the Link, so prefer the exact tag for ordinary read-edit-write clients.","example":"\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""},"Links_ListLinkAccessRulesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1000},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false}},"required":["data","page"],"additionalProperties":false},"Links_PatchInviteOnlyAccessRulesResult":{"type":"object","properties":{"linkId":{"type":"string","format":"uuid"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"list":{"type":"string","enum":["invite_only"]},"invitations":{"$ref":"#/components/schemas/Links_InvitationsResult"}},"required":["linkId","count","list","invitations"],"additionalProperties":false},"Links_PatchEmailAllowAccessRulesResult":{"type":"object","properties":{"linkId":{"type":"string","format":"uuid"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"list":{"type":"string","enum":["email_allow"]}},"required":["linkId","count","list"],"additionalProperties":false},"Links_PatchEmailBlockAccessRulesResult":{"type":"object","properties":{"linkId":{"type":"string","format":"uuid"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"list":{"type":"string","enum":["email_block"]}},"required":["linkId","count","list"],"additionalProperties":false},"Links_PatchLinkAccessRulesResponse":{"type":"object","properties":{"data":{"oneOf":[{"$ref":"#/components/schemas/Links_PatchInviteOnlyAccessRulesResult"},{"$ref":"#/components/schemas/Links_PatchEmailAllowAccessRulesResult"},{"$ref":"#/components/schemas/Links_PatchEmailBlockAccessRulesResult"}],"discriminator":{"propertyName":"list","mapping":{"invite_only":"#/components/schemas/Links_PatchInviteOnlyAccessRulesResult","email_allow":"#/components/schemas/Links_PatchEmailAllowAccessRulesResult","email_block":"#/components/schemas/Links_PatchEmailBlockAccessRulesResult"}}}},"required":["data"],"additionalProperties":false},"Links_CommittedGranularPermissionEntry":{"type":"object","properties":{"resource":{"type":"object","properties":{"type":{"type":"string","enum":["folder","file","webLink","agreement","resignableAgreement"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},"visible":{"type":"boolean"},"allowDownloads":{"type":"boolean"},"allowUploads":{"type":"boolean"}},"required":["resource","visible"],"additionalProperties":false,"description":"One stored granular permission entry, as the collection holds it. `visible` is always present: `true` is an explicit visibility grant and `false` an explicit hide. `allowDownloads` and `allowUploads` are present only when explicitly set and otherwise inherit. `allowDownloads` applies to folders, files, and agreements, and `allowUploads` applies to folders. Values are stored policy, not resolved access, and the resource is reported exactly as stored even if it has since been moved out of the link's subtree or deleted."},"Links_ListLinkGranularPermissionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Links_CommittedGranularPermissionEntry"},"maxItems":100},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false}},"required":["data","page"],"additionalProperties":false},"Links_PatchLinkGranularPermissionsResult":{"type":"object","properties":{"linkId":{"type":"string","format":"uuid"},"granularPermissions":{"$ref":"#/components/schemas/Links_GranularPermissionsSummary"}},"required":["linkId","granularPermissions"],"additionalProperties":false},"Links_PatchLinkGranularPermissionsResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Links_PatchLinkGranularPermissionsResult"}},"required":["data"],"additionalProperties":false},"Links_GranularPermissionPatchEntry":{"type":"object","properties":{"resource":{"type":"object","properties":{"type":{"type":"string","enum":["folder","file","webLink","agreement","resignableAgreement"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false},"visible":{"type":["boolean","null"]},"allowDownloads":{"type":["boolean","null"]},"allowUploads":{"type":["boolean","null"]}},"required":["resource"],"additionalProperties":false,"description":"One field-level change to a resource's stored granular permissions. Omit a property to leave the stored value alone, send `true` or `false` to store it, or send `null` to clear it: a cleared `visible` resolves the way a resource with no entry resolves under the link's mode, and a cleared `allowDownloads` or `allowUploads` inherits again. Each entry must set or clear at least one property. `allowDownloads` applies to folders, files, and agreements, and `allowUploads` applies to folders."},"Links_GranularPermissionResource":{"type":"object","properties":{"type":{"type":"string","enum":["folder","file","webLink","agreement","resignableAgreement"]},"id":{"type":"string","format":"uuid"}},"required":["type","id"],"additionalProperties":false,"description":"The stored resource this entry names. It is reported exactly as stored and is never resolved, so an entry whose resource has since been moved out of the Link's subtree or deleted still appears here."},"Agreements_SendAgreementWarning":{"type":"object","properties":{"code":{"type":"string","enum":["AGREEMENT_INVITATION_SUBMISSION_PARTIAL_FAILURE"]},"message":{"type":"string","description":"Human-readable explanation. Never program against it."},"failedAddresses":{"type":"array","items":{"type":"string"},"description":"Recipient email addresses whose invitation email was not submitted. Share the agreement with them manually."}},"required":["code","message","failedAddresses"],"additionalProperties":false,"description":"Present only when the agreement was created and sent but some invitation emails could not be submitted. The send is still committed: do not repeat the request."},"Agreements_SendAgreementResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"agreementId":{"type":"string","format":"uuid","description":"UUID of the new agreement."}},"required":["agreementId"],"additionalProperties":false},"warning":{"$ref":"#/components/schemas/Agreements_SendAgreementWarning"}},"required":["data"],"additionalProperties":false},"Agreements_SendAgreementRecipient":{"type":"object","properties":{"role":{"type":"string","minLength":1,"maxLength":1000,"description":"Recipient role name on the template, as shown in the recipient's **Role** field. Matched case-insensitively with no trimming. A role the template does not have is rejected, and so is a role that several template recipients share; add extra people through `viewers` instead."},"name":{"type":"string","minLength":1,"maxLength":1000,"description":"Recipient's full name."},"email":{"type":"string","maxLength":254,"format":"email","description":"Recipient's email address."}},"required":["role","name","email"],"additionalProperties":false},"Agreements_SendAgreementViewer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":1000,"description":"Viewer's full name."},"email":{"type":"string","maxLength":254,"format":"email","description":"Viewer's email address."}},"required":["name","email"],"additionalProperties":false},"Agreements_SendAgreementField":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":1000,"description":"Field name on the template, shown as the field's **Label** in its settings. Matched case-insensitively with no trimming. A name that matches no template field is rejected. One entry fills every field with that name."},"value":{"type":"string","maxLength":10000,"description":"Value to prefill. An empty string clears the template's value. Signature and initial fields are never prefilled."}},"required":["name","value"],"additionalProperties":false},"Agreements_SendAgreementRequest":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid","description":"UUID of an existing template (not an agreement, version, or field ID). Open the template in Peony and copy the UUID after `/agreements/templates/`."},"recipients":{"type":"array","items":{"$ref":"#/components/schemas/Agreements_SendAgreementRecipient"},"maxItems":100,"description":"Contact details by role, overriding the template's saved contact for that role. Omitted or empty keeps every template recipient's saved contact. Each role must exist on the template, belong to exactly one template recipient, and may appear only once, compared case-insensitively. `recipients` and `viewers` together may have at most 100 entries."},"viewers":{"type":"array","items":{"$ref":"#/components/schemas/Agreements_SendAgreementViewer"},"maxItems":100,"description":"Extra people added to the agreement as viewers, with no fields to fill. Omitted or empty adds none. `recipients` and `viewers` together may have at most 100 entries."},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Agreements_SendAgreementField"},"maxItems":500,"description":"Field values by field name. Omitted or empty keeps the template's values. Each name must exist on the template and may appear only once, compared case-insensitively."},"agreementName":{"type":"string","minLength":1,"maxLength":1000,"description":"Name of the new agreement. Defaults to the template name."},"folderId":{"type":"string","format":"uuid","description":"UUID of a folder you can access. Defaults to the root folder of the workspace's General channel, never the template's folder."}},"required":["templateId"],"additionalProperties":false},"DataRooms_DataRoom":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"],"description":"The room display name (its root folder name)."},"rootFolderId":{"type":"string","format":"uuid"},"qaEnabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time","description":"The room record's own update time. Not an activity or content watermark; the name can change without it."}},"required":["id","name","rootFolderId","qaEnabled","createdAt","updatedAt"],"additionalProperties":false},"DataRooms_ListDataRoomsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DataRooms_DataRoom"},"maxItems":100},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false}},"required":["data","page"],"additionalProperties":false},"DataRooms_RoomViewerGroup":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$","description":"Opaque viewer-group ID for this room. Pass it as `viewerGroupId`. Not a person identifier, and membership can change if recorded identity changes."},"dataRoomId":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"isAnonymous":{"type":"boolean","description":"True exactly when `email` is null. It does not describe email verification."},"firstViewedAt":{"type":["string","null"],"format":"date-time"},"lastViewedAt":{"type":["string","null"],"format":"date-time"}},"required":["groupId","dataRoomId","name","email","isAnonymous","firstViewedAt","lastViewedAt"],"additionalProperties":false},"DataRooms_ListDataRoomViewersResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DataRooms_RoomViewerGroup"},"maxItems":100},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false}},"required":["data","page"],"additionalProperties":false},"DataRooms_ActivityLink":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"deletedAt":{"type":["string","null"],"format":"date-time","description":"The room link's current soft-deletion time, or null. Not its state when the activity happened."}},"required":["id","name","deletedAt"],"additionalProperties":false},"DataRooms_FileViewedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"user":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false,"description":"Present only when the view recorded a same-workspace account. Client-supplied analytics metadata, not a verified identity; current account labels."},"device":{"type":["object","null"],"properties":{"type":{"type":["string","null"]},"browserName":{"type":["string","null"]},"browserVersion":{"type":["string","null"]},"osName":{"type":["string","null"]},"osVersion":{"type":["string","null"]}},"required":["type","browserName","browserVersion","osName","osVersion"],"additionalProperties":false},"location":{"type":["object","null"],"properties":{"country":{"type":["string","null"]},"region":{"type":["string","null"]},"city":{"type":["string","null"]}},"required":["country","region","city"],"additionalProperties":false,"description":"Approximate location recorded for the viewing session (IP-derived estimate). Never an IP address."},"type":{"type":"string","enum":["file.viewed"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"versionId":{"type":["string","null"],"format":"uuid"},"versionNumber":{"type":["integer","null"]}},"required":["type","id","name","versionId","versionNumber"],"additionalProperties":false},"data":{"type":"object","properties":{"viewId":{"type":"string","format":"uuid"},"viewStartedAt":{"type":"string","format":"date-time"},"durationMs":{"type":["integer","null"],"minimum":0},"isDeleted":{"type":"boolean","description":"The viewed content could not be resolved and is shown as `Deleted file`. A display convention, not proof of deletion."}},"required":["viewId","viewStartedAt","durationMs","isDeleted"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","device","location","type","entity","data"],"additionalProperties":false},"DataRooms_FolderViewedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"user":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false,"description":"Present only when the view recorded a same-workspace account. Client-supplied analytics metadata, not a verified identity; current account labels."},"device":{"type":["object","null"],"properties":{"type":{"type":["string","null"]},"browserName":{"type":["string","null"]},"browserVersion":{"type":["string","null"]},"osName":{"type":["string","null"]},"osVersion":{"type":["string","null"]}},"required":["type","browserName","browserVersion","osName","osVersion"],"additionalProperties":false},"location":{"type":["object","null"],"properties":{"country":{"type":["string","null"]},"region":{"type":["string","null"]},"city":{"type":["string","null"]}},"required":["country","region","city"],"additionalProperties":false,"description":"Approximate location recorded for the viewing session (IP-derived estimate). Never an IP address."},"type":{"type":"string","enum":["folder.viewed"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["folder"]},"id":{"type":["string","null"],"format":"uuid","description":"The folder ID, usable as `entityId` with `entityType=folder`. The room root is its `rootFolderId`. Null only for the `Deleted folder` display."},"name":{"type":["string","null"]}},"required":["type","id","name"],"additionalProperties":false},"data":{"type":"object","properties":{"viewId":{"type":"string","format":"uuid"},"viewStartedAt":{"type":"string","format":"date-time"},"durationMs":{"type":["integer","null"],"minimum":0,"description":"Recorded active time on this folder's screen only; child folders and files have their own events. A later correction updates the same event."},"isDeleted":{"type":"boolean","description":"The listed folder could not be read when the page was assembled and is shown as `Deleted folder`. A display convention, not proof of deletion."}},"required":["viewId","viewStartedAt","durationMs","isDeleted"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","device","location","type","entity","data"],"additionalProperties":false},"DataRooms_AgreementViewedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"user":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false,"description":"Present only when the view recorded a same-workspace account. Client-supplied analytics metadata, not a verified identity; current account labels."},"device":{"type":["object","null"],"properties":{"type":{"type":["string","null"]},"browserName":{"type":["string","null"]},"browserVersion":{"type":["string","null"]},"osName":{"type":["string","null"]},"osVersion":{"type":["string","null"]}},"required":["type","browserName","browserVersion","osName","osVersion"],"additionalProperties":false},"location":{"type":["object","null"],"properties":{"country":{"type":["string","null"]},"region":{"type":["string","null"]},"city":{"type":["string","null"]}},"required":["country","region","city"],"additionalProperties":false,"description":"Approximate location recorded for the viewing session (IP-derived estimate). Never an IP address."},"type":{"type":"string","enum":["agreement.viewed"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["agreement"]},"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"versionId":{"type":"string","format":"uuid"},"versionNumber":{"type":["integer","null"]}},"required":["type","id","name","versionId","versionNumber"],"additionalProperties":false},"data":{"type":"object","properties":{"viewId":{"type":"string","format":"uuid"},"viewStartedAt":{"type":"string","format":"date-time"},"durationMs":{"type":["integer","null"],"minimum":0},"isNda":{"type":"boolean"}},"required":["viewId","viewStartedAt","durationMs","isNda"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","device","location","type","entity","data"],"additionalProperties":false},"DataRooms_NdaViewedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"user":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["name","email"],"additionalProperties":false,"description":"Present only when the view recorded a same-workspace account. Client-supplied analytics metadata, not a verified identity; current account labels."},"device":{"type":["object","null"],"properties":{"type":{"type":["string","null"]},"browserName":{"type":["string","null"]},"browserVersion":{"type":["string","null"]},"osName":{"type":["string","null"]},"osVersion":{"type":["string","null"]}},"required":["type","browserName","browserVersion","osName","osVersion"],"additionalProperties":false},"location":{"type":["object","null"],"properties":{"country":{"type":["string","null"]},"region":{"type":["string","null"]},"city":{"type":["string","null"]}},"required":["country","region","city"],"additionalProperties":false,"description":"Approximate location recorded for the viewing session (IP-derived estimate). Never an IP address."},"type":{"type":"string","enum":["nda.viewed"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["nda"]},"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"versionNumber":{"type":"integer"},"sourceType":{"type":"string","enum":["file"]}},"required":["type","id","name","versionNumber","sourceType"],"additionalProperties":false},"data":{"type":"object","properties":{"viewId":{"type":"string","format":"uuid"},"viewStartedAt":{"type":"string","format":"date-time"},"durationMs":{"type":["integer","null"],"minimum":0}},"required":["viewId","viewStartedAt","durationMs"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","device","location","type","entity","data"],"additionalProperties":false},"DataRooms_FileNdaAcceptedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"type":{"type":"string","enum":["nda.accepted"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["nda"]},"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"versionNumber":{"type":"integer"},"sourceType":{"type":"string","enum":["file"]}},"required":["type","id","name","versionNumber","sourceType"],"additionalProperties":false},"data":{"type":"object","properties":{"acceptanceId":{"type":"string","format":"uuid"}},"required":["acceptanceId"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","type","entity","data"],"additionalProperties":false},"DataRooms_TemplateNdaAcceptedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":"string"}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"type":{"type":"string","enum":["nda.accepted"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["nda"]},"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"versionNumber":{"type":"integer"},"sourceType":{"type":"string","enum":["template"]}},"required":["type","id","name","versionNumber","sourceType"],"additionalProperties":false},"data":{"type":"object","properties":{"acceptanceId":{"type":"string","format":"uuid","description":"The finalized generated agreement version; equals `artifact.agreementVersionId`."},"artifact":{"type":"object","properties":{"kind":{"type":"string","enum":["agreement"]},"agreementId":{"type":"string","format":"uuid"},"agreementVersionId":{"type":"string","format":"uuid"},"sourceTemplateId":{"type":["string","null"],"format":"uuid"}},"required":["kind","agreementId","agreementVersionId","sourceTemplateId"],"additionalProperties":false}},"required":["acceptanceId","artifact"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","type","entity","data"],"additionalProperties":false},"DataRooms_QuestionCreatedActivity":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200,"description":"Stable opaque activity ID. Keeps its value when labels, durations or group membership change."},"occurredAt":{"type":"string","format":"date-time"},"viewer":{"type":"object","properties":{"groupId":{"type":"string","pattern":"^vg_[0-9a-f]{64}$"},"name":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["groupId","name","email"],"additionalProperties":false},"link":{"$ref":"#/components/schemas/DataRooms_ActivityLink"},"type":{"type":"string","enum":["question.created"]},"entity":{"type":"object","properties":{"type":{"type":"string","enum":["question"]},"id":{"type":"string","format":"uuid"},"displayNumber":{"type":"integer"},"currentQuestionText":{"type":"string","description":"The full current question text, not a creation-time snapshot."}},"required":["type","id","displayNumber","currentQuestionText"],"additionalProperties":false}},"required":["id","occurredAt","viewer","link","type","entity"],"additionalProperties":false},"DataRooms_ListDataRoomActivityResponse":{"type":"object","properties":{"dataRoomId":{"type":"string","format":"uuid"},"data":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/DataRooms_FileViewedActivity"},{"$ref":"#/components/schemas/DataRooms_FolderViewedActivity"},{"$ref":"#/components/schemas/DataRooms_AgreementViewedActivity"},{"$ref":"#/components/schemas/DataRooms_NdaViewedActivity"},{"$ref":"#/components/schemas/DataRooms_FileNdaAcceptedActivity"},{"$ref":"#/components/schemas/DataRooms_TemplateNdaAcceptedActivity"},{"$ref":"#/components/schemas/DataRooms_QuestionCreatedActivity"}]},"maxItems":100},"page":{"type":"object","properties":{"nextCursor":{"$ref":"#/components/schemas/PublicApiOpaqueCursor"}},"required":["nextCursor"],"additionalProperties":false},"meta":{"type":"object","properties":{"retrievedAt":{"type":"string","format":"date-time","description":"When this response was assembled. Not an analytics freshness or ingestion watermark."},"occurredBefore":{"type":"string","format":"date-time","description":"The fixed exclusive upper `occurredAt` bound of this traversal."}},"required":["retrievedAt","occurredBefore"],"additionalProperties":false}},"required":["dataRoomId","data","page","meta"],"additionalProperties":false}},"parameters":{}},"paths":{"/api/v1/folders/{folderId}/links":{"post":{"operationId":"Links_CreateFolderLink","summary":"Create a link for a folder","description":"Creates a public link to an existing folder. The request body is the complete initial configuration, not a partial update, so send every documented setting. To create a link for an entire data room, `folderId` must be the data room's root-folder UUID described under **Finding a folder ID** above. If the saved link is active and the request adds exact-email recipients, Peony submits their invitations after the link has been committed.\n\nThe response's `data.url` is the canonical base Link URL derived from the Link ID and team domain and slug. It contains no recipient query or fragment; share it deliberately and avoid unnecessary logging. The response's `ETag` header is the new link's initial opaque configuration tag. Retain it if you intend to replace the link's settings later; otherwise read the current tag with `GET`.\n\nThe granular permission `mode` is read-only and is not part of the request: Peony resolves it. Ordinary folder links always store `inherit`; exact data-room root links take the room's stored default, which only Data Room settings change. Sending `granularPermissions.mode` with any value — even the one Peony would resolve — answers `400 validation_failed` and creates nothing. The mode decides what a missing entry means: under `inherit` a descendant with no entry is visible, under `hidden_by_default` it is hidden. Omitted entry visibility is interpreted under the persisted mode, and the created response always reports the required persisted mode.\n\nThree separate limits bound granular permissions, and they are not interchangeable. This request may carry at most 1000 entries in `granularPermissions.overrides`, at the root of the request body. Afterwards each `PATCH /api/v1/links/{linkId}/granular-permissions` array — `upsert` and `remove` — accepts at most 500 raw entries per request. The link itself stores up to 10000 non-root descendant rows, which repeated batches can build up to and which the paginated collection reads back; a larger stored collection never means a larger request is accepted.\n\nA permission this link cannot store answers `400 validation_failed` and commits nothing: the link, its entries, its access lists and any invitation all roll back together. `error.details[0].path` locates the entry to correct — `body.granularPermissions.overrides.<index>.resource` with `invalid_value` when a submitted resource is not available in the folder's authorized contents, `body.granularPermissions.overrides.<index>` with `invalid_combination` when an entry hides a resource while allowing its download or upload, and `body.granularPermissions.overrides` with `too_many_items` when the collection is over its ceiling. The index is the position in the array you sent. No resource name or identifier is echoed back. Because nothing committed, the same `Idempotency-Key` may be reused for the corrected request.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Create a folder link","source":"// Create a link for a folder. The body is the complete configuration:\n// every supported setting travels on every create.\nconst linkSettings = {\n  \"name\": \"Series A investor access\",\n  \"inviteOnly\": true,\n  \"inviteAllowList\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"investor@example.com\"\n    },\n    {\n      \"type\": \"domain\",\n      \"value\": \"example.org\"\n    }\n  ],\n  \"requireEmail\": false,\n  \"verifyEmail\": false,\n  \"emailAllowList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"emailBlockList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"expiresAt\": \"2099-09-30T23:59:59Z\",\n  \"allowDownloads\": true,\n  \"allowUploads\": false,\n  \"showVersionHistory\": false,\n  \"aiEnabled\": false,\n  \"granularPermissions\": {\n    \"enabled\": true,\n    \"overrides\": [\n      {\n        \"resource\": {\n          \"type\": \"folder\",\n          \"id\": \"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b\"\n        },\n        \"visible\": true,\n        \"allowDownloads\": false,\n        \"allowUploads\": false\n      }\n    ]\n  },\n  \"welcomeMessage\": \"Welcome. Please review the material before our call.\",\n  \"inviteEmail\": {\n    \"enabled\": true,\n    \"subject\": \"Your access to the Acme data room\",\n    \"bodyBeforeCta\": \"The Acme team has shared its investor data room.\",\n    \"bodyAfterUrl\": \"Reply to your Acme contact with questions.\",\n    \"logoFileId\": null\n  },\n  \"watermark\": {\n    \"content\": \"{{email}}\\n{{date}} {{time}}\\n{{ip-address}}\",\n    \"footerContent\": null,\n    \"position\": \"center\",\n    \"textSize\": \"small\",\n    \"opacity\": 50,\n    \"color\": \"#6b7280\",\n    \"rotation\": 45,\n    \"tiled\": true\n  },\n  \"screenshotProtection\": {\n    \"mode\": \"basic\"\n  },\n  \"nda\": {\n    \"type\": \"template\",\n    \"templateId\": \"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10\"\n  },\n  \"accessQuestions\": {\n    \"enabled\": false,\n    \"fields\": []\n  },\n  \"appearance\": {\n    \"theme\": \"system\"\n  },\n  \"password\": {\n    \"enabled\": false\n  }\n};\n\nconst response = await fetch(\n  `${baseUrl}/api/v1/folders/${folderId}/links`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // One fresh key per logical create. Reusing one inside the\n      // suppression window returns 409, never the first response.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(linkSettings),\n  },\n);\n\nconst { data } = await response.json();\n// The new link's initial opaque configuration tag. Retain it if you plan to\n// replace these settings later; never parse, decode, or log it.\nconst entityTag = response.headers.get(\"ETag\");\n// data.url is the canonical base Link URL. Share it deliberately.\nconsole.log(data.id, data.url, Boolean(entityTag));"},{"lang":"JavaScript","label":"Create a link with an invitation-email logo","source":"// Invitation-email logo, in order: target -> storage PUT -> create.\n// Data-room root folders only. Complete package: /api/v1/docs/examples/peony-public-api-v1.zip\n\n// 1. Reserve the link and file IDs and get a create-only upload target.\nconst uploadTarget = {\n  \"purpose\": \"invite_email_logo\",\n  \"target\": {\n    \"type\": \"new_link\",\n    \"folderId\": folderId\n  },\n  \"contentType\": \"image/png\",\n  \"contentLength\": logoBytes.byteLength\n};\nconst targetResponse = await fetch(\n  `${baseUrl}/api/v1/link-assets/upload-targets`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(uploadTarget),\n  },\n);\nconst { data: reservation } = await targetResponse.json();\n\n// 2. PUT the exact bytes. Copy every required header unchanged.\n//    Do not add Peony Authorization, Idempotency-Key, or cookies here.\nawait fetch(reservation.upload.url, {\n  method: reservation.upload.method,\n  headers: reservation.upload.requiredHeaders,\n  body: logoBytes,\n});\n\n// 3. Create the link, handing back both reserved identifiers together.\nconst linkSettings = {\n  \"name\": \"Series A investor access\",\n  \"inviteOnly\": true,\n  \"inviteAllowList\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"investor@example.com\"\n    },\n    {\n      \"type\": \"domain\",\n      \"value\": \"example.org\"\n    }\n  ],\n  \"requireEmail\": false,\n  \"verifyEmail\": false,\n  \"emailAllowList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"emailBlockList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"expiresAt\": \"2099-09-30T23:59:59Z\",\n  \"allowDownloads\": true,\n  \"allowUploads\": false,\n  \"showVersionHistory\": false,\n  \"aiEnabled\": false,\n  \"granularPermissions\": {\n    \"enabled\": true,\n    \"overrides\": [\n      {\n        \"resource\": {\n          \"type\": \"folder\",\n          \"id\": \"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b\"\n        },\n        \"visible\": true,\n        \"allowDownloads\": false,\n        \"allowUploads\": false\n      }\n    ]\n  },\n  \"welcomeMessage\": \"Welcome. Please review the material before our call.\",\n  \"inviteEmail\": {\n    \"enabled\": true,\n    \"subject\": \"Your access to the Acme data room\",\n    \"bodyBeforeCta\": \"The Acme team has shared its investor data room.\",\n    \"bodyAfterUrl\": \"Reply to your Acme contact with questions.\",\n    \"logoFileId\": reservation.fileId\n  },\n  \"watermark\": {\n    \"content\": \"{{email}}\\n{{date}} {{time}}\\n{{ip-address}}\",\n    \"footerContent\": null,\n    \"position\": \"center\",\n    \"textSize\": \"small\",\n    \"opacity\": 50,\n    \"color\": \"#6b7280\",\n    \"rotation\": 45,\n    \"tiled\": true\n  },\n  \"screenshotProtection\": {\n    \"mode\": \"basic\"\n  },\n  \"nda\": {\n    \"type\": \"template\",\n    \"templateId\": \"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10\"\n  },\n  \"accessQuestions\": {\n    \"enabled\": false,\n    \"fields\": []\n  },\n  \"appearance\": {\n    \"theme\": \"system\"\n  },\n  \"password\": {\n    \"enabled\": false\n  },\n  \"reservedLinkId\": reservation.reservedLinkId\n};\nconst linkResponse = await fetch(\n  `${baseUrl}/api/v1/folders/${folderId}/links`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // A second logical operation, so a second distinct key.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(linkSettings),\n  },\n);\nconst { data } = await linkResponse.json();\nconsole.log(data.id, data.invitations.status);"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder."},"required":true,"description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder.","name":"folderId","in":"path"},{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 1,048,576 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_CreateFolderLinkRequest"},"example":{"name":"Series A investor access","inviteOnly":true,"inviteAllowList":[{"type":"email","value":"investor@example.com"},{"type":"domain","value":"example.org"}],"requireEmail":false,"verifyEmail":false,"emailAllowList":{"enabled":false,"entries":[]},"emailBlockList":{"enabled":false,"entries":[]},"expiresAt":"2099-09-30T23:59:59Z","allowDownloads":true,"allowUploads":false,"showVersionHistory":false,"aiEnabled":false,"granularPermissions":{"enabled":true,"overrides":[{"resource":{"type":"folder","id":"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b"},"visible":true,"allowDownloads":false,"allowUploads":false}]},"welcomeMessage":"Welcome. Please review the material before our call.","inviteEmail":{"enabled":true,"subject":"Your access to the Acme data room","bodyBeforeCta":"The Acme team has shared its investor data room.","bodyAfterUrl":"Reply to your Acme contact with questions.","logoFileId":null},"watermark":{"content":"{{email}}\n{{date}} {{time}}\n{{ip-address}}","footerContent":null,"position":"center","textSize":"small","opacity":50,"color":"#6b7280","rotation":45,"tiled":true},"screenshotProtection":{"mode":"basic"},"nda":{"type":"template","templateId":"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10"},"accessQuestions":{"enabled":false,"fields":[]},"appearance":{"theme":"system"},"password":{"enabled":false}}}}},"responses":{"201":{"description":"The created link and the result of any invitation submission requested by this operation.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"ETag":{"description":"Opaque strong entity tag for this link's configuration. Retain the complete quoted string and echo it unchanged as `If-Match` when replacing the link's settings. Its contents carry no client-readable meaning: it is not a revision number, a timestamp, a hash of the body, or a cache validator, and these responses remain `Cache-Control: no-store`.","schema":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","examples":["\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_LinkMutationResponse"},"example":{"data":{"id":"40c1ac46-f506-4204-8177-4aa70dcc1868","url":"https://acme.example-peony.test/view/40c1ac46-f506-4204-8177-4aa70dcc1868","target":{"type":"folder","id":"67c5c621-f24b-40d1-9923-89f589a88c63"},"settings":{"name":"Series A investor access","inviteOnly":true,"requireEmail":false,"verifyEmail":false,"expiresAt":"2099-09-30T23:59:59Z","allowDownloads":true,"allowUploads":false,"showVersionHistory":false,"aiEnabled":false,"welcomeMessage":"Welcome. Please review the material before our call.","inviteEmail":{"enabled":true,"subject":"Your access to the Acme data room","bodyBeforeCta":"The Acme team has shared its investor data room.","bodyAfterUrl":"Reply to your Acme contact with questions.","logoFileId":null},"watermark":{"content":"{{email}}\n{{date}} {{time}}\n{{ip-address}}","footerContent":null,"position":"center","textSize":"small","opacity":50,"color":"#6b7280","rotation":45,"tiled":true},"screenshotProtection":{"mode":"basic"},"nda":{"type":"template","templateId":"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10"},"accessQuestions":{"enabled":false,"fields":[]},"appearance":{"theme":"system"},"emailAllowList":{"enabled":false},"emailBlockList":{"enabled":false},"active":true,"password":{"enabled":false},"granularPermissions":{"enabled":true,"overrides":[{"resource":{"type":"folder","id":"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b"},"visible":true,"allowDownloads":false,"allowUploads":false}],"mode":"inherit"}},"details":{"nda":{"type":"template","name":"Mutual NDA"},"accessLists":{"inviteOnly":{"count":2},"emailAllow":{"count":0},"emailBlock":{"count":0}}},"createdAt":"2026-07-30T10:15:22.000Z","updatedAt":"2026-07-30T10:15:22.000Z","invitations":{"status":"submitted","requested":1,"submitted":1,"failed":0,"failedRecipients":[],"reason":null,"warnings":[]}}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.\n- `link_asset_upload_not_found`: The reserved invite-email logo upload was not found.\n- `template_not_found`: The template was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_asset_upload_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["template_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.\n- `link_id_conflict`: The reserved link ID already belongs to a link.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_id_conflict"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `feature_not_supported_for_resource`: This setting is not applicable to the requested resource.\n- `invalid_link_asset_upload`: The uploaded invite-email logo is invalid.\n- `template_not_eligible`: The NDA template cannot be used.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_supported_for_resource"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["invalid_link_asset_upload"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["template_not_eligible"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_supported_for_resource","message":"This setting is not applicable to the requested resource.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.\n- `storage_unavailable`: A required storage operation is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["storage_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}},"get":{"operationId":"Links_ListFolderLinks","summary":"List links for a folder","description":"Returns bounded summaries for non-deleted links targeting exactly the supplied `folderId`, newest first. For a data room, use its root-folder UUID to list links targeting the room's root. Each `data[].url` is the canonical base Link URL derived from the Link ID and team domain and slug. It contains no recipient query or fragment; share it deliberately and avoid unnecessary logging.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:read` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"List links for an exact folder","source":"// List one exact folder. No body or Idempotency-Key is sent.\nconst query = new URLSearchParams({ limit: \"50\", status: \"all\" });\nconst response = await fetch(\n  `${baseUrl}/api/v1/folders/${encodeURIComponent(folderId)}/links?${query}`,\n  {\n    method: \"GET\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      Accept: \"application/json\",\n    },\n  },\n);\n\nconst { data, page } = await response.json();\n// Canonical base Link URLs contain no recipient query or fragment; avoid unnecessary logging.\nconsole.log({ count: data.length, hasNextPage: page.nextCursor !== null });"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder."},"required":true,"description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder.","name":"folderId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","enum":["all","active","inactive"],"default":"all"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"A page of link summaries.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_ListFolderLinksResponse"},"example":{"data":[{"id":"40c1ac46-f506-4204-8177-4aa70dcc1868","url":"https://acme.example-peony.test/view/40c1ac46-f506-4204-8177-4aa70dcc1868","target":{"type":"folder","id":"67c5c621-f24b-40d1-9923-89f589a88c63"},"name":"Series A investor access","active":true,"inviteOnly":true,"requireEmail":false,"verifyEmail":false,"inviteEmailCount":1,"inviteDomainCount":1,"expiresAt":null,"createdAt":"2026-07-30T10:15:22.000Z","updatedAt":"2026-07-30T10:15:22.000Z"}],"page":{"nextCursor":null}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `link_state_invalid`: The link's stored configuration cannot be represented. Update the link in Peony or contact support.\n- `link_state_too_large`: The complete link state exceeds public API limits. Reduce unsupported settings in Peony and retry.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["link_state_invalid"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_state_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_state_invalid","message":"The link's stored configuration cannot be represented. Update the link in Peony or contact support.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/link-assets/upload-targets":{"post":{"operationId":"Links_CreateLinkAssetUploadTarget","summary":"Prepare an invite-email logo upload target","description":"Starts the three-step invitation-email logo workflow for a data-room link, and works only with data-room root folders.\n\nSend `target: { \"type\": \"new_link\", \"folderId\": … }` to reserve a future link: the response carries `data.reservedLinkId` and `data.fileId`, and link creation must use both together, with `data.fileId` as `inviteEmail.logoFileId`.\n\nSend `target: { \"type\": \"existing_link\", \"linkId\": … }` to replace the logo on a link that already exists: the response carries `data.linkId` instead of `data.reservedLinkId`. Upload the logo to `data.upload`, then send `data.fileId` as `inviteEmail.logoFileId` in a replace-link request. Preparing a target does not lock or change the link; the replace request reauthorizes it, so a link deleted in the meantime answers `404`.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Reserve a logo target, then create the link","source":"// Invitation-email logo, in order: target -> storage PUT -> create.\n// Data-room root folders only. Complete package: /api/v1/docs/examples/peony-public-api-v1.zip\n\n// 1. Reserve the link and file IDs and get a create-only upload target.\nconst uploadTarget = {\n  \"purpose\": \"invite_email_logo\",\n  \"target\": {\n    \"type\": \"new_link\",\n    \"folderId\": folderId\n  },\n  \"contentType\": \"image/png\",\n  \"contentLength\": logoBytes.byteLength\n};\nconst targetResponse = await fetch(\n  `${baseUrl}/api/v1/link-assets/upload-targets`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(uploadTarget),\n  },\n);\nconst { data: reservation } = await targetResponse.json();\n\n// 2. PUT the exact bytes. Copy every required header unchanged.\n//    Do not add Peony Authorization, Idempotency-Key, or cookies here.\nawait fetch(reservation.upload.url, {\n  method: reservation.upload.method,\n  headers: reservation.upload.requiredHeaders,\n  body: logoBytes,\n});\n\n// 3. Create the link, handing back both reserved identifiers together.\nconst linkSettings = {\n  \"name\": \"Series A investor access\",\n  \"inviteOnly\": true,\n  \"inviteAllowList\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"investor@example.com\"\n    },\n    {\n      \"type\": \"domain\",\n      \"value\": \"example.org\"\n    }\n  ],\n  \"requireEmail\": false,\n  \"verifyEmail\": false,\n  \"emailAllowList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"emailBlockList\": {\n    \"enabled\": false,\n    \"entries\": []\n  },\n  \"expiresAt\": \"2099-09-30T23:59:59Z\",\n  \"allowDownloads\": true,\n  \"allowUploads\": false,\n  \"showVersionHistory\": false,\n  \"aiEnabled\": false,\n  \"granularPermissions\": {\n    \"enabled\": true,\n    \"overrides\": [\n      {\n        \"resource\": {\n          \"type\": \"folder\",\n          \"id\": \"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b\"\n        },\n        \"visible\": true,\n        \"allowDownloads\": false,\n        \"allowUploads\": false\n      }\n    ]\n  },\n  \"welcomeMessage\": \"Welcome. Please review the material before our call.\",\n  \"inviteEmail\": {\n    \"enabled\": true,\n    \"subject\": \"Your access to the Acme data room\",\n    \"bodyBeforeCta\": \"The Acme team has shared its investor data room.\",\n    \"bodyAfterUrl\": \"Reply to your Acme contact with questions.\",\n    \"logoFileId\": reservation.fileId\n  },\n  \"watermark\": {\n    \"content\": \"{{email}}\\n{{date}} {{time}}\\n{{ip-address}}\",\n    \"footerContent\": null,\n    \"position\": \"center\",\n    \"textSize\": \"small\",\n    \"opacity\": 50,\n    \"color\": \"#6b7280\",\n    \"rotation\": 45,\n    \"tiled\": true\n  },\n  \"screenshotProtection\": {\n    \"mode\": \"basic\"\n  },\n  \"nda\": {\n    \"type\": \"template\",\n    \"templateId\": \"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10\"\n  },\n  \"accessQuestions\": {\n    \"enabled\": false,\n    \"fields\": []\n  },\n  \"appearance\": {\n    \"theme\": \"system\"\n  },\n  \"password\": {\n    \"enabled\": false\n  },\n  \"reservedLinkId\": reservation.reservedLinkId\n};\nconst linkResponse = await fetch(\n  `${baseUrl}/api/v1/folders/${folderId}/links`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // A second logical operation, so a second distinct key.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(linkSettings),\n  },\n);\nconst { data } = await linkResponse.json();\nconsole.log(data.id, data.invitations.status);"}],"parameters":[{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 65,536 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"type":"object","properties":{"purpose":{"type":"string","enum":["invite_email_logo"]},"target":{"$ref":"#/components/schemas/Links_LinkAssetUploadTargetSelector"},"contentType":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"contentLength":{"type":"integer","minimum":1,"maximum":524288,"description":"Exact number of logo bytes you will upload. Peony returns the same value as the `Content-Length` entry in `data.upload.requiredHeaders`; copy that header unchanged and send a body of exactly this size. Link creation verifies the stored object before accepting the reserved IDs."}},"required":["purpose","target","contentType","contentLength"],"additionalProperties":false},"example":{"purpose":"invite_email_logo","target":{"type":"new_link","folderId":"67c5c621-f24b-40d1-9923-89f589a88c63"},"contentType":"image/png","contentLength":51200}}}},"responses":{"201":{"description":"The logo file ID, the reserved or authorized link ID, and the direct-storage upload target.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_LinkAssetUploadTargetResponse"},"example":{"data":{"purpose":"invite_email_logo","fileId":"0b9d2c4e-1f3a-4b5c-8d6e-7a8b9c0d1e2f","reservedLinkId":"40c1ac46-f506-4204-8177-4aa70dcc1868","upload":{"method":"PUT","url":"https://storage.example-peony.test/presigned-upload-placeholder","requiredHeaders":{"If-None-Match":"*","Content-Type":"image/png","Content-Length":"51200"},"expiresAt":"2026-07-30T10:25:22.000Z"}}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `feature_not_supported_for_resource`: This setting is not applicable to the requested resource.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_supported_for_resource"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_supported_for_resource","message":"This setting is not applicable to the requested resource.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.\n- `storage_unavailable`: A required storage operation is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["storage_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/folders/{folderId}/uploads":{"post":{"operationId":"Uploads_InitiateFolderUpload","summary":"Initiate a file upload into a folder","description":"Starts a three-step upload into the existing folder identified by `folderId`. For a folder, use that folder's UUID. For a data room, use its root-folder UUID to upload at the room's root. This version accepts exactly one file. Peony authorizes the destination and returns a short-lived direct-storage target plus an opaque `completionGrant`. Upload the exact file bytes to `data.items[0].upload`, then call the completion operation with the grant. Uploading bytes to storage alone does not create a Peony file.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `files:write` API-key scope.","tags":["Uploads"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["files:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Upload one file end to end","source":"// Upload one file, in order: initiate -> storage PUT -> complete.\n// Complete package: /api/v1/docs/examples/peony-public-api-v1.zip\n\n// 1. Reserve the upload. Declare the exact byte length you will send.\n//    contentType is optional and advisory: omit it, as this body does, and\n//    Peony resolves a safe type and returns it in requiredHeaders.\nconst reservationRequest = {\n  \"items\": [\n    {\n      \"fileName\": \"board-pack.pdf\",\n      \"contentLength\": fileBytes.byteLength\n    }\n  ]\n};\nconst initiation = await fetch(\n  `${baseUrl}/api/v1/folders/${folderId}/uploads`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // Initiation takes the idempotency key; completion does not.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(reservationRequest),\n  },\n);\nconst { data: reservation } = await initiation.json();\nconst target = reservation.items[0].upload;\n\n// 2. PUT the exact bytes. Copy every required header unchanged.\n//    Do not add Peony Authorization, Idempotency-Key, or cookies here.\nawait fetch(target.url, {\n  method: target.method,\n  headers: target.requiredHeaders,\n  body: fileBytes,\n});\n\n// 3. Complete with the grant alone. It already authenticates the\n//    destination, name, type, and length, so no file fact is sent.\n//    No file exists until this call succeeds.\nconst completionRequest = {\n  \"completionGrant\": reservation.completionGrant\n};\nconst completion = await fetch(`${baseUrl}/api/v1/uploads/complete`, {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${apiKey}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify(completionRequest),\n});\nconst { data } = await completion.json();\nconsole.log(data.file.id, data.file.sizeBytes);"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder."},"required":true,"description":"UUID of the exact Peony folder targeted by this operation. For a folder, open it in Peony and copy the UUID after `/folders/`. For a data room, open it from Data rooms and copy the UUID after `/folders/` while viewing the room's top-level folder.","name":"folderId","in":"path"},{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 65,536 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Uploads_InitiateUploadRequest"},"example":{"items":[{"fileName":"board-pack.pdf","contentLength":2048576}]}}}},"responses":{"201":{"description":"The one-file reservation, direct-storage target, and completion grant.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Uploads_InitiateUploadResponse"},"example":{"data":{"uploadId":"b6f1f0d2-3c4e-4a5b-8c6d-7e8f9a0b1c2d","completionGrant":"opaque-upload-completion-grant-placeholder","grantExpiresAt":"2026-08-09T12:00:00.000Z","items":[{"fileName":"board-pack.pdf","upload":{"method":"PUT","url":"https://storage.example-peony.test/presigned-upload-placeholder","expiresAt":"2026-08-08T12:00:00.000Z","requiredHeaders":{"Content-Type":"application/octet-stream","Content-Length":"2048576","If-None-Match":"*"}}}]}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `capacity_exceeded`: The workspace does not have capacity for this upload.\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["capacity_exceeded"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"capacity_exceeded","message":"The workspace does not have capacity for this upload.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `file_too_large`: The declared file exceeds the current per-file upload limit.\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["file_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"file_too_large","message":"The declared file exceeds the current per-file upload limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.\n- `storage_unavailable`: A required storage operation is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["storage_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/uploads/complete":{"post":{"operationId":"Uploads_CompleteUpload","summary":"Complete an initiated file upload","description":"Finishes the upload after the direct-storage PUT. Send only the opaque `completionGrant` returned by initiation; do not send an `Idempotency-Key` or repeat the file metadata. The signed grant already binds the destination, file identity, name, content type, and byte length. Retrying the same grant is safe and returns the same registered file. A completed upload is never registered twice: if its file has since been deleted, a retry returns `410 upload_result_unavailable`, and an upload that can no longer complete returns `410 upload_session_unavailable`. Start a new upload in either case.\n\nThe complete initiate/upload/complete workflow, including a client snippet, is documented under `POST /api/v1/folders/{folderId}/uploads`.\n\nRequires the `files:write` API-key scope.","tags":["Uploads"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["files:write"],"requestBody":{"required":true,"description":"The JSON request body must not exceed 65,536 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Uploads_CompleteUploadRequest"},"example":{"completionGrant":"opaque-upload-completion-grant-placeholder"}}}},"responses":{"200":{"description":"The registered file. An exact retry with the same grant returns the same public result.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Uploads_CompleteUploadResponse"},"example":{"data":{"uploadId":"b6f1f0d2-3c4e-4a5b-8c6d-7e8f9a0b1c2d","file":{"id":"d4a9b7e1-2f30-4c58-9b1a-6e5d4c3b2a10","folderId":"67c5c621-f24b-40d1-9923-89f589a88c63","name":"board-pack.pdf","contentType":"application/octet-stream","sizeBytes":2048576,"hasThumbnail":false,"createdAt":"2026-08-07T12:03:00.000Z"}}}}}},"400":{"description":"Possible errors:\n- `invalid_completion_grant`: The upload completion grant is invalid.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_completion_grant"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_completion_grant","message":"The upload completion grant is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `capacity_exceeded`: The workspace does not have capacity for this upload.\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["capacity_exceeded"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"capacity_exceeded","message":"The workspace does not have capacity for this upload.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `completion_grant_expired`: The upload completion grant has expired.\n- `upload_id_conflict`: The upload identifiers conflict with an existing file registration.\n- `upload_not_found`: The uploaded object was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["completion_grant_expired"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["upload_id_conflict"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["upload_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"completion_grant_expired","message":"The upload completion grant has expired.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"410":{"description":"Possible errors:\n- `upload_result_unavailable`: The completed upload's file is no longer available.\n- `upload_session_unavailable`: The upload is no longer available for completion.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["upload_result_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["upload_session_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"upload_result_unavailable","message":"The completed upload's file is no longer available.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `file_too_large`: The declared file exceeds the current per-file upload limit.\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["file_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"file_too_large","message":"The declared file exceeds the current per-file upload limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `upload_content_type_mismatch`: The uploaded object content type does not match the completion grant.\n- `upload_size_mismatch`: The uploaded object size does not match the completion grant.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["upload_content_type_mismatch"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["upload_size_mismatch"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"upload_content_type_mismatch","message":"The uploaded object content type does not match the completion grant.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `storage_unavailable`: A required storage operation is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["storage_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"storage_unavailable","message":"A required storage operation is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/links/{linkId}":{"get":{"operationId":"Links_GetLink","summary":"Retrieve a folder link","description":"Returns the public state for an authorized folder link. `data.url` is the canonical base Link URL derived from the Link ID and team domain and slug. It contains no recipient query or fragment; share it deliberately and avoid unnecessary logging. `data.settings` contains writable flags but never access-list members; `data.details.accessLists` contains counts.\n\nThe response's `ETag` header is the opaque configuration tag for exactly the state returned here. Send it back unchanged as `If-Match` to replace this link's settings.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:read` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"Retrieve one folder link","source":"// Retrieve one folder link. No body or Idempotency-Key is sent.\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"GET\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      Accept: \"application/json\",\n    },\n  },\n);\n\nconst { data } = await response.json();\n// Keep both: the settings you may edit and resend, and the strong entity tag\n// for exactly this state, which a complete replacement echoes as If-Match.\nconst entityTag = response.headers.get(\"ETag\");\n// data.url is the canonical base Link URL; avoid unnecessary logging.\nconsole.log({ id: data.id, active: data.settings.active, hasTag: Boolean(entityTag) });"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"}],"responses":{"200":{"description":"The complete public folder-link resource.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"ETag":{"description":"Opaque strong entity tag for this link's configuration. Retain the complete quoted string and echo it unchanged as `If-Match` when replacing the link's settings. Its contents carry no client-readable meaning: it is not a revision number, a timestamp, a hash of the body, or a cache validator, and these responses remain `Cache-Control: no-store`.","schema":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","examples":["\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_LinkResourceResponse"},"example":{"data":{"id":"40c1ac46-f506-4204-8177-4aa70dcc1868","url":"https://acme.example-peony.test/view/40c1ac46-f506-4204-8177-4aa70dcc1868","target":{"type":"folder","id":"67c5c621-f24b-40d1-9923-89f589a88c63"},"settings":{"name":"Series A investor access","inviteOnly":true,"requireEmail":false,"verifyEmail":false,"expiresAt":"2099-09-30T23:59:59Z","allowDownloads":true,"allowUploads":false,"showVersionHistory":false,"aiEnabled":false,"welcomeMessage":"Welcome. Please review the material before our call.","inviteEmail":{"enabled":true,"subject":"Your access to the Acme data room","bodyBeforeCta":"The Acme team has shared its investor data room.","bodyAfterUrl":"Reply to your Acme contact with questions.","logoFileId":null},"watermark":{"content":"{{email}}\n{{date}} {{time}}\n{{ip-address}}","footerContent":null,"position":"center","textSize":"small","opacity":50,"color":"#6b7280","rotation":45,"tiled":true},"screenshotProtection":{"mode":"basic"},"nda":{"type":"template","templateId":"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10"},"accessQuestions":{"enabled":false,"fields":[]},"appearance":{"theme":"system"},"emailAllowList":{"enabled":false},"emailBlockList":{"enabled":false},"active":true,"password":{"enabled":false}},"details":{"nda":{"type":"template","name":"Mutual NDA"},"accessLists":{"inviteOnly":{"count":2},"emailAllow":{"count":0},"emailBlock":{"count":0}},"granularPermissions":{"enabled":true,"mode":"inherit","entryCount":1}},"createdAt":"2026-07-30T10:15:22.000Z","updatedAt":"2026-07-30T10:15:22.000Z"}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `link_state_invalid`: The link's stored configuration cannot be represented. Update the link in Peony or contact support.\n- `link_state_too_large`: The complete link state exceeds public API limits. Reduce unsupported settings in Peony and retry.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["link_state_invalid"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_state_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_state_invalid","message":"The link's stored configuration cannot be represented. Update the link in Peony or contact support.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}},"put":{"operationId":"Links_ReplaceLink","summary":"Replace a link's settings","description":"Replaces every supported setting of an existing folder link in one request. The body is the complete configuration, not a partial update, so send every documented setting: an omitted field fails validation rather than keeping its current value. `GET` returns `data.settings` in exactly this shape, so you can read, edit one field, and send the whole object back.\n\nReplacement accepts and adds no members. It preserves existing strong invite-only members while the final `inviteOnly` is true and clears them when it is false; weak allow and block rows are always preserved, whatever the current list size. Use the access-rules operation for explicit member additions and removals. Replacement can never invite anyone, so the response carries no `data.invitations` object at all: it is exactly the resource `GET` returns.\n\n`settings.allowDownloads` and `settings.allowUploads` are the only representation of the target folder's own permissions, for ordinary folder links and data-room root links alike.\n\nReplacement carries no granular permission entries at all: `settings` has no such property, and sending one is an unknown-field validation failure. Every stored entry — live or stale — is preserved exactly across a replacement, so an unrelated settings change can never drop a collection the request never saw. Use `PATCH /api/v1/links/{linkId}/granular-permissions` to change entries, and read `data.details.granularPermissions` for the collection's summary.\n\nThe response's `data.url` is the canonical base Link URL derived from the Link ID and team domain and slug. It contains no recipient query or fragment; share it deliberately and avoid unnecessary logging.\n\n`password: { \"enabled\": true }` with no value keeps the current password; add `value` to replace it, or send `{ \"enabled\": false }` to remove it. `expiresAt` accepts the stored value unchanged even once it is in the past, but a *changed* value must be in the future.\n\nThis operation is conditional and `If-Match` is always required, so every caller chooses its concurrency semantics explicitly. Send the exact `ETag` of the state you edited, copied byte for byte from the `GET`, create, or access-rule `PATCH` response that produced it: the replacement then succeeds only while that exact configuration is still current. This is the recommended mode for read-edit-write clients.\n\nSend the literal `*` instead to replace whatever representation exists now. This is a deliberate force replacement: it skips only the revision comparison, and it can silently overwrite configuration another client committed since you last read the link. Authorization, target liveness, locking, and every validation rule are unchanged, so `*` never reaches a link you could not otherwise replace, and a missing or unreachable link still answers `404`.\n\nOmitting the header answers `428`. A weak tag, a tag this API did not issue, and a no-longer-current tag all answer `412` and change nothing. Blank, unquoted, or otherwise malformed header syntax — including more than one tag — is caller error and answers `400 validation_failed`. After a `412`, read the link again, reapply your intended edit to the latest settings, and retry with a fresh `Idempotency-Key`. A successful replacement returns the new tag in its own `ETag` header.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Read the current settings, then replace them","source":"// Replace a link's settings. The body is the complete configuration:\n// read the current settings, edit what you need, send the whole object.\n// Keep the Response itself: the ETag you must echo lives in its headers.\nconst currentResponse = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"GET\",\n    headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n  },\n);\nconst current = await currentResponse.json();\n\n// The strong entity tag for exactly the state just read. Treat it as opaque:\n// never parse it, decode it, or log it.\nconst entityTag = currentResponse.headers.get(\"ETag\");\n// Exactly one non-empty quoted strong validator, checked before it is used as\n// a precondition. A weak (W/) tag, \"*\", an unquoted or half-quoted value, the\n// empty \"\" tag, an interior quote (which is how a comma-joined list arrives),\n// and any control character are all unusable here. The quoted value itself is\n// never decoded or compared.\nif (\n  typeof entityTag !== \"string\" ||\n  entityTag.length < 3 ||\n  !entityTag.startsWith('\"') ||\n  !entityTag.endsWith('\"') ||\n  entityTag.slice(1, -1).includes('\"') ||\n  /\\p{Cc}/u.test(entityTag)\n) {\n  throw new Error(\"The link response carried no usable strong ETag.\");\n}\n\n// data.details is read-only reference material; never send it back.\nconst settings = { ...current.data.settings, active: false };\n\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"PUT\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // Byte for byte as returned. Omit it and the answer is 428; send a\n      // stale one and the answer is 412 and nothing changes.\n      \"If-Match\": entityTag,\n      // One fresh key per logical replace. Reusing one inside the\n      // suppression window returns 409, never the first response.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    // password { enabled: true } with no value keeps the current one.\n    // No member is accepted here: strong invite-only members are preserved\n    // while inviteOnly stays true and cleared when it is false, weak allow\n    // and block rows always survive. Use access-rules to add or remove.\n    body: JSON.stringify(settings),\n  },\n);\nif (response.status === 412) {\n  // Someone else changed the link. Read it again, reapply your edit to the\n  // latest settings, and retry with a new Idempotency-Key.\n  throw new Error(\"The link changed; re-read it before replacing.\");\n}\n\n// The response is the same resource GET returns: no invitation result,\n// because replacement can never invite anyone.\nconst { data } = await response.json();\n// The new tag for the state this replacement committed.\nconst nextEntityTag = response.headers.get(\"ETag\");\n// data.url is the canonical base Link URL; avoid unnecessary logging.\nconsole.log({ id: data.id, active: data.settings.active, hasTag: Boolean(nextEntityTag) });"},{"lang":"JavaScript","label":"Replace the invitation-email logo on an existing link","source":"// Replace the invitation-email logo on an existing data-room link.\n// Order: read settings -> target -> storage PUT -> replace.\n// Complete package: /api/v1/docs/examples/peony-public-api-v1.zip\n\n// 1. Read the current settings. PUT is complete replacement, so the whole\n//    object goes back with only the logo changed.\nconst currentResponse = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"GET\",\n    headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n  },\n);\nif (!currentResponse.ok) {\n  // Status only: never surface the error body, which may describe the link.\n  throw new Error(`Could not read link settings: ${currentResponse.status}`);\n}\n// Capture the precondition before the target and upload work below: if\n// another writer changes the link during it, the PUT correctly answers 412.\n// Unusable now means no upload is started at all.\nconst entityTag = currentResponse.headers.get(\"ETag\");\n// Exactly one non-empty quoted strong validator, checked before it is used as\n// a precondition. A weak (W/) tag, \"*\", an unquoted or half-quoted value, the\n// empty \"\" tag, an interior quote (which is how a comma-joined list arrives),\n// and any control character are all unusable here. The quoted value itself is\n// never decoded or compared.\nif (\n  typeof entityTag !== \"string\" ||\n  entityTag.length < 3 ||\n  !entityTag.startsWith('\"') ||\n  !entityTag.endsWith('\"') ||\n  entityTag.slice(1, -1).includes('\"') ||\n  /\\p{Cc}/u.test(entityTag)\n) {\n  throw new Error(\"The link response carried no usable strong ETag.\");\n}\nconst { data: current } = await currentResponse.json();\n// data.details is read-only reference material; never send it back.\nconst currentSettings = current.settings;\n\n// 2. Prepare a create-only upload target for this existing link.\nconst uploadTarget = {\n  \"purpose\": \"invite_email_logo\",\n  \"target\": {\n    \"type\": \"existing_link\",\n    \"linkId\": linkId\n  },\n  \"contentType\": \"image/png\",\n  \"contentLength\": logoBytes.byteLength\n};\nconst targetResponse = await fetch(\n  `${baseUrl}/api/v1/link-assets/upload-targets`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(uploadTarget),\n  },\n);\n// The existing-link variant returns data.linkId, not data.reservedLinkId.\nconst { data: target } = await targetResponse.json();\n\n// 3. PUT the exact bytes. Copy every required header unchanged.\n//    No Peony Authorization, Idempotency-Key, If-Match, or cookies here.\nawait fetch(target.upload.url, {\n  method: target.upload.method,\n  headers: target.upload.requiredHeaders,\n  body: logoBytes,\n});\n\n// 4. Register it by replacing the settings with the new logo file ID.\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(target.linkId)}`,\n  {\n    method: \"PUT\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"If-Match\": entityTag,\n      // A second logical operation, so a second distinct key.\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify({\n      ...currentSettings,\n      inviteEmail: { ...currentSettings.inviteEmail, logoFileId: target.fileId },\n    }),\n  },\n);\nif (response.status === 412) {\n  throw new Error(\"The link changed; re-read it and prepare a new target.\");\n}\nconst { data } = await response.json();\nconsole.log({ id: data.id, inviteEmailEnabled: data.settings.inviteEmail.enabled });"},{"lang":"JavaScript","label":"Force replacement with If-Match: * (overwrites concurrent edits)","source":"// Force replacement. If-Match \"*\" means \"replace whatever representation\n// exists now\". It skips only the revision comparison, so it can silently\n// overwrite configuration another client committed after your last read.\n// Prefer the exact-ETag workflow above unless losing a concurrent edit is\n// genuinely acceptable for this call.\n\n// The wildcard removes the precondition, not the complete-replacement rule:\n// read the current settings first, or every field you omit is discarded.\nconst currentResponse = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"GET\",\n    headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n  },\n);\nif (!currentResponse.ok) {\n  // Status only: never surface the error body, which may describe the link.\n  throw new Error(`Could not read link settings: ${currentResponse.status}`);\n}\nconst { data: current } = await currentResponse.json();\n// data.details is read-only reference material; never send it back.\nconst settings = { ...current.settings, active: false };\n\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"PUT\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // The literal wildcard, not a tag. Nothing else changes: authorization,\n      // link liveness, locking, and every validation rule still apply, and a\n      // link you cannot reach still answers 404. The read above closes the\n      // missing-settings gap, not the lost-update one: anything committed\n      // between that GET and this PUT is still overwritten silently.\n      \"If-Match\": \"*\",\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    // Still the complete configuration, never a partial update.\n    body: JSON.stringify(settings),\n  },\n);\nif (!response.ok) {\n  // Status only: never surface the error body, which may describe the link.\n  throw new Error(`Could not replace link settings: ${response.status}`);\n}\nconst { data } = await response.json();\nconsole.log({ id: data.id, active: data.settings.active });"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"},{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"},{"schema":{"$ref":"#/components/schemas/LinkConfigurationIfMatch"},"required":true,"name":"If-Match","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 1,048,576 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_LinkSettings"},"example":{"name":"Series A investor access","inviteOnly":true,"requireEmail":false,"verifyEmail":false,"expiresAt":"2099-09-30T23:59:59Z","allowDownloads":true,"allowUploads":false,"showVersionHistory":false,"aiEnabled":false,"welcomeMessage":"Welcome. Please review the material before our call.","inviteEmail":{"enabled":true,"subject":"Your access to the Acme data room","bodyBeforeCta":"The Acme team has shared its investor data room.","bodyAfterUrl":"Reply to your Acme contact with questions.","logoFileId":null},"watermark":{"content":"{{email}}\n{{date}} {{time}}\n{{ip-address}}","footerContent":null,"position":"center","textSize":"small","opacity":50,"color":"#6b7280","rotation":45,"tiled":true},"screenshotProtection":{"mode":"basic"},"nda":{"type":"template","templateId":"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10"},"accessQuestions":{"enabled":false,"fields":[]},"appearance":{"theme":"system"},"emailAllowList":{"enabled":false},"emailBlockList":{"enabled":false},"active":true,"password":{"enabled":false}}}}},"responses":{"200":{"description":"The replaced link, projected from its committed state. It is the same resource `GET` returns and carries no invitation result.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"ETag":{"description":"Opaque strong entity tag for this link's configuration. Retain the complete quoted string and echo it unchanged as `If-Match` when replacing the link's settings. Its contents carry no client-readable meaning: it is not a revision number, a timestamp, a hash of the body, or a cache validator, and these responses remain `Cache-Control: no-store`.","schema":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","examples":["\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_LinkResourceResponse"},"example":{"data":{"id":"40c1ac46-f506-4204-8177-4aa70dcc1868","url":"https://acme.example-peony.test/view/40c1ac46-f506-4204-8177-4aa70dcc1868","target":{"type":"folder","id":"67c5c621-f24b-40d1-9923-89f589a88c63"},"settings":{"name":"Series A investor access","inviteOnly":true,"requireEmail":false,"verifyEmail":false,"expiresAt":"2099-09-30T23:59:59Z","allowDownloads":true,"allowUploads":false,"showVersionHistory":false,"aiEnabled":false,"welcomeMessage":"Welcome. Please review the material before our call.","inviteEmail":{"enabled":true,"subject":"Your access to the Acme data room","bodyBeforeCta":"The Acme team has shared its investor data room.","bodyAfterUrl":"Reply to your Acme contact with questions.","logoFileId":null},"watermark":{"content":"{{email}}\n{{date}} {{time}}\n{{ip-address}}","footerContent":null,"position":"center","textSize":"small","opacity":50,"color":"#6b7280","rotation":45,"tiled":true},"screenshotProtection":{"mode":"basic"},"nda":{"type":"template","templateId":"3f6f4a1e-8b21-4b5d-9d5a-2f9d3b7c1a10"},"accessQuestions":{"enabled":false,"fields":[]},"appearance":{"theme":"system"},"emailAllowList":{"enabled":false},"emailBlockList":{"enabled":false},"active":true,"password":{"enabled":false}},"details":{"nda":{"type":"template","name":"Mutual NDA"},"accessLists":{"inviteOnly":{"count":2},"emailAllow":{"count":0},"emailBlock":{"count":0}},"granularPermissions":{"enabled":true,"mode":"inherit","entryCount":1}},"createdAt":"2026-07-30T10:15:22.000Z","updatedAt":"2026-07-30T10:15:22.000Z"}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_asset_upload_not_found`: The reserved invite-email logo upload was not found.\n- `link_not_found`: The link was not found.\n- `nda_not_found`: The NDA was not found.\n- `template_not_found`: The template was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["link_asset_upload_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["nda_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["template_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_asset_upload_not_found","message":"The reserved invite-email logo upload was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.\n- `link_state_invalid`: The link's stored configuration cannot be represented. Update the link in Peony or contact support.\n- `link_state_too_large`: The complete link state exceeds public API limits. Reduce unsupported settings in Peony and retry.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_state_invalid"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_state_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"412":{"description":"Possible errors:\n- `precondition_failed`: The resource changed since the supplied precondition was issued.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["precondition_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"precondition_failed","message":"The resource changed since the supplied precondition was issued.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `feature_not_supported_for_resource`: This setting is not applicable to the requested resource.\n- `invalid_link_asset_upload`: The uploaded invite-email logo is invalid.\n- `template_not_eligible`: The NDA template cannot be used.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_supported_for_resource"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["invalid_link_asset_upload"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["template_not_eligible"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_supported_for_resource","message":"This setting is not applicable to the requested resource.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"428":{"description":"Possible errors:\n- `precondition_required`: This operation requires a current resource precondition.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["precondition_required"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"precondition_required","message":"This operation requires a current resource precondition.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.\n- `storage_unavailable`: A required storage operation is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["storage_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}},"delete":{"operationId":"Links_DeleteLink","summary":"Delete a link","description":"Soft-deletes an authorized folder link and returns `204` with no body. Send no request body and no `Idempotency-Key`; both are ignored.\n\nDeleting the same link again answers `404`, exactly like a link that never existed, was never yours, or sits behind a folder you cannot reach. The effect is therefore idempotent — the link ends up deleted either way — but the response is not replayed, so treat a `404` after a failed or repeated attempt as \"no such link to delete\", not as an error to resolve.\n\nA `linkId` that is malformed or not a valid UUID is a syntax error, not a hidden resource: it answers `400 validation_failed` with the same fixed `linkId` validation detail as every other link operation, before any rate-limit budget is consumed. Valid UUIDs are accepted case-insensitively and normalized to lowercase internally, so an uppercase identifier is not a syntax error. Only a well-formed UUID reaches the `404`.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Delete one folder link","source":"// Delete one folder link. No body and no Idempotency-Key are sent.\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  {\n    method: \"DELETE\",\n    headers: { Authorization: `Bearer ${apiKey}` },\n  },\n);\n\n// 204 has no body: never call response.json() here.\nif (response.status === 204) {\n  console.log(\"Deleted.\");\n} else if (response.status === 404) {\n  // Deliberately indistinguishable: already deleted, never existed, not\n  // yours, or behind a folder you cannot reach. Retrying will not change it.\n  console.log(\"No such link to delete.\");\n} else {\n  throw new Error(`Unexpected status ${response.status}`);\n}"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"}],"responses":{"204":{"description":"The link was deleted. There is no response body.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/links/{linkId}/access-rules":{"get":{"operationId":"Links_ListLinkAccessRules","summary":"List one folder-link access-rule collection","description":"Returns one deterministic page from exactly one selected access-rule collection. The selector-to-count mapping is `invite_only` to `data.details.accessLists.inviteOnly`, `email_allow` to `data.details.accessLists.emailAllow`, and `email_block` to `data.details.accessLists.emailBlock`. Entries are the root `data` array; paging state is the sibling `page` object. The link and the selected list are already in the request, so the answer does not repeat them. Entries carry recipient email and domain identities and are sensitive; do not log them.\n\nThe cursor is an opaque server-minted token that contains no recipient value. Echo it verbatim and follow `page.nextCursor` until it is null: do not decode, construct, modify, or log it. It is bound to this link and this selector, and it is not a snapshot — changing that collection may invalidate an outstanding cursor, and a cursor validation error means restart that selected collection from page one.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:read` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"List one link access-rule collection","source":"// Read one access-rule list. Entry values are sensitive; do not log them.\n// The cursor holds no entry value, but echo it verbatim instead of decoding it.\nconst list = \"invite_only\";\nconst query = new URLSearchParams({ list, limit: \"100\" });\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}/access-rules?${query}`,\n  {\n    method: \"GET\",\n    headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n  },\n);\n// Entries arrive as the root array; paging state is its sibling. The link and\n// the selected list are in the request and are not repeated in the answer.\nconst { data, page } = await response.json();\nconsole.log({\n  list,\n  count: data.length,\n  hasNextPage: page.nextCursor !== null,\n});"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"},{"schema":{"type":"string","enum":["invite_only","email_allow","email_block"],"description":"Select one access-rule collection: `invite_only` corresponds to `data.details.accessLists.inviteOnly`, `email_allow` to `data.details.accessLists.emailAllow`, and `email_block` to `data.details.accessLists.emailBlock`."},"required":true,"name":"list","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"One page from the selected access-rule collection.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_ListLinkAccessRulesResponse"},"example":{"data":[{"type":"email","value":"person@example.com"},{"type":"domain","value":"example.org"}],"page":{"nextCursor":null}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}},"patch":{"operationId":"Links_PatchLinkAccessRules","summary":"Add and remove entries in one access-rule collection","description":"Adds and removes normalized entries in exactly one selected access-rule collection and returns that collection's size after the batch. The selector-to-count mapping is `invite_only` to `data.details.accessLists.inviteOnly`, `email_allow` to `data.details.accessLists.emailAllow`, and `email_block` to `data.details.accessLists.emailBlock`. Entries are set semantics: adding an entry that already exists and removing one that is absent both succeed without changing anything.\n\nThe three collections are capped independently — invite-only membership at 1,000 entries, and the weak allow and block lists at 10,000 entries each — and there is no combined cap. Weak lists can be populated while they are dormant. Adding invite-only membership requires the link to be invite-only.\n\nA collection that is somehow already above its cap can still be repaired here: removals, set-semantic no-ops, and replacements that do not increase its size all succeed, and only growth is rejected until the collection is back within cap. Invite-only exact emails also count towards the workspace plan limit, so growing them past a Free workspace's allowance answers `403 feature_not_available` with `requiredPlanType: \"Business\"`; removals and non-increasing repairs of an over-limit link keep working. Domains do not count towards that limit and the weak lists are unaffected by it.\n\nThe answer is discriminated by `data.list`. Only `invite_only` carries `data.invitations`, because only invite-only membership can add recipients: newly added exact emails are invited after the batch commits, and an inactive link commits the membership and sends nothing. The `email_allow` and `email_block` variants never invite anyone, so they omit the property entirely. Entries are never returned here — read them back with the paginated GET on this path.\n\nThis operation is deliberately unconditional: it takes no `If-Match`. It still returns the link's current `ETag` — newly rotated when the batch changed anything, unchanged for a genuine no-op — and a changed batch therefore invalidates any complete view you were holding for a replacement.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Add and remove access-list entries in one batch","source":"// Add and remove members of one access list. Do not log entry values.\n// Each attempt needs its own Idempotency-Key; there is no response replay.\nconst batch = {\n  \"list\": \"invite_only\",\n  \"add\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"investor@example.com\"\n    },\n    {\n      \"type\": \"domain\",\n      \"value\": \"example.org\"\n    }\n  ],\n  \"remove\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"former.investor@example.com\"\n    }\n  ]\n};\n\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}/access-rules`,\n  {\n    method: \"PATCH\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"Idempotency-Key\": crypto.randomUUID(),\n    },\n    body: JSON.stringify(batch),\n  },\n);\nconst { data } = await response.json();\n// This operation sends no If-Match. It still returns the link's current tag —\n// newly rotated when the batch changed anything — which supersedes any\n// complete view you were holding for a replacement.\nconst entityTag = response.headers.get(\"ETag\");\n// Read the list back with GET to see entries; PATCH returns counts only.\nconsole.log({\n  list: data.list,\n  count: data.count,\n  invitations: data.invitations.status,\n  hasTag: Boolean(entityTag),\n});"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"},{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 1,048,576 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"string","enum":["invite_only","email_allow","email_block"],"description":"Select one access-rule collection: `invite_only` corresponds to `data.details.accessLists.inviteOnly`, `email_allow` to `data.details.accessLists.emailAllow`, and `email_block` to `data.details.accessLists.emailBlock`."},"add":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1000},"remove":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["domain"]},"value":{"type":"string"}},"required":["type","value"],"additionalProperties":false}]},"maxItems":1000}},"required":["list","add","remove"],"additionalProperties":false},"example":{"list":"invite_only","add":[{"type":"email","value":"investor@example.com"},{"type":"domain","value":"example.org"}],"remove":[{"type":"email","value":"former.investor@example.com"}]}}}},"responses":{"200":{"description":"The selected collection's size after the batch, discriminated by `data.list`. The invite-only variant also carries the result of any invitation submission it caused; the weak allow and block variants carry no invitation result.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"ETag":{"description":"Opaque strong entity tag for this link's configuration. Retain the complete quoted string and echo it unchanged as `If-Match` when replacing the link's settings. Its contents carry no client-readable meaning: it is not a revision number, a timestamp, a hash of the body, or a cache validator, and these responses remain `Cache-Control: no-store`.","schema":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","examples":["\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_PatchLinkAccessRulesResponse"},"example":{"data":{"linkId":"40c1ac46-f506-4204-8177-4aa70dcc1868","list":"invite_only","count":42,"invitations":{"status":"submitted","requested":1,"submitted":1,"failed":0,"failedRecipients":[],"reason":null,"warnings":[]}}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/links/{linkId}/granular-permissions":{"get":{"operationId":"Links_ListLinkGranularPermissions","summary":"List a link's granular permission entries","description":"Returns one deterministic page of the granular permission entries stored for this link. The collection can be far larger than a single link representation should carry, which is why `GET /api/v1/links/{linkId}` publishes only the `data.details.granularPermissions` summary — `enabled`, `mode`, and `entryCount` — and the entries themselves live here.\n\nEntries are the root `data` array; paging state is the sibling `page` object. Each entry carries only what is stored: the resource's type and ID, its stored `visible` Boolean, plus the `allowDownloads` and `allowUploads` values explicitly set on it. Those two inherit when omitted, so absence and an explicit `false` are different facts and neither is expanded. Resource names, paths, parents, contents, and internal row identifiers are never returned.\n\nWhether a *non-root descendant* with no entry is visible depends on the link's `mode` while `enabled` is true, which the link summary reports alongside it: under `inherit` it is visible, and under `hidden_by_default` it is hidden. A stored `visible` Boolean means the same thing under both. The link's own target folder is outside that rule entirely: it is never an entry, and granular visibility never hides it. While `enabled` is false the stored mode and these entries are dormant rather than deleted — they narrow nothing and recipients get the link's ordinary non-granular access — and they apply again once the policy is enabled. These are stored values either way, not resolved access. While `enabled` is true a descendant is visible only if every non-root ancestor folder resolves visible as well; that granular ancestor composition is skipped entirely while `enabled` is false. Separately, and in both states, the resource must still be live inside the link's subtree and the link's other access gates still apply.\n\nEntries are reported exactly as stored and are never resolved, so an entry whose resource has since been moved out of the link's subtree or deleted is still listed. That is deliberate: it is stored state you own, it still counts towards `entryCount`, and listing it is the only way to see it and remove it. The link's own target folder is never an entry — its permissions are the link's top-level `allowDownloads` and `allowUploads` settings.\n\nThe cursor is an opaque server-minted token that contains no resource identity. Echo it verbatim and follow `page.nextCursor` until it is null: do not decode, construct, modify, or log it. It is bound to this link and this collection, and it is not a snapshot — a concurrent batch may change the collection while you page, and a cursor validation error means restart from page one.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:read` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"List every granular permission entry","source":"// Walk one link's stored granular permission entries.\n// Entries are stored identities: no name, path, or content is returned, and an\n// entry whose resource was moved or deleted still lists so you can remove it.\nlet cursor = null;\nconst entries = [];\ndo {\n  const query = new URLSearchParams({ limit: \"100\" });\n  // Echo the cursor verbatim. Never decode, construct, modify, or log it.\n  if (cursor) query.set(\"cursor\", cursor);\n  const response = await fetch(\n    `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}/granular-permissions?${query}`,\n    {\n      method: \"GET\",\n      headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n    },\n  );\n  const page = await response.json();\n  entries.push(...page.data);\n  cursor = page.page.nextCursor;\n} while (cursor);\n// Pages are point-in-time reads, not one snapshot: a concurrent batch may add\n// or remove entries while you walk.\nconsole.log({ entryCount: entries.length });"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"One page of stored granular permission entries.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_ListLinkGranularPermissionsResponse"},"example":{"data":[{"resource":{"type":"folder","id":"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b"},"visible":false},{"resource":{"type":"file","id":"1c7b9e02-4f5a-4d31-8b62-9ac0f4e7d215"},"visible":true,"allowDownloads":false}],"page":{"nextCursor":null}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}},"patch":{"operationId":"Links_PatchLinkGranularPermissions","summary":"Change a link's granular permission entries","description":"Applies a bounded batch to this link's stored granular permissions and returns the collection's summary afterwards. Every key is optional, but a request must ask for something: send `enabled`, or send at least one entry in `upsert` or `remove`. Two empty arrays are a caller mistake, not a no-op.\n\n`upsert` *patches* the fields it names on each resource it names. A property you omit keeps whatever the entry already stores, so changing one file's download setting no longer restates its visibility; sending `true` or `false` stores that value; and sending `null` clears the field — a cleared `visible` resolves the way a resource with no entry resolves under the link's mode, and a cleared `allowDownloads` or `allowUploads` inherits again. Each entry must set or clear at least one of the three. A resource with no stored entry starts from exactly that rowless meaning, so patching one field of it is the same as patching one field of an entry that already said the default.\n\nThe row is judged as it will be stored: if its final visibility is hidden and its final `allowDownloads` or `allowUploads` is `true` — including a `true` this request merely preserved — the batch is rejected rather than silently cleared. Send `visible: true`, or clear the capability with `null`, in the same entry. `allowDownloads` applies to folders, files, and agreements, and `allowUploads` applies to folders, and naming one that does not apply is rejected whatever the value. When a patched entry ends up saying exactly what a resource with no entry already says — the mode's default visibility and both capabilities inherited — its row is removed instead of stored, which is the same permission with one less thing to read back. `remove` deletes the whole stored entry for each resource it names.\n\n`remove` resolves against stored entries alone and never looks the resource up, which is what lets you clean up an entry whose resource was moved out of the subtree or deleted. Naming a resource with no stored entry is a validation failure. `upsert`, by contrast, must name a live resource inside the link's current subtree. Untouched entries — stale ones included — are always preserved, and they count towards the collection's stored maximum of 10,000 entries. The link's own target folder cannot appear in either array: use the link's top-level `allowDownloads` and `allowUploads` settings.\n\n`upsert` and `remove` each accept at most 500 entries per request, before duplicates are considered. Resource IDs are accepted in any letter case and normalized to lowercase, so two spellings of one UUID are the same resource: repeating it within an array, or naming it in both arrays, is rejected.\n\n`mode` decides what a *missing* entry means for non-root descendants while `enabled` is true: `inherit` makes a descendant with no entry visible, `hidden_by_default` makes it hidden; the link's own target folder is never an entry and granular visibility never hides it. While `enabled` is false the stored mode and entries stay dormant rather than deleted until the policy is enabled again. The mode is read-only here and is not part of the request: this operation never authors or converts it, and Data Room settings own it. An ordinary folder link always stores `inherit`; an exact data-room root link keeps its room's current default. Sending `mode` with any value — even the link's current one — answers `400 validation_failed` and changes nothing. Every patched field is read against the stored entries under the mode the link already has.\n\nEvery refusal here answers `400 validation_failed` and changes nothing: a submitted resource this link cannot grant and an entry that hides a resource while allowing its download or upload both point at `body.upsert`, and a batch whose resulting collection would exceed the stored ceiling points there with `too_many_items`. All of them are refused before any row is written, so the same `Idempotency-Key` may be reused once the batch is corrected. In responses `mode` is an extensible string: treat an unknown future value as tolerable rather than as an error.\n\nThis operation is conditional and `If-Match` is always required, exactly as for complete replacement. Send the exact `ETag` of the state you read to apply the batch only while that configuration is still current, or the literal `*` to apply it to whatever representation exists now. Omitting the header answers `428`; a weak, foreign, or no-longer-current tag answers `412` and changes nothing; malformed header syntax answers `400`.\n\nThe answer is a summary only — `data.granularPermissions` with `enabled`, the `mode` that was committed, and `entryCount`. Entries are never returned here; read them back with the paginated `GET` on this path. A batch that changed anything rotates the link's `ETag`, and therefore supersedes any complete view you were holding for a replacement; a genuine no-op writes nothing and returns the current tag. This operation never adds or removes access-list members and never sends an invitation.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `links:write` API-key scope.","tags":["Links"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["links:write"],"x-scalar-examples":[{"lang":"JavaScript","label":"Change granular permission entries in one batch","source":"// Change a bounded set of entries in one request. Read the link first: its\n// ETag is the precondition, and data.details.granularPermissions reports the\n// current mode and collection. The mode is read-only here: an ordinary folder\n// link is always \"inherit\", and a data-room root keeps its room's default\n// (\"inherit\" or \"hidden_by_default\"), which only Data Room settings change.\n// Never send a \"mode\" field. Any value, even the current one, is rejected\n// with 400 validation_failed and nothing is written.\nconst linkResponse = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}`,\n  { method: \"GET\", headers: { Authorization: `Bearer ${apiKey}` } },\n);\nconst entityTag = linkResponse.headers.get(\"ETag\");\n\nconst batch = {\n  \"enabled\": true,\n  \"upsert\": [\n    {\n      \"resource\": {\n        \"type\": \"file\",\n        \"id\": \"1c7b9e02-4f5a-4d31-8b62-9ac0f4e7d215\"\n      },\n      \"allowDownloads\": false\n    }\n  ],\n  \"remove\": [\n    {\n      \"type\": \"folder\",\n      \"id\": \"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b\"\n    }\n  ]\n};\n\nconst response = await fetch(\n  `${baseUrl}/api/v1/links/${encodeURIComponent(linkId)}/granular-permissions`,\n  {\n    method: \"PATCH\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application/json\",\n      // One fresh key per logical batch; a repeat is a 409, never a replay.\n      \"Idempotency-Key\": crypto.randomUUID(),\n      // The exact tag you read, or \"*\" to apply to whatever exists now.\n      \"If-Match\": entityTag,\n    },\n    body: JSON.stringify(batch),\n  },\n);\nconst { data } = await response.json();\n// Summary only. Read entries back with the paginated GET on this path.\nconsole.log({\n  enabled: data.granularPermissions.enabled,\n  // The link's stored mode; requests never send it. \"inherit\" means a resource with\n  // no stored entry is visible; \"hidden_by_default\" means it is hidden.\n  mode: data.granularPermissions.mode,\n  entryCount: data.granularPermissions.entryCount,\n  // A changed batch rotates the tag; a true no-op returns the current one.\n  hasTag: Boolean(response.headers.get(\"ETag\")),\n});"}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"linkId","in":"path"},{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"},{"schema":{"$ref":"#/components/schemas/LinkConfigurationIfMatch"},"required":true,"name":"If-Match","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 1,048,576 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"upsert":{"type":"array","items":{"$ref":"#/components/schemas/Links_GranularPermissionPatchEntry"},"maxItems":500},"remove":{"type":"array","items":{"$ref":"#/components/schemas/Links_GranularPermissionResource"},"maxItems":500}},"additionalProperties":false},"example":{"enabled":true,"upsert":[{"resource":{"type":"file","id":"1c7b9e02-4f5a-4d31-8b62-9ac0f4e7d215"},"allowDownloads":false}],"remove":[{"type":"folder","id":"8f0d2a4b-6c3e-4d21-9a7b-5e1c2d3f4a5b"}]}}}},"responses":{"200":{"description":"The link's granular permission summary after the batch. Entries are not returned; read them with the paginated `GET` on this path.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"ETag":{"description":"Opaque strong entity tag for this link's configuration. Retain the complete quoted string and echo it unchanged as `If-Match` when replacing the link's settings. Its contents carry no client-readable meaning: it is not a revision number, a timestamp, a hash of the body, or a cache validator, and these responses remain `Cache-Control: no-store`.","schema":{"type":"string","pattern":"^\"link-config-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"$","examples":["\"link-config-5a8dce4a-5f45-4d8e-8ea8-30331dd51cc0\""]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Links_PatchLinkGranularPermissionsResponse"},"example":{"data":{"linkId":"40c1ac46-f506-4204-8177-4aa70dcc1868","granularPermissions":{"enabled":true,"mode":"inherit","entryCount":1}}}}}},"400":{"description":"Possible errors:\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_idempotency_key","message":"The Idempotency-Key header format or length is invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"link_not_found","message":"The link was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"412":{"description":"Possible errors:\n- `precondition_failed`: The resource changed since the supplied precondition was issued.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["precondition_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"precondition_failed","message":"The resource changed since the supplied precondition was issued.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"428":{"description":"Possible errors:\n- `precondition_required`: This operation requires a current resource precondition.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["precondition_required"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"precondition_required","message":"This operation requires a current resource precondition.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/files/{fileId}":{"delete":{"operationId":"Files_DeleteFile","summary":"Delete a file","description":"Permanently deletes one file and returns `204` with no body. The key needs the `files:delete` scope, granted separately: `files:write` does not include it. Use the file's UUID, for example `data.file.id` from upload completion. The file may be in any folder or data room you can currently access, whichever key or person created it. Send no request body and no `Idempotency-Key`; both are ignored.\n\nEvery version of the file is deleted with it, together with its processed document data and any file links. Deleting a file that was added to another location as a reference removes only that reference; deleting the original file also removes its references. Audit and security records are retained.\n\n`204` confirms that the deletion committed. Stored file objects are then removed on a best-effort basis; the response does not certify their physical erasure, nor revoke copies or signed URLs obtained earlier. For now, retrying the completion of an earlier upload whose completion grant is still valid can register that file again.\n\nDeleting the same file again answers `404`, exactly like a file that never existed, was never yours, is not in a folder you can reach, or was moved or deleted concurrently. The effect is idempotent but the response is not replayed, so treat a `404` after a failed or repeated attempt as \"no such file to delete\".\n\nA `fileId` that is malformed or not a valid UUID answers `400 validation_failed` with a fixed `fileId` validation detail, before any rate-limit budget is consumed. Valid UUIDs are accepted case-insensitively.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `files:delete` API-key scope.","tags":["Files"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["files:delete"],"x-scalar-examples":[{"lang":"JavaScript","label":"Delete one file","source":"// Delete one file and all of its versions. No body and no Idempotency-Key.\n// fileId is, for example, data.file.id from upload completion.\nconst response = await fetch(\n  `${baseUrl}/api/v1/files/${encodeURIComponent(fileId)}`,\n  {\n    method: \"DELETE\",\n    headers: { Authorization: `Bearer ${apiKey}` },\n  },\n);\n\n// 204 has no body: never call response.json() here.\nif (response.status === 204) {\n  console.log(\"Deleted.\");\n} else if (response.status === 404) {\n  // Deliberately indistinguishable: already deleted, never existed, not\n  // yours, or in a folder you cannot reach. Retrying will not change it.\n  console.log(\"No such file to delete.\");\n} else {\n  throw new Error(`Unexpected status ${response.status}`);\n}"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"UUID of the file, such as `data.file.id` from upload completion."},"required":true,"description":"UUID of the file, such as `data.file.id` from upload completion.","name":"fileId","in":"path"}],"responses":{"204":{"description":"The file was deleted. There is no response body.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"insufficient_scope","message":"The authenticated key lacks a required scope.","details":[{"requiredScopes":["links:read"]}]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `file_not_found`: The file was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["file_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"file_not_found","message":"The file was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/agreements/send":{"post":{"operationId":"Agreements_SendAgreement","summary":"Send an agreement from a template","description":"Creates a **new** agreement from an existing template and sends it for signature, in one call. It never sends an existing agreement: each accepted call creates another agreement. The key needs the `agreements:send` scope — the **Send agreements** permission on the API key in Peony. The agreement is created by, and sent as, the person who created the API key, in that key's workspace, subject to that person's current access and the workspace plan.\n\n## Finding the values\n\n**Template ID:** open **Agreements → Templates** (`/agreements/templates`), open the template, and copy the UUID after `/agreements/templates/` in the URL (or after `/public/templates/` for a public template). It is the template's ID, not an agreement, version, or field ID.\n\n**Roles:** in the template editor each recipient has a **Role** (for example `Client`). `recipients[].role` must match one of them. Give every template recipient a role before targeting it with the API. A recipient without one cannot be targeted: the new agreement labels it `Signer 1`, `Signer 2`, … when it has fields and `Viewer 1`, `Viewer 2`, … when it has none, skipping labels already in use, and that generated label is not accepted as a role. A label saved on a template, for example by saving an agreement as a template, is an ordinary role and can be targeted. A label never adds fields or restores a cleared contact. A targeted role must belong to exactly one template recipient: when several template recipients share a role, give them distinct roles before targeting one, or leave that role out of `recipients` so each keeps its saved contact.\n\n**Field names:** each field's settings show its name as **Label**. `fields[].name` must match one of them.\n\n## How values combine with the template\n\n- This is an override request, not a replacement list. Omitting `recipients` or `fields`, or sending an empty array, keeps every contact and value saved on the template. Neither clears anything, and a template recipient you do not name keeps its saved contact.\n- Matching is case-insensitive and exact otherwise: nothing is trimmed. A role or field name the template does not have is refused, and so is naming the same role or field name twice.\n- Each `recipients` entry overrides exactly one template recipient. Template recipients may share a role as long as you do not target it; naming a shared role is refused, whatever email you send, because the API cannot tell which recipient you mean. Contacts you do not override, including those of recipients sharing a role, are kept and still count towards the email rules below.\n- To add people who only view the agreement, list them in `viewers` with a `name` and an `email`. A viewer added by the call has no role on the new agreement and is never assigned a field. Omitting `viewers` or sending an empty array adds none.\n- Every recipient on the new agreement must have a different email address, compared ignoring case and surrounding spaces. This includes contacts kept from the template and `viewers`; an address your override replaces no longer counts. Nothing is merged or dropped: a repeat is refused.\n- One `fields` entry fills every field with that name. An empty `value` clears the field. Signature and initial fields are never prefilled: naming one is accepted but leaves it for the signer.\n- Every field must end up assigned to a recipient with a name and an email, or the send is refused with `400 agreement_signer_incomplete`.\n- `agreementName` defaults to the template name. `folderId` defaults to the root folder of the workspace's General channel, never the template's folder.\n\n## Limits\n\nAt most 100 `recipients` and `viewers` entries together, 500 `fields` entries, and 10,000 characters per field value. These caps and the body-size cap apply independently, and contacts inherited from the template do not count towards them. Workspace limits still apply to the resulting agreement: on the Free plan, at most 50 recipients with an email per agreement, including inherited recipients and viewers, 3 sent agreements per month, and 100 invitation emails per day; storage capacity applies on every plan.\n\n## Errors\n\n- `400 validation_failed` with `details` names the entry to fix: `body.recipients.<index>.role` or `body.fields.<index>.name` with `invalid_value` for a role or field name the template does not have, and `invalid_combination` for the second and later entries repeating a role or field name. `body.viewers` with `too_many_items` means `recipients` and `viewers` together exceed the cap. `invalid_combination` at `body.recipients.<index>.email` or `body.viewers.<index>.email` names a submitted contact whose email another recipient already has; at `body` alone, only contacts saved on the template repeat, so correct the template.\n- `400 agreement_signer_incomplete`: a field is not assigned to a recipient with a name and an email.\n- `400 agreement_template_role_ambiguous`: `body.recipients.<index>.role` with `invalid_combination` names the first submitted role that several template recipients share. Changing that entry's email does not help: give those template recipients distinct roles, or omit the entry so they keep their saved contacts.\n- `403 agreement_recipient_limit_exceeded`: the agreement would have more recipients with an email than the workspace plan allows.\n- `403 agreement_send_quota_exceeded`: the workspace has used its monthly agreement send allowance.\n- `403 agreement_capacity_exceeded`: the workspace does not have storage capacity for the agreement.\n- `403 feature_not_available`: the template uses a capability, such as initial fields, that the workspace plan does not include. The message names the plan required.\n- `404 template_not_found` for a missing or inaccessible template, and `404 folder_not_found` for a missing or inaccessible folder.\n\nThese codes say what was refused; none of them reveals counts, usage, or template contents, and none of them promises that a retry is safe.\n\n## Delivery warnings\n\n`200` means the agreement was created and sent. If some invitation emails could not be submitted — including when the workspace's daily email quota is used up — the response also has a `warning` listing `failedAddresses`. The agreement is still sent: share it with those recipients manually from Peony and do not repeat the request. A warning says nothing about signing.\n\n## Retries\n\nGenerate one random `Idempotency-Key` per logical send and save it before calling. It identifies the request; it is not a credential. For 24 hours, repeating it answers `409 idempotency_request_seen`: that neither returns the first response nor proves the agreement was created. A `429 rate_limited` or `503 idempotency_unavailable` means nothing ran; retry with the same key after `Retry-After`. A malformed request, including a repeated role or field name or too many contacts, is refused before the key is used. A role or field name the template does not have, a role several template recipients share, a repeated recipient email, and a recipient allowance refusal found before anything was created, free the key again: correct the request and retry with the same key. A database or other server failure during the send never frees it. Other refusals may be found after work has started and can keep their key blocked for the window, including `agreement_recipient_limit_exceeded` when it is found later. After a timeout, a `5xx`, or a `409`, do not retry with a new key: check Agreements in Peony, or contact support with the `X-Request-Id`. Use a new key only once you have confirmed no agreement was created. The API never retries for you.\n\n## Example client\n\nThe example package includes a runnable send-agreement client and the AGREEMENTS.md guide to templates, recipients, fields, and retries. [Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip).\n\nRequires the `agreements:send` API-key scope.","tags":["Agreements"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["agreements:send"],"x-scalar-examples":[{"lang":"JavaScript","label":"Send an agreement from a template","source":"// Create a new agreement from a template and send it, in one call.\n// Complete package: /api/v1/docs/examples/peony-public-api-v1.zip\n\n// One key per logical send. Save it with your own record BEFORE calling, and\n// reuse it only to retry this same send; never generate a new one to retry.\n// It identifies the request; your API key stays the only credential.\nconst idempotencyKey = crypto.randomUUID();\n\n// \"recipients\" overrides template roles that must exist on the template;\n// roles you leave out keep their saved contacts. \"viewers\" adds extra people\n// with no fields.\n\nconst sendRequest = {\n  \"templateId\": templateId,\n  \"recipients\": [\n    {\n      \"role\": \"Client\",\n      \"name\": \"Alex Example\",\n      \"email\": \"alex@example.com\"\n    }\n  ],\n  \"viewers\": [\n    {\n      \"name\": \"Sam Example\",\n      \"email\": \"sam@example.com\"\n    }\n  ],\n  \"fields\": [\n    {\n      \"name\": \"Company name\",\n      \"value\": \"Example Ltd\"\n    }\n  ]\n};\nconst response = await fetch(`${baseUrl}/api/v1/agreements/send`, {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${apiKey}`,\n    \"Content-Type\": \"application/json\",\n    \"Idempotency-Key\": idempotencyKey,\n  },\n  body: JSON.stringify(sendRequest),\n});\n\nif (response.ok) {\n  const { data, warning } = await response.json();\n  console.log(\"Sent agreement\", data.agreementId);\n  if (warning) {\n    // Still sent. Share it manually with warning.failedAddresses in Peony;\n    // do not repeat the request.\n    console.log(\"Some invitation emails were not submitted.\");\n  }\n} else {\n  const { error, requestId } = await response.json();\n  // 429 and 503: nothing ran; retry later with the SAME idempotencyKey.\n  // 400 validation_failed: error.details names the entry to fix, for example\n  // body.recipients.0.role for a role the template does not have.\n  // 409 idempotency_request_seen: an earlier attempt was accepted. Check\n  // Agreements in Peony before doing anything else.\n  console.log(response.status, error.code, requestId);\n}"}],"parameters":[{"schema":{"$ref":"#/components/schemas/PublicApiIdempotencyKey"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"description":"The JSON request body must not exceed 262,144 bytes as sent over HTTP. A larger body is rejected with `payload_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agreements_SendAgreementRequest"},"example":{"templateId":"6f1c2b3a-4d5e-4f60-8a7b-9c0d1e2f3a4b","recipients":[{"role":"Client","name":"Alex Example","email":"alex@example.com"}],"viewers":[{"name":"Sam Example","email":"sam@example.com"}],"fields":[{"name":"Company name","value":"Example Ltd"}]}}}},"responses":{"200":{"description":"The agreement was created and sent. A `warning` means some invitation emails were not submitted; the agreement is still sent and the request must not be repeated.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agreements_SendAgreementResponse"},"example":{"data":{"agreementId":"0b8e7d6c-5a4f-4e3d-9c2b-1a0f9e8d7c6b"}}}}},"400":{"description":"Possible errors:\n- `agreement_signer_incomplete`: Complete the signer names, email addresses and field assignments before sending.\n- `agreement_template_role_ambiguous`: A requested role matches multiple template recipients. Give those recipients distinct roles, or omit that override to keep their saved contacts.\n- `invalid_idempotency_key`: The Idempotency-Key header format or length is invalid.\n- `missing_idempotency_key`: This operation requires an Idempotency-Key header.\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["agreement_signer_incomplete"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["agreement_template_role_ambiguous"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["invalid_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["missing_idempotency_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"agreement_signer_incomplete","message":"Complete the signer names, email addresses and field assignments before sending.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `agreement_capacity_exceeded`: The workspace does not have capacity for this agreement.\n- `agreement_recipient_limit_exceeded`: The agreement exceeds the workspace plan's recipient allowance.\n- `agreement_send_quota_exceeded`: The workspace has reached its monthly agreement send allowance.\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["agreement_capacity_exceeded"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["agreement_recipient_limit_exceeded"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["agreement_send_quota_exceeded"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"agreement_capacity_exceeded","message":"The workspace does not have capacity for this agreement.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `folder_not_found`: The folder was not found.\n- `template_not_found`: The template was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["folder_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["template_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"folder_not_found","message":"The folder was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"409":{"description":"Possible errors:\n- `idempotency_request_seen`: A request with this Idempotency-Key was already accepted.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_request_seen"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_request_seen","message":"A request with this Idempotency-Key was already accepted.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"413":{"description":"Possible errors:\n- `payload_too_large`: The request body exceeds the route limit.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["payload_too_large"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"payload_too_large","message":"The request body exceeds the route limit.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `idempotency_unavailable`: Duplicate-request protection is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["idempotency_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"idempotency_unavailable","message":"Duplicate-request protection is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/data-rooms":{"get":{"operationId":"DataRooms_ListDataRooms","summary":"List data rooms","description":"Returns the data rooms the key's creator can currently open in Peony, newest first (`createdAt` descending, then `id`). Private-channel rooms appear only when the creator can see that channel. `name` is the room's display name. Requires the Business plan or higher.\n\nEvery page rechecks the key, its scopes, the workspace plan and the creator's current access; a cursor never preserves revoked access. `HEAD` performs the same work, limits and checks as `GET` and returns the same status and headers without a body.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `data-rooms:read` API-key scope.","tags":["Data rooms"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["data-rooms:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"List accessible data rooms","source":"// List the data rooms this key's creator can access. Reads send no body.\nconst query = new URLSearchParams({ limit: \"50\" });\nconst response = await fetch(`${baseUrl}/api/v1/data-rooms?${query}`, {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n});\n\nconst { data, page } = await response.json();\nconsole.log(data.map((room) => ({ id: room.id, name: room.name })));\n// Pass page.nextCursor back unchanged (same q) to read the next page."}],"parameters":[{"schema":{"type":"string","maxLength":400,"description":"Case-insensitive substring of the room display name. Surrounding whitespace is ignored."},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Maximum number of records to return (1-100)."},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"A page of accessible data rooms.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataRooms_ListDataRoomsResponse"},"example":{"data":[{"id":"11111111-1111-4111-8111-111111111111","name":"Series A","rootFolderId":"22222222-2222-4222-8222-222222222222","qaEnabled":true,"createdAt":"2026-10-01T09:00:00.000Z","updatedAt":"2026-10-20T12:00:00.000Z"}],"page":{"nextCursor":null}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `read_source_unavailable`: A required source is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["read_source_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"read_source_unavailable","message":"A required source is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/data-rooms/{roomId}/viewers":{"get":{"operationId":"DataRooms_ListDataRoomViewers","summary":"List a data room's viewer groups","description":"Returns the viewer groups observed on the room's entry links, as the room analytics show them: one group per recorded email, and one per email-less browser (`isAnonymous: true`). Preview sessions are excluded. Ordered by `groupId`. Use `email` for an exact lookup or `q` for a substring search; an empty page means no observed group matches. Pass a returned `groupId` as `viewerGroupId` to the activity read. A group is an analytics grouping, not a verified person. Invited recipients who never viewed the room are not listed. Requires the Business plan or higher.\n\nEvery page rechecks the key, its scopes, the workspace plan and the creator's current access; a cursor never preserves revoked access. `HEAD` performs the same work, limits and checks as `GET` and returns the same status and headers without a body.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `activity:read` API-key scope.","tags":["Data rooms"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["activity:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"Look up a viewer group by email","source":"// Find one viewer group by exact email, then reuse its groupId.\nconst query = new URLSearchParams({ email: \"alex@example.com\" });\nconst response = await fetch(\n  `${baseUrl}/api/v1/data-rooms/${encodeURIComponent(roomId)}/viewers?${query}`,\n  {\n    method: \"GET\",\n    headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n  },\n);\n\nconst { data } = await response.json();\n// An empty list means no observed viewer group matches; it is not an error.\nconst viewerGroupId = data[0]?.groupId ?? null;"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Data room ID, as returned by `GET /api/v1/data-rooms`."},"required":true,"description":"Data room ID.","name":"roomId","in":"path"},{"schema":{"type":"string","maxLength":400,"description":"Case-insensitive substring of a viewer group's name or email label."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","maxLength":320,"description":"Exact email lookup. Surrounding whitespace is trimmed and letters are lowercased, as the room analytics grouping does; no alias rewriting. Combined with `q`, both must match."},"required":false,"name":"email","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Restrict to one of the room's entry links (links to the room root folder, including soft-deleted ones)."},"required":false,"name":"linkId","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Maximum number of records to return (1-100)."},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"A page of the room's viewer groups.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataRooms_ListDataRoomViewersResponse"},"example":{"data":[{"groupId":"vg_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","dataRoomId":"11111111-1111-4111-8111-111111111111","name":"Alex Morgan","email":"alex@example.com","isAnonymous":false,"firstViewedAt":"2026-10-21T10:00:00.000Z","lastViewedAt":"2026-10-29T08:30:00.000Z"}],"page":{"nextCursor":null}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `data_room_not_found`: The data room was not found.\n- `link_not_found`: The link was not found.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["data_room_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"data_room_not_found","message":"The data room was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `query_too_broad`: The query needs more work than one request may perform. Narrow its type, time, link or entity filters instead of retrying it unchanged.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["query_too_broad"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"query_too_broad","message":"The query needs more work than one request may perform. Narrow its type, time, link or entity filters instead of retrying it unchanged.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `read_source_unavailable`: A required source is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["read_source_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"read_source_unavailable","message":"A required source is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}},"/api/v1/data-rooms/{roomId}/activity":{"get":{"operationId":"DataRooms_ListDataRoomActivity","summary":"List a viewer group's data room activity","description":"Returns one viewer group's activity in one data room, newest first (`occurredAt` descending, then `id` ascending), across `file.viewed`, `agreement.viewed`, `nda.viewed`, `nda.accepted`, `question.created` and `folder.viewed`. Combined types are a union; every other filter narrows it. `viewerGroupId` is required: discover it with the viewers read. Requires the Data Room plan or higher for every type selection.\n\nRequires `activity:read`. When `type` is omitted or includes `question.created`, the key also needs `qa:read`; without it the answer is `403 insufficient_scope` naming `qa:read`, never a silently reduced page. An `activity:read`-only key can request `type=file.viewed,agreement.viewed,nda.viewed,nda.accepted,folder.viewed`.\n\n`folder.viewed` reports Peony's recorded visit to a folder screen of the room, including the room root (its `rootFolderId`), with one event per viewing session, entry link and folder, also when no file was opened. `data.durationMs` is the recorded active time on that folder's own screen; child folders and files have their own events, and a later correction updates the same event. A visit is listed only while its folder is in scope for that entry link under the link's current folder visibility: the room root always is, and a subfolder must currently sit under the room root and be visible through that link. This is a disclosure rule, not a statement about permissions at the time of the visit. Visits to folders that were moved out of the room, deleted or hidden through that link are omitted, because no retained record ties them to the room. Filter with `entityType=folder` and an optional exact `entityId`: any folder currently in scope through one of the room's entry links can be selected, with or without visits; any other ID answers `404 entity_not_found`. A folder has no version, so `entityVersionId` is rejected. If a listed folder can no longer be read while the page is assembled, it appears with `entity.name` `Deleted folder`, a null ID and `data.isDeleted: true`.\n\n`link` is always the room entry link, including for advanced-NDA agreement views and acceptances; `link.deletedAt` is that link's current soft-deletion time. Activity on soft-deleted links remains readable. View times are the viewing session's start, at whole-second precision, so several resources of one session can share `occurredAt`. A view whose content can no longer be resolved is a `file.viewed` with `entity.name` `Deleted file`, null IDs and `data.isDeleted: true`; that is a display convention, not proof of deletion. Device and location appear only on view types and describe the recorded session; no IP address is ever returned.\n\nThe first page fixes `meta.occurredBefore` (your `to`, or the request time) for the whole traversal. Walking `page.nextCursor` returns every event of a fixed dataset exactly once; activity that arrives late, edits and identity changes can still affect a traversal. A null `nextCursor` means no more currently available events. If a required source is unavailable the request fails with `503 read_source_unavailable` and no page; `422 query_too_broad` means the request needs more work than one call may do, so narrow its filters.\n\nEvery page rechecks the key, its scopes, the workspace plan and the creator's current access; a cursor never preserves revoked access. `HEAD` performs the same work, limits and checks as `GET` and returns the same status and headers without a body.\n\n[Download complete Node.js examples](/api/v1/docs/examples/peony-public-api-v1.zip)\n\nRequires the `activity:read` API-key scope.","tags":["Data rooms"],"security":[{"bearerApiKey":[]}],"x-required-scopes":["activity:read"],"x-scalar-examples":[{"lang":"JavaScript","label":"Page through a viewer group's activity","source":"// Walk every page of one viewer group's activity, newest first.\n// The default type list includes question.created, which needs qa:read too.\nlet cursor = null;\ndo {\n  const query = new URLSearchParams({ viewerGroupId, limit: \"100\" });\n  if (cursor) query.set(\"cursor\", cursor);\n  const response = await fetch(\n    `${baseUrl}/api/v1/data-rooms/${encodeURIComponent(roomId)}/activity?${query}`,\n    {\n      method: \"GET\",\n      headers: { Authorization: `Bearer ${apiKey}`, Accept: \"application/json\" },\n    },\n  );\n  if (!response.ok) throw new Error(`Activity read failed: ${response.status}`);\n  const { data, page } = await response.json();\n  for (const event of data) console.log(event.occurredAt, event.type, event.id);\n  cursor = page.nextCursor;\n} while (cursor);"}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Data room ID, as returned by `GET /api/v1/data-rooms`."},"required":true,"description":"Data room ID.","name":"roomId","in":"path"},{"schema":{"type":"string","pattern":"^vg_[0-9a-f]{64}$","description":"Required. A `groupId` from `GET /api/v1/data-rooms/{roomId}/viewers`."},"required":true,"name":"viewerGroupId","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"Comma-separated list of activity types; omit for all of `file.viewed`, `agreement.viewed`, `nda.viewed`, `nda.accepted`, `question.created`, `folder.viewed`. Selected types are combined (OR)."},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","enum":["file","agreement","nda","question","folder"],"description":"Restrict to activity whose primary `entity.type` is this kind."},"required":false,"name":"entityType","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Exact `entity.id`. Requires `entityType`."},"required":false,"name":"entityId","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Exact retained `entity.versionId` of the selected file or agreement. Requires `entityType` and `entityId`."},"required":false,"name":"entityVersionId","in":"query"},{"schema":{"type":"string","format":"uuid","description":"One of the room's entry links. Includes that link's advanced-NDA agreement views and acceptances."},"required":false,"name":"linkId","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Inclusive lower bound on `occurredAt` (RFC 3339 with an explicit offset)."},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"Exclusive upper bound on `occurredAt`. When omitted, the first page fixes the request time as the bound for the whole traversal."},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Maximum number of records to return (1-100)."},"required":false,"name":"limit","in":"query"},{"schema":{"allOf":[{"$ref":"#/components/schemas/PublicApiOpaqueCursor"},{"type":"string"}]},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"A page of the viewer group's activity.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataRooms_ListDataRoomActivityResponse"},"example":{"dataRoomId":"11111111-1111-4111-8111-111111111111","data":[{"id":"act_question:aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa","type":"question.created","occurredAt":"2026-10-29T09:12:44.512Z","viewer":{"groupId":"vg_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"Alex Morgan","email":"alex@example.com"},"link":{"id":"66666666-6666-4666-8666-666666666666","name":"Investors","deletedAt":null},"entity":{"type":"question","id":"aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa","displayNumber":12,"currentQuestionText":"Can you explain the revenue assumptions?"}},{"id":"act_folder-view:55555555-5555-4555-8555-555555555555:66666666-6666-4666-8666-666666666666:22222222-2222-4222-8222-222222222222","type":"folder.viewed","occurredAt":"2026-10-29T08:30:00.000Z","viewer":{"groupId":"vg_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"Alex Morgan","email":"alex@example.com"},"link":{"id":"66666666-6666-4666-8666-666666666666","name":"Investors","deletedAt":null},"entity":{"type":"folder","id":"22222222-2222-4222-8222-222222222222","name":"Series A"},"device":{"type":"desktop","browserName":"Chrome","browserVersion":null,"osName":"Mac OS","osVersion":null},"location":{"country":"GB","region":"ENG","city":"London"},"data":{"viewId":"55555555-5555-4555-8555-555555555555","viewStartedAt":"2026-10-29T08:30:00.000Z","durationMs":12000,"isDeleted":false}},{"id":"act_view:55555555-5555-4555-8555-555555555555:66666666-6666-4666-8666-666666666666:44444444-4444-4444-8444-444444444444","type":"file.viewed","occurredAt":"2026-10-29T08:30:00.000Z","viewer":{"groupId":"vg_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"Alex Morgan","email":"alex@example.com"},"link":{"id":"66666666-6666-4666-8666-666666666666","name":"Investors","deletedAt":null},"entity":{"type":"file","id":"33333333-3333-4333-8333-333333333333","name":"Pitch deck.pdf","versionId":"44444444-4444-4444-8444-444444444444","versionNumber":2},"device":{"type":"desktop","browserName":"Chrome","browserVersion":null,"osName":"Mac OS","osVersion":null},"location":{"country":"GB","region":"ENG","city":"London"},"data":{"viewId":"55555555-5555-4555-8555-555555555555","viewStartedAt":"2026-10-29T08:30:00.000Z","durationMs":87000,"isDeleted":false}},{"id":"act_nda-agreement:88888888-8888-4888-8888-888888888888","type":"nda.accepted","occurredAt":"2026-10-28T16:05:12.204Z","viewer":{"groupId":"vg_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"Alex Morgan","email":"alex@example.com"},"link":{"id":"66666666-6666-4666-8666-666666666666","name":"Investors","deletedAt":null},"entity":{"type":"nda","id":"77777777-7777-4777-8777-777777777777","name":"Mutual NDA","versionNumber":3,"sourceType":"template"},"data":{"acceptanceId":"88888888-8888-4888-8888-888888888888","artifact":{"kind":"agreement","agreementId":"99999999-9999-4999-8999-999999999999","agreementVersionId":"88888888-8888-4888-8888-888888888888","sourceTemplateId":null}}}],"page":{"nextCursor":null},"meta":{"retrievedAt":"2026-10-30T10:00:00.000Z","occurredBefore":"2026-10-30T10:00:00.000Z"}}}}},"400":{"description":"Possible errors:\n- `validation_failed`: The request input is malformed or invalid.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_failed"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":100}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"validation_failed","message":"The request input is malformed or invalid.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"401":{"description":"Possible errors:\n- `invalid_api_key`: The API credential is unusable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"WWW-Authenticate":{"description":"Bearer authentication challenge, returned on every unauthenticated answer.","schema":{"type":"string","enum":["Bearer"]}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_api_key"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"invalid_api_key","message":"The API credential is unusable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"403":{"description":"Possible errors:\n- `feature_not_available`: This capability is not available for the current workspace.\n- `insufficient_scope`: The authenticated key lacks a required scope.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["feature_not_available"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiRequiredScopesDetail"},"minItems":1,"maxItems":1}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"feature_not_available","message":"This capability is not available for the current workspace.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"404":{"description":"Possible errors:\n- `data_room_not_found`: The data room was not found.\n- `entity_not_found`: The selected entity was not found in this data room.\n- `link_not_found`: The link was not found.\n- `viewer_group_not_found`: The viewer group was not found in this data room.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","enum":["data_room_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["entity_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["link_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},{"type":"object","properties":{"code":{"type":"string","enum":["viewer_group_not_found"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false}]},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"data_room_not_found","message":"The data room was not found.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"422":{"description":"Possible errors:\n- `query_too_broad`: The query needs more work than one request may perform. Narrow its type, time, link or entity filters instead of retrying it unchanged.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["query_too_broad"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"query_too_broad","message":"The query needs more work than one request may perform. Narrow its type, time, link or entity filters instead of retrying it unchanged.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"429":{"description":"Possible errors:\n- `rate_limited`: The request limit was exceeded.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["rate_limited"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"rate_limited","message":"The request limit was exceeded.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"500":{"description":"Possible errors:\n- `internal_error`: An unexpected server error occurred.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["internal_error"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"internal_error","message":"An unexpected server error occurred.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}},"503":{"description":"Possible errors:\n- `read_source_unavailable`: A required source is temporarily unavailable.","headers":{"X-Request-Id":{"description":"Server-generated UUID identifying this request. Quote it in support requests so the answer can be correlated with server-side diagnostics.","schema":{"type":"string","format":"uuid"}},"Retry-After":{"description":"Whole seconds to wait before trying again. This header is present only when the returned error is retryable.","schema":{"type":"integer","minimum":0}}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["read_source_unavailable"]},"message":{"type":"string","minLength":1,"maxLength":1000},"details":{"type":"array","items":{"$ref":"#/components/schemas/PublicApiValidationDetail"},"maxItems":0}},"required":["code","message","details"],"additionalProperties":false},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["error","requestId"],"additionalProperties":false},"example":{"error":{"code":"read_source_unavailable","message":"A required source is temporarily unavailable.","details":[]},"requestId":"7ddf62a7-e122-4f5e-9671-a1b687e9ccab"}}}}}}}},"webhooks":{}}