ONLYOFFICE DocSpace icon

ONLYOFFICE DocSpace

Consume ONLYOFFICE DocSpace API

File → Copy File

AI-generated

Summary

Copies a single file in ONLYOFFICE DocSpace to a room, folder, or the authenticated user's "My documents" section, and returns the newly created copy's file object.

Inputs

  • authentication (required) — Credential type used for the request: API Key, Basic Auth, OAuth2, or Personal Access Token. The matching credential must be configured.
  • fileId (required) — Numeric ID of the file to copy.
  • isMyDocuments (required) — If true, the file is copied into the current user's "My documents" root (the node looks up its folder ID automatically). If false, a destination ID must be given.
  • destFolderId (required) — Numeric ID of the destination room or folder. Shown and used only when "To My Documents" is false.

Output shape

One output item per input item, containing the JSON object of the copied file (the first file in the completed copy operation's result).

The copy runs as an asynchronous DocSpace file operation. The node polls its status up to 20 times at 100 ms intervals and fails on a reported error or on timeout. The conflict resolution mode is fixed to Duplicate, so a name clash creates a duplicate instead of overwriting. The original file is kept (deleteAfter is false). With Continue On Fail enabled, a failing item returns {error: message}.

Examples

Example 1: Copy a template document into a project room

File ID = 1234, To My Documents = false, Destination ID = 5678 (room ID).

Example 2: Make a personal copy of a shared file

File ID = {{$json.fileId}}, To My Documents = true.

Links

Discussion