Skip to content

Copy folders and files in the background

POST
/drives/{drive}/recursiveCopy/nodes
curl --request POST \
--url https://work.optidata.cloud/api/drives/1/recursiveCopy/nodes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "from_node_ids": [ 665198, 665199 ], "to_node_id": 300754 }'

Queues a recursive copy of from_node_ids into to_node_id and returns the request record immediately — the copy itself runs in the background. Unlike copy-to, this handles folders and their whole subtree.

Every source is checked before the job is queued: a trashed source, a source the caller cannot edit, a destination the caller cannot write to, or a folder being copied into itself, all fail up front.

drive
required
integer format: int64

Numeric id of the drive. Read it from GET /drives/config.json.

Media typeapplication/json
object
from_node_ids
required

Nodes to copy.

Array<integer>
to_node_id
required

Destination folder.

integer format: int64
Examples
ExamplecopyTree
{
"from_node_ids": [
665198,
665199
],
"to_node_id": 300754
}

The queued copy request.

Media typeapplication/json
object
copyRequest
required
object
id
integer format: int64
from_node_ids

JSON-encoded array of the source ids.

string
to_node_id
integer format: int64
user_id
integer format: int64
canceled_at
string | null format: date-time
created_at
string format: date-time
key
additional properties
any
Examplegenerated
{
"copyRequest": {
"id": 1,
"from_node_ids": "example",
"to_node_id": 1,
"user_id": 1,
"canceled_at": "2026-04-15T12:00:00Z",
"created_at": "2026-04-15T12:00:00Z"
}
}

A source or the destination is not copyable.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
ExampleintoItself
{
"message": "Cannot copy this folder into itself"
}

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller lacks the permission level the operation requires.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Exampledenied
{
"message": "This action is unauthorized."
}

The resource does not exist, or does not belong to the given drive.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplemissing
{
"message": "No query results for model [App\\Models\\Node] 99999999"
}

The request body or query string failed validation.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
Exampleinvalid
{
"message": "The name field is required.",
"errors": {
"name": [
"The name field is required."
]
}
}

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}