Set the approvals on a file
const url = 'https://work.optidata.cloud/api/drives/1/nodes/300754/approvals/sync';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"approvals":[{"id":1,"requested_user_email":"john.roe@acme.example","requester_user_note":"Please confirm the figures on page 3.","is_rejection_reason_required":true,"expires_at":"2026-09-30","edit_mode":"blocked"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://work.optidata.cloud/api/drives/1/nodes/300754/approvals/sync \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "approvals": [ { "id": 1, "requested_user_email": "john.roe@acme.example", "requester_user_note": "Please confirm the figures on page 3.", "is_rejection_reason_required": true, "expires_at": "2026-09-30", "edit_mode": "blocked" } ] }'Declares the complete set of approval requests for the file: entries with
an existing id are updated, new ones are created, and anything left out
is removed. Address each approver either by requested_user_id or by
requested_user_email.
expires_at is interpreted as a date and stored at the end of that day.
Requires view on the node; approvals exist on files only.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Numeric id of the drive. Read it from GET /drives/config.json.
Numeric id of the node (file or folder).
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Id of an existing approval, or a client-side id for a new one.
Required unless requested_user_email is given.
Required unless requested_user_id is given.
When true, a rejection must carry a reason.
Examples
{ "approvals": [ { "id": 1, "requested_user_email": "john.roe@acme.example", "requester_user_note": "Please confirm the figures on page 3.", "is_rejection_reason_required": true, "expires_at": "2026-09-30", "edit_mode": "blocked" } ]}Responses
Section titled “ Responses ”The resulting approvals.
A request asking a specific user to approve or reject a file. Folders cannot carry approvals.
object
Set when the approver is addressed by e-mail rather than by id.
Optional note left by the approver.
Compact representation of a user, embedded in other payloads.
object
Tenant-wide identifier of the user. Use this, not id, on account endpoints.
Present where the payload includes it (for example audit entries).
Compact representation of a user, embedded in other payloads.
object
Tenant-wide identifier of the user. Use this, not id, on account endpoints.
Present where the payload includes it (for example audit entries).
Example
[ { "status": "pending", "edit_mode": "blocked", "requesterUser": { "id": 15, "uuid": "9c1f0e2a-4d31-4d8a-8c1a-1f0b6b1f9a10", "name": "Jane Doe", "email": "jane.doe@acme.example", "status": "active" }, "requestedUser": { "id": 15, "uuid": "9c1f0e2a-4d31-4d8a-8c1a-1f0b6b1f9a10", "name": "Jane Doe", "email": "jane.doe@acme.example", "status": "active" } }]Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The caller lacks the permission level the operation requires.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "This action is unauthorized."}The resource does not exist, or does not belong to the given drive.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "No query results for model [App\\Models\\Node] 99999999"}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}