# Workspace

> A section of the Kumkuat API 1.0.0 reference. The rest of it: https://product.tech/docs-kumkuat-ai/api-reference.md (API Reference). Base URL: `https://api.kumkuat.ai`.

The current workspace and the tag vocabularies it has extracted.

## Get a background job

`GET /api/v1/jobs/{job_id}`

Poll the job id returned by a long-running call (ingestion, audience reactions, report generation) until `status` is `completed`, `failed` or `cancelled`. `result` and `parameters` are JSON-encoded strings. Jobs from other workspaces answer 404.

### Path parameters

- `job_id` (string, required): The job id returned by the call that queued the work.

### Returns (200, object)

OK

- `completed_at` (string, nullable)
- `created_at` (string, required)
- `document_id` (string, nullable)
- `error_message` (string, nullable)
- `id` (string, required, for example "job\_7f3a9c2e")
- `job_type` (string, required, for example "audience\_reactions")
- `max_retries` (integer, default 0)
- `parameters` (string, nullable): The job's input, JSON-encoded as a string.
- `priority` (integer, default 0)
- `result` (string, nullable): The job's output once completed, JSON-encoded as a string.
- `retry_count` (integer, default 0)
- `started_at` (string, nullable)
- `status` (string, required, for example "completed"): queued, running, completed, failed, cancelled or retrying.
- `user_id` (string, nullable)
- `workspace_id` (string, required)

### Responses

- `200`: OK

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/jobs/{job_id}' \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "completed_at": "string",
  "created_at": "string",
  "document_id": "string",
  "error_message": "string",
  "id": "job_7f3a9c2e",
  "job_type": "audience_reactions",
  "max_retries": 0,
  "parameters": "string",
  "priority": 0,
  "result": "string",
  "retry_count": 0,
  "started_at": "string",
  "status": "completed",
  "user_id": "string",
  "workspace_id": "string"
}
```

## Get the current workspace

`GET /api/v1/workspace`

The workspace the API key belongs to, with the caller's role and the workspace settings.

### Query parameters

- `workspace_id` (string): Read another workspace by id. Only honoured for admin keys; every other key gets its own workspace.

### Returns (200, object)

OK

- `company` (string, nullable): Company name the workspace monitors.
- `created_at` (string, nullable)
- `description` (string, default "")
- `is_active` (boolean, default true)
- `is_owner` (boolean, required)
- `name` (string, required, for example "Acme Corp")
- `role` (string, required, for example "owner"): The key owner's role in the workspace: owner, admin or member.
- `settings` (object): Workspace settings (market language, pillars, feature flags).
- `updated_at` (string, nullable)
- `website` (string, nullable)
- `workspace_id` (string, required, for example "ws\_0512272171984c7fb4b7")

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/workspace \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "company": "string",
  "created_at": "string",
  "description": "",
  "is_active": true,
  "is_owner": true,
  "name": "Acme Corp",
  "role": "owner",
  "settings": {},
  "updated_at": "string",
  "website": "string",
  "workspace_id": "ws_0512272171984c7fb4b7"
}
```

## List company names extracted by company auto tags

`GET /api/v1/workspace/company-tags`

Return distinct company names extracted by company auto tags for this workspace.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/workspace/company-tags \
  -H 'X-API-Key: <api key>'
```

## List the workspace's content-type tags

`GET /api/v1/workspace/content-type-tags`

Return distinct content/communication type values extracted by content-type auto tags.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/workspace/content-type-tags \
  -H 'X-API-Key: <api key>'
```

## Get the workspace pull-through priorities

`GET /api/v1/workspace/pull-through-priorities`

The pull-through priorities content writing checks drafts against.

### Returns (200, object)

OK

- `priorities` (array of object, required)
  - `from_kb` (boolean, default false)
  - `level` (string, default "must"): must, should or nice.
  - `text` (string, required, for example "Margin expansion is structural, not one-off")

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/workspace/pull-through-priorities \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "priorities": [
    {
      "from_kb": false,
      "level": "must",
      "text": "Margin expansion is structural, not one-off"
    }
  ]
}
```

## Replace the workspace pull-through priorities

`PUT /api/v1/workspace/pull-through-priorities`

Replace the whole list.

### Request body (application/json, required)

- `priorities` (array of object, required): Replaces the whole list.
  - `from_kb` (boolean, default false)
  - `level` (string, default "must"): must, should or nice.
  - `text` (string, required, for example "Margin expansion is structural, not one-off")

### Returns (200, object)

OK

- `priorities` (array of object, required)
  - `from_kb` (boolean, default false)
  - `level` (string, default "must"): must, should or nice.
  - `text` (string, required, for example "Margin expansion is structural, not one-off")

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/workspace/pull-through-priorities \
  -X PUT \
  -H 'X-API-Key: <api key>' \
  -H 'Content-Type: application/json' \
  -d '{"priorities":[{"text":"Margin expansion is structural, not one-off"}]}'
```

### Example response

```json
{
  "priorities": [
    {
      "from_kb": false,
      "level": "must",
      "text": "Margin expansion is structural, not one-off"
    }
  ]
}
```
