> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leavo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Knowledge

> List the organization's knowledge items and retrieve a specific one

Returns every knowledge item in the organization, both global and
assistant-specific ones.

## Response

Returns `200 OK` with an array of knowledge objects.

<ResponseField name="id" type="string">
  Knowledge item UUID
</ResponseField>

<ResponseField name="name" type="string">
  Display name
</ResponseField>

<ResponseField name="content" type="string">
  Indexed text of the knowledge item
</ResponseField>

<ResponseField name="assistant_id" type="string | null">
  `null` when the knowledge is global; a UUID when it belongs to a single assistant
</ResponseField>

<ResponseField name="excluded_assistant_ids" type="array">
  Assistants that do not see this global knowledge item
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.leavo.ai/backend/knowledge" \
    -H "Authorization: Bearer your_api_key_here"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.leavo.ai/backend/knowledge', {
    headers: {
      'Authorization': 'Bearer your_api_key_here'
    }
  });

  const knowledgeItems = await response.json();
  console.log(`${knowledgeItems.length} items in the knowledge base`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.leavo.ai/backend/knowledge',
      headers={'Authorization': 'Bearer your_api_key_here'}
  )

  for item in response.json():
      scope = 'global' if item['assistant_id'] is None else 'exclusive'
      print(item['name'], '-', scope)
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  [
    {
      "id": "9f1c2d34-5678-4abc-9def-0123456789ab",
      "tenant_id": "d6b10acc-2307-413f-a4de-4c2edf3f9a70",
      "name": "Return policy",
      "description": "Exchange and return rules",
      "content": "Returns within 30 days with the receipt...",
      "source_url": null,
      "usage_instruction": "Use when the lead asks about exchanges.",
      "assistant_id": null,
      "excluded_assistant_ids": [],
      "created_at": "2026-01-15T10:30:00Z",
      "updated_at": "2026-02-02T09:12:00Z"
    },
    {
      "id": "1a2b3c4d-5e6f-4071-8293-a4b5c6d7e8f9",
      "tenant_id": "d6b10acc-2307-413f-a4de-4c2edf3f9a70",
      "name": "Qualification script",
      "description": "",
      "content": "Questions to qualify the lead...",
      "source_url": null,
      "usage_instruction": null,
      "assistant_id": "3f8a1b2c-4d5e-6f70-8192-a3b4c5d6e7f8",
      "excluded_assistant_ids": [],
      "created_at": "2026-01-20T14:00:00Z",
      "updated_at": "2026-01-20T14:00:00Z"
    }
  ]
  ```
</ResponseExample>

## Retrieve a specific knowledge item

```bash theme={null}
GET /backend/knowledge/{id}
```

### Path Parameters

<ParamField path="id" type="string" required>
  Knowledge item UUID
</ParamField>

Returns `200 OK` with a single knowledge object, or `404` if the item does not
exist in your organization.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.leavo.ai/backend/knowledge/9f1c2d34-5678-4abc-9def-0123456789ab" \
    -H "Authorization: Bearer your_api_key_here"
  ```

  ```javascript JavaScript theme={null}
  const id = '9f1c2d34-5678-4abc-9def-0123456789ab';

  const response = await fetch(`https://api.leavo.ai/backend/knowledge/${id}`, {
    headers: {
      'Authorization': 'Bearer your_api_key_here'
    }
  });

  if (response.status === 404) {
    console.log('Knowledge not found');
  } else {
    console.log(await response.json());
  }
  ```
</RequestExample>

### Errors

| Code  | Description                                   |
| ----- | --------------------------------------------- |
| `401` | Missing or invalid API key                    |
| `404` | Knowledge item not found in this organization |
