<!-- https://developers.silktide.com/v1/presence/setup/get-workspace | Presence / Setup -->

# Get the id that other Presence queries take

`GET /v1/results/accounts/presence/workspaces/table`

Answers with the `workspaceId` that every other Presence query needs. An account's markets live together in one workspace, so this is usually one row and its id does not change: read it once and keep it.

People never see a workspace in Silktide. What they work in is a market, and [Presence](https://developers.silktide.com/v1/presence.md#which-market) says how to read one market through the API.

Only a key whose user can see all markets gets the row. If there are no rows, the account has not set up Presence, or the key's user is limited to some of its markets. In that case, [Get answers in full](https://developers.silktide.com/v1/presence/answers/get-answers.md) with a `marketId` they can see answers with the `workspaceId` too.

## Request

### Query parameters

- `columns` (string, optional): The columns to return, comma-separated, such as `url,pageViews`. Left out, the table's default columns. Send a string even in a JSON body: an array is ignored.
- `sort` (string, optional): The column to sort by, then `:a` for ascending or `:d` for descending, such as `pageViews:d`. Left out, the table's own order.
- `search` (string, optional): Only rows matching this text. What it searches depends on the table, most often the URL or title.
- `page` (integer, optional, at least 1): The page of rows to return, from `1`. Defaults to `1`.
- `rowsPerPage` (integer, optional, at least 1): How many rows a page holds. Defaults to `100`.
- `criteria` (string, optional): Filters on the table's columns, as `column:value`, joined with `;`. `status` takes `active` (the default), `deleted` or `all`, such as `status:all`.

## Response

Status `200`.

- `result` (object, required): The answer.
  - `page` (integer, required, at least 1): The page returned. Not always the page asked for, when that was out of range.
  - `minPage` (integer, required, at least 1): The first page. Always `1`.
  - `maxPage` (integer, required): The last page at this `rowsPerPage`. With no rows, `0` or `1` depending on the table.
  - `numRows` (integer, required): How many rows there are across every page.
  - `rowsPerPage` (integer, required, at least 1): How many rows a page holds.
  - `rows` (list of objects, required): The rows on this page.
    - `workspaceId` (integer, required, at least 1): The id every other Presence query takes as `workspaceId`.
    - `brandId` (integer, required): The account's own brand, as `brandId` in [Get brands](https://developers.silktide.com/v1/presence/brands/get-brands.md).
    - `name` (string, required): Its name, often the account's own brand.
    - `status` (string, required): `active`, or `deleted`. One of: `active`, `deleted`.
    - `updated` (integer, required): When it was last changed.
- `selector` (string, required): The query that answered, as its path: `/v1/results/scores`.
- `duration` (number, required): Seconds Silktide took to answer.

## Errors

| Status | Type | When |
| --- | --- | --- |
| 200 | `EditionNotAvailable` | The account does not have Silktide 5. Its `status` is `403`. The body is an error despite the status. |
| 401 | `NotLoggedIn` | No API key was sent, or it is not a key for this region. |
| 429 | `TooManyRequests` | Too many requests to this path in five seconds. Retry after the number of seconds in the `Retry-After` header, which `properties.retryAfter` repeats. |
| 503 | - | Silktide is busy. Retry after the number of seconds in the `Retry-After` header. |

## Access

- Permission: Can see all markets
- Plan feature: none
- Edition: Silktide 5 only
- Cost: free
- Stability: stable, since 1.2.0

## Example: The account's workspace

```bash
curl "https://api.eu.silktide.com/v1/results/accounts/presence/workspaces/table" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "result": {
    "page": 1,
    "minPage": 1,
    "maxPage": 1,
    "numRows": 1,
    "rowsPerPage": 100,
    "rows": [
      {
        "workspaceId": 1,
        "brandId": 4,
        "name": "Fake Wine Barrel",
        "status": "active",
        "updated": 1793610000
      }
    ]
  },
  "selector": "/v1/results/accounts/presence/workspaces/table",
  "duration": 0.05
}
```
