# Workspace

> The workspace this session is signed in to; Rename the workspace

## The workspace this session is signed in to

`GET /v1/workspace` · operation `getWorkspace`

Requires the `batondeck:workspace:read` permission (action `workspace:read`).

**Responses**

| Status | Meaning |
|---|---|
| 200 | The workspace this session is signed in to |
| 401 | No portal session, and no live API key. |
| 403 | The policy refused, or the request was cross-site. |
| 404 | No such resource, or none this session may see. |

<details>
<summary>200 response schema</summary>

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "plan": {
      "type": "string"
    },
    "jurisdiction": {
      "type": "string"
    },
    "hold_until": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "paused_at": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "session_max_age_hours": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "number"
    }
  },
  "required": [
    "id",
    "name",
    "slug",
    "status",
    "plan",
    "jurisdiction",
    "hold_until",
    "paused_at",
    "session_max_age_hours",
    "created_at"
  ],
  "additionalProperties": false
}
```

</details>

```sh
curl -X GET 'https://api.batondeck.com/v1/workspace' \
  -H "Authorization: Bearer $BATONDECK_API_KEY"
```


## Rename the workspace

`PATCH /v1/workspace` · operation `updateWorkspace`

Requires the `batondeck:workspace:admin` permission (action `workspace:update`).

Refused while the workspace is suspended or on deletion hold.

**Request body** (`application/json`)

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | string |  | ≥ 1 chars, ≤ 64 chars |
| `session_max_age_hours` | integer \\| null |  |  |

<details>
<summary>Request schema</summary>

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "session_max_age_hours": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 168
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

</details>

**Responses**

| Status | Meaning |
|---|---|
| 200 | Rename the workspace |
| 400 | The arguments did not validate. |
| 401 | No portal session, and no live API key. |
| 403 | The policy refused, or the request was cross-site. |
| 404 | No such resource, or none this session may see. |

<details>
<summary>200 response schema</summary>

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "plan": {
      "type": "string"
    },
    "jurisdiction": {
      "type": "string"
    },
    "hold_until": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "paused_at": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "session_max_age_hours": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "number"
    }
  },
  "required": [
    "id",
    "name",
    "slug",
    "status",
    "plan",
    "jurisdiction",
    "hold_until",
    "paused_at",
    "session_max_age_hours",
    "created_at"
  ],
  "additionalProperties": false
}
```

</details>

```sh
curl -X PATCH 'https://api.batondeck.com/v1/workspace' \
  -H "Authorization: Bearer $BATONDECK_API_KEY" \
  -H 'content-type: application/json' \
  -d @body.json
```
