# List documents

`GET` `https://goblins-call-api.onrender.com/v1/knowledge/documents`

Returns your workspace’s documents, newest first.

Needs a [workspace API key](https://www.cracklehq.com/docs/authentication).

## Query parameters

- `userId` (string, optional): A workspace ID. A key belongs to one workspace, so this is never needed with one; naming another workspace answers `403`.

Request:

cURL:

```bash
curl "https://goblins-call-api.onrender.com/v1/knowledge/documents" \
  -H "Authorization: Bearer $CRACKLE_API_KEY"
```

Node.js:

```js
const response = await fetch('https://goblins-call-api.onrender.com/v1/knowledge/documents', {
  headers: {
    Authorization: `Bearer ${process.env.CRACKLE_API_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

Python:

```python
import os
import requests

response = requests.get(
    "https://goblins-call-api.onrender.com/v1/knowledge/documents",
    headers={"Authorization": f"Bearer {os.environ['CRACKLE_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

Response · 200 OK:

```json
{
  "documents": [
    {
      "id": "kd_4b1f0c9d2e7a6f53",
      "name": "Refund policy",
      "status": "ready",
      "summary": "The shop’s refund and cancellation rules.",
      "topics": ["refunds", "cancellations"],
      "cardCount": 6,
      …
    }
  ]
}
```

Source: https://www.cracklehq.com/docs/reference/knowledge/list
