# Report what agents asked a workspace

:::openapi-operation GET /api/v1/workspaces/{workspace}/agent-insights
AUTH bearerAuth
:::

Agent searches and reads over MCP and the REST API in the last 30 days: top questions, unanswered questions, articles agents read beside human reads, clients, and keys. A question is unanswered when its search found nothing, or when the same key opened none of the top 3 results within 30 minutes.

:::codesamples open Code examples

```bash:curl
curl -X GET "https://contextowl.co/api/v1/workspaces/string/agent-insights" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <token>"
```

```java:Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = HttpClient.newHttpClient();
    var request = HttpRequest.newBuilder()
        .uri(URI.create("https://contextowl.co/api/v1/workspaces/string/agent-insights"))
        .header("Accept", "application/json")
        .header("Authorization", "Bearer <token>")
        .method("GET", HttpRequest.BodyPublishers.noBody())
        .build();

    var response = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.statusCode());
    System.out.println(response.body());
  }
}
```

```python:Python
import urllib.request

url = "https://contextowl.co/api/v1/workspaces/string/agent-insights"
headers = {
    "Accept": "application/json",
    "Authorization": "Bearer <token>",
}
data = None
req = urllib.request.Request(url, data=data, headers=headers, method="GET")
with urllib.request.urlopen(req) as res:
    print(res.status)
    print(res.read().decode())
```

```typescript:TypeScript
const response = await fetch("https://contextowl.co/api/v1/workspaces/string/agent-insights", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer <token>",
  }
});

console.log(response.status);
console.log(await response.json());
```

```go:Go
package main

import (
	"fmt"
	"io"
	"net/http"
	"time"
)

func main() {
	req, err := http.NewRequest("GET", "https://contextowl.co/api/v1/workspaces/string/agent-insights", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Accept", "application/json")
	req.Header.Set("Authorization", "Bearer <token>")
	client := &http.Client{Timeout: 30 * time.Second}
	res, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	bodyBytes, err := io.ReadAll(io.LimitReader(res.Body, 10<<20))
	if err != nil {
		panic(err)
	}
	fmt.Println(res.StatusCode)
	fmt.Println(string(bodyBytes))
}
```

```rust:Rust
// cargo add reqwest --features blocking
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::blocking::Client::new();
    let response = client.request(reqwest::Method::GET, "https://contextowl.co/api/v1/workspaces/string/agent-insights")
        .header("Accept", "application/json")
        .header("Authorization", "Bearer <token>")
        .send()?;

    println!("{}", response.status());
    println!("{}", response.text()?);
    Ok(())
}
```

:::

:::details open Parameters (1)

| NAME | IN | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- | --- |
| `workspace` | path | string | yes | Workspace id, or - for the key's bound workspace |

:::

:::details open Success responses (200)

#### 200

Success

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `calls` | integer | yes | - |
| `clients` | array items: BarItem object | yes | - |
| `days` | integer | yes | - |
| `keyLabels` | array items: BarItem object | yes | - |
| `keys` | integer | yes | - |
| `mostRead` | array items: AgentArticleReads object | yes | - |
| `questions` | array items: AgentQuestion object | yes | - |
| `reads` | integer | yes | - |
| `recordsQueries` | boolean | yes | - |
| `searches` | integer | yes | - |
| `unanswered` | array items: AgentQuestion object | yes | - |
| `unansweredSearches` | integer | yes | - |
| `unansweredShare` | integer | yes | - |

```json
{
  "calls": 0,
  "clients": [
    {
      "bar": 0,
      "label": "string",
      "value": 0
    }
  ],
  "days": 0,
  "keyLabels": [
    {
      "bar": 0,
      "label": "string",
      "value": 0
    }
  ],
  "keys": 0,
  "mostRead": [
    {
      "agentReads": 0,
      "humanViews": 0,
      "slug": "string",
      "title": "string"
    }
  ],
  "questions": [
    {
      "count": 0,
      "lastSeen": "string",
      "query": "string",
      "unanswered": 0
    }
  ],
  "reads": 0,
  "recordsQueries": true,
  "searches": 0,
  "unanswered": [
    {
      "count": 0,
      "lastSeen": "string",
      "query": "string",
      "unanswered": 0
    }
  ],
  "unansweredSearches": 0,
  "unansweredShare": 0
}
```

:::

:::details Error responses (400, 401, 403, 404, 429)

#### 400

Bad request

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `error` | object | yes | - |

```json
{
  "error": {
    "code": "string",
    "details": null,
    "message": "string",
    "status": 0
  }
}
```

#### 401

Unauthorized

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `error` | object | yes | - |

```json
{
  "error": {
    "code": "string",
    "details": null,
    "message": "string",
    "status": 0
  }
}
```

#### 403

Forbidden

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `error` | object | yes | - |

```json
{
  "error": {
    "code": "string",
    "details": null,
    "message": "string",
    "status": 0
  }
}
```

#### 404

Not found

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `error` | object | yes | - |

```json
{
  "error": {
    "code": "string",
    "details": null,
    "message": "string",
    "status": 0
  }
}
```

#### 429

Rate limited

**Content-Type:** `application/json`

| FIELD | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `error` | object | yes | - |

```json
{
  "error": {
    "code": "string",
    "details": null,
    "message": "string",
    "status": 0
  }
}
```

:::
