# Watch a Drive folder

Start watching a Google Drive folder, and say where its new files should land: {folderId, targetKind, ...}. targetKind is one of definition_row (with definitionKey + rowId), board_row (with boardRowId) or workspace (the document library, no record at all). An optional documentType stamps every document the folder lands. One watch per folder per workspace - a second is a 409. Watching starts immediately; the first sweep runs within a few minutes or on demand.

Access class: `workspace:admin`.

## Endpoint

`POST /v1/workspace/drive-watches`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "boardRowId": "",
    "definitionKey": "string",
    "documentType": "string",
    "folderId": "",
    "folderName": "string",
    "rowId": "",
    "targetKind": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "boardRowId": "",
    "createdAt": "string",
    "createdBy": 1,
    "definitionId": "",
    "definitionKey": "string",
    "documentType": "string",
    "filesLanded": 1,
    "folderId": "",
    "folderName": "string",
    "id": "",
    "lastSweepError": "string",
    "lastSweepLanded": 1,
    "lastSweptAt": "string",
    "rowId": "",
    "targetKind": "string",
    "updatedAt": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
