Skip to content

Copy a file into another folder

POST
/drives/{drive}/nodes/{node}/copy-to
curl --request POST \
--url https://work.optidata.cloud/api/drives/1/nodes/300754/copy-to \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "to_node_id": 300754, "uuid": "9c1f0e2a-4d31-4d8a-8c1a-1f0b6b1f9a10" }'

Copies a file into to_node_id on behalf of the user identified by uuid, who must be allowed to create there. Copying a folder is not supported here — use POST /drives/{drive}/recursiveCopy/nodes for that. Copying into a trashed folder, or into something that is not a folder, returns 400.

drive
required
integer format: int64

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

node
required
integer format: int64

Numeric id of the node (file or folder).

Media typeapplication/json
object
to_node_id
required

Destination folder.

integer format: int64
uuid
required

UUID of the user the copy is performed for.

string format: uuid
Examples
ExamplecopyTo
{
"to_node_id": 300754,
"uuid": "9c1f0e2a-4d31-4d8a-8c1a-1f0b6b1f9a10"
}

The copy.

Media typeapplication/json
object
key
additional properties
any
Examplegenerated
{}

The destination is trashed, is not a folder, or the source is a folder.

Media typeapplication/json

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

object
message
required

Human-readable description of the failure.

string
Examples
ExamplenotAFolder
{
"message": "Node parent is not a folder"
}

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."
}