# File a project

`PUT https://api.vidmoat.com/v1/projects/{id}/workspace`

- Scope: `projects.write`
- Cost: Free

File a project into a workspace, or send workspaceId: null to take it out.

> **Note.** A workspace and the project filed in it must be in the same scope: a team project goes in that team's workspace, a personal project in a personal one.

### Path parameters

- `id` (string, required): The project id.

### Body

- `workspaceId` (string or null, optional): The workspace, or `null` (or an empty string) to unfile the project.

## Response

Returns `200`.

### Response fields

- `id` (string): The project id.
- `workspaceId` (string or null): The workspace it is now filed in, or `null` when it was moved out of every workspace.

## Errors

Besides the errors any request can get ([authentication](https://developer.vidmoat.com/developer/docs/authentication#when-a-request-is-refused), [rate limits](https://developer.vidmoat.com/developer/docs/rate-limits)):

| Status | Code | When |
| --- | --- | --- |
| 404 | [`not_found`](https://developer.vidmoat.com/developer/docs/errors#not_found) | No such project or workspace. |
| 400 | [`invalid_request`](https://developer.vidmoat.com/developer/docs/errors#invalid_request) | The project and the workspace belong to different teams. |

## Request examples

```bash curl
curl -X PUT https://api.vidmoat.com/v1/projects/$ID/workspace \
  -H "Authorization: Bearer $VIDMOAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workspaceId":"'$WS'"}'
```

```js Node
const ID = 'YOUR_PROJECT_ID';
const WS = 'YOUR_WORKSPACE_ID';

const res = await fetch(`https://api.vidmoat.com/v1/projects/${ID}/workspace`, {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.VIDMOAT_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    workspaceId: WS,
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? `HTTP ${res.status}`);
console.log(data);
```

```python Python
import os
import requests

ID = "YOUR_PROJECT_ID"
WS = "YOUR_WORKSPACE_ID"

res = requests.put(
    f"https://api.vidmoat.com/v1/projects/{ID}/workspace",
    headers={"Authorization": f"Bearer {os.environ['VIDMOAT_KEY']}"},
    json={
      "workspaceId": WS,
    },
    timeout=60,
)
res.raise_for_status()
print(res.json())
```

## Example response

```json
{ "id": "cm1abc", "workspaceId": "ws_1" }
```

---

Source: https://developer.vidmoat.com/developer/docs/api/workspaces/set-project-workspace
Previous: [Delete a workspace](https://developer.vidmoat.com/developer/docs/api/workspaces/delete-workspace.md)
Next: [Queue a render](https://developer.vidmoat.com/developer/docs/api/renders/create-render.md)
All documentation: https://developer.vidmoat.com/llms-full.txt
