# Restore shared content as a new file state

Source: https://docs.wabe.sh/api-reference/operations/restorefile/

`POST https://api.wabe.sh/v1/disks/{disk}/restore`

## Authorization

Project API key from the Wabe Dashboard or actor runtime access token for the disk URL supplied by the broker.

## Parameters

- `disk` (path, string, required) — Project disk name, or the disk ID in the actor runtime disk URL.

- `branch` (query, string)

- `commit` (query, string)

- `label` (query, string)

## Request body

`application/json`

Example

```json
{
  "path": "/notes.txt",
  "version": "f75f43ae-8375-48f0-8bcd-862cb75c26ef"
}
```

Schema

```json
{
  "type": "object",
  "properties": {
    "path": {
      "type": "string"
    },
    "version": {
      "type": "string",
      "format": "uuid"
    },
    "expected_version": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "revision": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "id",
        "revision"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "path",
    "version"
  ],
  "additionalProperties": false
}
```

## Responses

### 200

Metadata of the restored file.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "version": {
      "const": 2
    },
    "kind": {
      "oneOf": [
        {
          "const": "Directory"
        },
        {
          "type": "object",
          "properties": {
            "File": {
              "type": "object",
              "properties": {
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "chunk_bytes": {
                  "type": "integer",
                  "minimum": 4096,
                  "maximum": 4194304
                },
                "content_root": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "required": [
                "content_root",
                "size",
                "chunk_bytes"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "File"
          ],
          "additionalProperties": false
        }
      ]
    },
    "object_id": {
      "type": "string",
      "format": "uuid"
    },
    "version_id": {
      "type": "string",
      "format": "uuid"
    },
    "branch_id": {
      "type": "string",
      "format": "uuid",
      "description": "Origin of the version; inherited or imported versions may refer to an internal or deleted branch absent from the branch list."
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "first_edit_at_ms": {
      "type": "integer",
      "minimum": 0
    },
    "last_edit_at_ms": {
      "type": "integer",
      "minimum": 0
    },
    "mode": {
      "type": "integer",
      "enum": [
        16384,
        33188,
        33261,
        40960
      ]
    }
  },
  "required": [
    "version",
    "kind",
    "object_id",
    "version_id",
    "branch_id",
    "revision",
    "first_edit_at_ms",
    "last_edit_at_ms",
    "mode"
  ],
  "additionalProperties": false
}
```

### 400

Invalid input.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 401

Missing, invalid or revoked project API key, or an invalid runtime access token.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 403

Actor runtime token does not authorize this disk or instance generation.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 404

Object was not found.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 409

Conflict, nonempty destination or referenced object.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 500

Storage, I/O or corruption failure.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 503

Disk unavailable.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```
