CloudPDF
DocsPricing
Start building

Update form widget

PATCH/v1/docs/{docId}/layers/{layerName}/form/widgets/{pageKey}/{annotationKey}v3.5.0

Change a widget's place and look: what an annotation update takes, for a form field's widget. A widget is the form's, so the annotation routes refuse one.

Authentication#

Any one of these credentials is accepted.

API token

The deployment's static root credential (CLOUDPDF_API_AUTH_TOKENS), valid on every surface.

Tenant token

Delegated tenant JWT, valid only for its own tenant: under /v1/tenants/{tenantId}/ the path tenant must equal the token's tenant_id, and on /v1/docs/{docId} the document must belong to that tenant and the token's scope must hold the operation's document permissions, as a document token does. For servers; browsers get document tokens. Doc-scoped viewer tokens are rejected on every admin route.

Document token

Doc-scoped JWT, valid only on the /v1/docs/{docId} subtree it names, gated by the capability scopes it carries (each operation's x-required-capability).

Document capabilitydoc.forms.modify

Parameters#

docIdpathstringrequired
layerNamepathstringrequired
pageKeypathstringrequired
annotationKeypathstringrequired
X-Document-Passwordheaderstring

Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.

Idempotency-Keyheaderstring

Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing.

Request body#

application/jsonDocFormsUpdateWidgetRequestrequired
patchWidgetPatchrequired
subtype"widget"
refunknown
pageunknown
hasAppearanceunknown
appearanceStateunknown
structurePositionunknown
nmstring
rectobject
xnumberrequired
ynumberrequired
widthnumberrequired
heightnumberrequired
contentsstring
subjectstring
blendMode"normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "color-dodge" | "color-burn" | "hard-light" | "soft-light" | "difference" | "exclusion" | "hue" | "saturation" | "color" | "luminosity"
invisibleboolean
hiddenboolean
printboolean
noZoomboolean
noRotateboolean
noViewboolean
readOnlyboolean
lockedboolean
toggleNoViewboolean
lockedContentsboolean
replyobject
toAnnotationRefrequired
kind =
kind"objectNumber"required
pagePageRefrequired
objectNumberintegerrequired
type"reply" | "group"
popupunknown
groupIdstring
authorunknown
createdAtunknown
modifiedAtunknown
userIdunknown
createdByunknown
modifiedByunknown
importedByunknown
actionsWidgetActionsPatch | PdfAnnotationActions
boxobject
xnumberrequired
ynumberrequired
widthnumberrequired
heightnumberrequired
rotation0 | 90 | 180 | 270
colorstring
interiorColorstring
strokeWidthnumber
borderStyle"solid" | "dashed" | "beveled" | "inset" | "underline"
dashArraynumber[]
fontFamilystring
fontSizenumber
fontColorstring
textAlign"left" | "center" | "right"
captionstring
checkStyle"check" | "cross" | "star" | "circle" | "square" | "diamond"
layout"caption" | "image" | "caption-below" | "caption-above" | "caption-right" | "caption-left" | "caption-over"
fieldunknown
fieldKindunknown
hasMarkunknown

A complete body with every required field. Strings stand in for your own values.

{
  "patch": {
    "subtype": "widget",
    "ref": null,
    "page": null,
    "hasAppearance": null,
    "appearanceState": null,
    "structurePosition": null,
    "nm": "nm",
    "rect": {
      "x": 1,
      "y": 1,
      "width": 1,
      "height": 1
    },
    "contents": "contents",
    "subject": "subject",
    "blendMode": "normal",
    "invisible": true,
    "hidden": true,
    "print": true,
    "noZoom": true,
    "noRotate": true,
    "noView": true,
    "readOnly": true,
    "locked": true,
    "toggleNoView": true,
    "lockedContents": true,
    "reply": {
      "to": {
        "kind": "objectNumber",
        "page": {
          "kind": "objectNumber",
          "objectNumber": 1
        },
        "objectNumber": 1
      }
    },
    "popup": null,
    "groupId": "groupId",
    "author": null,
    "createdAt": null,
    "modifiedAt": null,
    "userId": null,
    "createdBy": null,
    "modifiedBy": null,
    "importedBy": null,
    "actions": null,
    "box": {
      "x": 1,
      "y": 1,
      "width": 1,
      "height": 1
    },
    "rotation": 0,
    "color": "color",
    "interiorColor": null,
    "strokeWidth": 1,
    "borderStyle": "solid",
    "dashArray": [
      1
    ],
    "fontFamily": "fontFamily",
    "fontSize": 1,
    "fontColor": null,
    "textAlign": "left",
    "caption": "caption",
    "checkStyle": "check",
    "layout": "caption",
    "field": null,
    "fieldKind": null,
    "hasMark": null
  }
}

SDK examples#

The selected SDK is remembered across the API reference. Values are examples; replace them with identifiers and input from your application.

import { CloudPDFClient } from "@cloudpdf/sdk";

const client = new CloudPDFClient({
  token: "<token>",
});

await client.doc.forms.updateWidget({
  docId: "docId",
  layerName: "layerName",
  pageKey: "pageKey",
  annotationKey: "annotationKey",
  patch: {}
});

Responses#

200OK
application/jsonDocFormsUpdateWidgetResponse
widgetWidgetAnnotation
subtype"widget"
refAnnotationRef
kind =
kind"objectNumber"
pagePageRef
kind"objectNumber"
objectNumberinteger
objectNumberinteger
pagePageRef
kind"objectNumber"
objectNumberinteger
hasAppearanceboolean
appearanceStatestring
structurePositioninteger[]
nmstring
rectobject
xnumber
ynumber
widthnumber
heightnumber
contentsstring
subjectstring
blendMode"normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "color-dodge" | "color-burn" | "hard-light" | "soft-light" | "difference" | "exclusion" | "hue" | "saturation" | "color" | "luminosity"
invisibleboolean
hiddenboolean
printboolean
noZoomboolean
noRotateboolean
noViewboolean
readOnlyboolean
lockedboolean
toggleNoViewboolean
lockedContentsboolean
replyobject
toAnnotationRef
kind =
kind"objectNumber"
pagePageRef
objectNumberinteger
type"reply" | "group"
popupAnnotationRef
groupIdstring
authorstring
createdAtstring<date-time>
modifiedAtstring<date-time>
userIdstring
createdBystring
modifiedBystring
importedBystring
actionsPdfAnnotationActions
boxobject
xnumber
ynumber
widthnumber
heightnumber
rotation0 | 90 | 180 | 270
colorstring
interiorColorstring
strokeWidthnumber
borderStyle"solid" | "dashed" | "beveled" | "inset" | "underline"
dashArraynumber[]
fontFamilystring
fontSizenumber
fontColorstring
textAlign"left" | "center" | "right"
captionstring
checkStyle"check" | "cross" | "star" | "circle" | "square" | "diamond"
layout"caption" | "image" | "caption-below" | "caption-above" | "caption-right" | "caption-left" | "caption-over"
fieldFormFieldRef
fieldKind"text" | "checkbox" | "radio" | "combobox" | "listbox" | "pushbutton" | "signature" | "unknown"

Its field's family. A newer server can add families: read one your client doesn't know as `unknown`.

hasMarkboolean
appearanceobject
action"preserved" | "regenerated" | "generation-unavailable" | "restored"
changedboolean
metaFormMutationMeta
affectedPagesPageRef[]
kind"objectNumber"
objectNumberinteger
cacheDeltaCacheDelta
opIdstring
undoableboolean
missingCharactersstring[]optional
changedFieldsFormFieldRef[]
kind =
kind"objectNumber"
objectNumberinteger
changedWidgetsFormWidget[]
refAnnotationRef
objectNumberinteger
pagePageRef
redrawnWidgetsFormWidget[]
refAnnotationRef
objectNumberinteger
pagePageRef
400Bad request
application/jsonErrorResponse
errorEngineError
code"Unknown" | "InvalidArg" | "DocNotOpen" | "DocOpenFailed" | "DocPasswordRequired" | "DocPasswordIncorrect" | "GrantPassphraseRequired" | "Aborted" | "Network" | "Unauthenticated" | "Forbidden" | "NotFound" | "WireFormat" | "RuntimeUnavailable" | "LayerVersionConflict" | "NotImplemented" | "MalformedPdf" | "SigningPending" | "SigningExpired" | "SigningVersionMismatch" | "SignatureRefused" | "ProtectedDocument" | "PayloadTooLarge" | "ObjectNumberUnavailable" | "LayerFull" | "ChangeConflict" | "UndoUnavailable" | "IdempotencyKeyReused" | "LayerDeleted" | "VisitorIdentityRequired" | "Conflict" | "EngineBusy" | "EngineRestarting" | "DocumentQuarantined" | "ThumbnailNotReady" | "TooManyRequests" | "GrantExpired" | "OriginRequired" | "OriginNotAllowed" | "FeatureNotEnabled" | "FeatureStopped" | "LicenseInvalid" | "LicenseUsageLimit" | "UpstreamError"

Why the request failed. A newer server can add codes: read one your client doesn't know as `Unknown`.

messagestring
detailsobjectoptional

What a code carries besides its message, as each code says.

404Not found
application/jsonErrorResponse
errorEngineError
code"Unknown" | "InvalidArg" | "DocNotOpen" | "DocOpenFailed" | "DocPasswordRequired" | "DocPasswordIncorrect" | "GrantPassphraseRequired" | "Aborted" | "Network" | "Unauthenticated" | "Forbidden" | "NotFound" | "WireFormat" | "RuntimeUnavailable" | "LayerVersionConflict" | "NotImplemented" | "MalformedPdf" | "SigningPending" | "SigningExpired" | "SigningVersionMismatch" | "SignatureRefused" | "ProtectedDocument" | "PayloadTooLarge" | "ObjectNumberUnavailable" | "LayerFull" | "ChangeConflict" | "UndoUnavailable" | "IdempotencyKeyReused" | "LayerDeleted" | "VisitorIdentityRequired" | "Conflict" | "EngineBusy" | "EngineRestarting" | "DocumentQuarantined" | "ThumbnailNotReady" | "TooManyRequests" | "GrantExpired" | "OriginRequired" | "OriginNotAllowed" | "FeatureNotEnabled" | "FeatureStopped" | "LicenseInvalid" | "LicenseUsageLimit" | "UpstreamError"

Why the request failed. A newer server can add codes: read one your client doesn't know as `Unknown`.

messagestring
detailsobjectoptional

What a code carries besides its message, as each code says.

defaultError
application/jsonErrorResponse
errorEngineError
code"Unknown" | "InvalidArg" | "DocNotOpen" | "DocOpenFailed" | "DocPasswordRequired" | "DocPasswordIncorrect" | "GrantPassphraseRequired" | "Aborted" | "Network" | "Unauthenticated" | "Forbidden" | "NotFound" | "WireFormat" | "RuntimeUnavailable" | "LayerVersionConflict" | "NotImplemented" | "MalformedPdf" | "SigningPending" | "SigningExpired" | "SigningVersionMismatch" | "SignatureRefused" | "ProtectedDocument" | "PayloadTooLarge" | "ObjectNumberUnavailable" | "LayerFull" | "ChangeConflict" | "UndoUnavailable" | "IdempotencyKeyReused" | "LayerDeleted" | "VisitorIdentityRequired" | "Conflict" | "EngineBusy" | "EngineRestarting" | "DocumentQuarantined" | "ThumbnailNotReady" | "TooManyRequests" | "GrantExpired" | "OriginRequired" | "OriginNotAllowed" | "FeatureNotEnabled" | "FeatureStopped" | "LicenseInvalid" | "LicenseUsageLimit" | "UpstreamError"

Why the request failed. A newer server can add codes: read one your client doesn't know as `Unknown`.

messagestring
detailsobjectoptional

What a code carries besides its message, as each code says.