# WebDAV Operations

**Page:** api/files/webdav

[Download Raw Markdown](./api/files/webdav.md)

---

{/* AUTO-GENERATED — Do not edit manually. Regenerate with: npm run docs:api:generate */}



## WebDAV Operations

WebDAV-compatible file operations for connecting to and manipulating files via standard WebDAV clients (Nextcloud, ownCloud, Cyberduck, etc.). These endpoints implement the HTTP methods defined by RFC 4918 — `COPY`, `MOVE`, `LOCK`, `UNLOCK`, `PROPFIND`, `PROPPATCH`, and `OPTIONS` — alongside a dedicated connection endpoint.


Lock support is a compatibility stub: the server returns lock tokens but does **not** enforce them server-side. Use these endpoints to interoperate with WebDAV clients, not as a concurrency control mechanism.


---

### Connection & Capability Discovery

## `GET /{path}`

Connect to a WebDAV-accessible resource. The `type=webdav` query parameter signals the server to resolve the resource through the WebDAV backend (Nextcloud, ownCloud, etc.).

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path on the WebDAV server |
| `type` | query | string | Yes | Must be `webdav` |
| `server` | query | string | Yes | WebDAV server hostname (e.g. `cloud.example.com`) |
| `user` | query | string | No | WebDAV username |
| `pass` | query | string | No | WebDAV password |
| `webdav_path` | query | string | No | WebDAV endpoint path. Default: `/` |

### SDK Usage

```ts
const result = await client.files.webdav.access({
  path: "/Documents/report.pdf",
  type: "webdav",
  server: "cloud.example.com",
  user: "alice",
  pass: "••••••••",
  webdav_path: "/remote.php/dav/files/alice"
});
```

### Response



File content or directory listing

```json
{
  "description": "File content or directory listing"
}
```



---

## `OPTIONS /{path}`

Returns the HTTP methods and WebDAV compliance classes supported for the given path. WebDAV clients call `OPTIONS` during capability discovery before issuing other WebDAV methods.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path |

### SDK Usage

```ts
const result = await client.files.webdav.getOptions({
  path: "/Documents"
});
```

### Response



The response carries capability information in headers, not the body.

```json
{
  "description": "Allowed methods listed in Allow header",
  "headers": {
    "Allow": {
      "description": "Comma-separated list of supported HTTP methods",
      "schema": {
        "type": "string"
      }
    },
    "DAV": {
      "description": "WebDAV compliance class",
      "schema": {
        "type": "string"
      }
    }
  }
}
```



---

### Copy & Move

## `COPY /{path}`

WebDAV `COPY`: copies a file or directory to a new location specified by the `Destination` header.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | Source file or directory path |
| `Destination` | header | string | Yes | Destination URL for the copy |
| `Depth` | header | string | No | Copy depth: `0` (file only) or `infinity` (recursive for directories). Default: `infinity` |

### SDK Usage

```ts
const result = await client.files.webdav.copyResource({
  path: "/Documents/report.pdf",
  Destination: "https://api.example.com/api/files/webdav/Archive/report-2024.pdf",
  Depth: "0"
});
```

### Response



Resource copied successfully

```json
{
  "description": "Resource copied successfully"
}
```


Resource overwritten at destination

```json
{
  "description": "Resource overwritten at destination"
}
```


Copy not allowed

```json
{
  "error": "Insufficient permissions to copy this resource",
  "success": false
}
```


Source resource not found

```json
{
  "description": "Source resource not found"
}
```


Destination parent does not exist

```json
{
  "description": "Destination parent does not exist"
}
```



---

## `MOVE /{path}`

WebDAV `MOVE`: moves or renames a file or directory to a new location specified by the `Destination` header. Requires both `upload` and `delete` permissions on the source.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | Source file or directory path |
| `Destination` | header | string | Yes | Destination URL for the move |

### SDK Usage

```ts
const result = await client.files.webdav.moveResource({
  path: "/Documents/draft.txt",
  Destination: "https://api.example.com/api/files/webdav/Documents/final.txt"
});
```

### Response



Resource moved successfully

```json
{
  "description": "Resource moved successfully"
}
```


Resource overwritten at destination

```json
{
  "description": "Resource overwritten at destination"
}
```


Move not allowed (requires upload and delete permissions)

```json
{
  "error": "Missing upload or delete permission on source resource",
  "success": false
}
```


Source resource not found

```json
{
  "description": "Source resource not found"
}
```


Destination parent does not exist

```json
{
  "description": "Destination parent does not exist"
}
```



---

### Locking

## `LOCK /{path}`

WebDAV `LOCK`: returns a lock token for client compatibility. This is a stub — the server does not enforce locks, it only echoes the standard WebDAV response so that clients expecting lock semantics do not error out.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path |
| `Depth` | header | string | No | Lock depth: `0` (file only) or `infinity` (recursive) |

### Request Body

The endpoint accepts an optional `application/xml` lock request body. No body fields are required.

### SDK Usage

```ts
const result = await client.files.webdav.lockResource({
  path: "/Documents/report.pdf",
  Depth: "0"
});
```

### Response



Lock token issued (compatibility only)

```json
{
  "description": "Lock token issued (compatibility only)"
}
```


File not found

```json
{
  "description": "File not found"
}
```



---

## `UNLOCK /{path}`

WebDAV `UNLOCK`: releases a previously issued lock token. This is a no-op compatibility stub — the server accepts and discards the token without state.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path |
| `Lock-Token` | header | string | Yes | Lock token to release |

### SDK Usage

```ts
const result = await client.files.webdav.unlockResource({
  path: "/Documents/report.pdf",
  "Lock-Token": "opaquelocktoken:abc123-def456"
});
```

### Response



Lock released (no-op)

```json
{
  "description": "Lock released (no-op)"
}
```


Resource not found

```json
{
  "description": "Resource not found"
}
```



---

### Properties

## `PROPFIND /{path}`

WebDAV `PROPFIND`: retrieves properties (metadata) for a file or directory. Returns a `207 Multi-Status` response in WebDAV XML format containing resource type, size, modification date, ETag, and other standard properties. Use the `Depth` header to control recursion into directories.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path |
| `Depth` | header | string | No | Depth of property retrieval: `0` (resource only), `1` (immediate children), `infinity` (recursive). Default: `1` |

### Request Body

The endpoint accepts an optional `application/xml` PROPFIND body specifying which properties to retrieve. No body fields are required.

### SDK Usage

```ts
const result = await client.files.webdav.propfindResource({
  path: "/Documents",
  Depth: "1"
});
```

### Response



Multi-Status response with resource properties in WebDAV XML format

```json
{
  "description": "Multi-Status response with resource properties in WebDAV XML format"
}
```


Resource not found

```json
{
  "description": "Resource not found"
}
```



---

## `PROPPATCH /{path}`

WebDAV `PROPPATCH`: modifies custom properties on a file. Returns a `207 Multi-Status` response confirming the outcome of each `set` or `remove` instruction.

### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `path` | path | string | Yes | File or directory path |

### Request Body

The endpoint accepts an `application/xml` PROPPATCH body containing `set` and `remove` instructions. No body fields are required by the schema.

### SDK Usage

```ts
const result = await client.files.webdav.proppatchResource({
  path: "/Documents/report.pdf"
});
```

### Response



Multi-Status response confirming property changes

```json
{
  "description": "Multi-Status response confirming property changes"
}
```


File not found

```json
{
  "description": "File not found"
}
```