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

# Add knowledge

> Add a website, a text or a file to the knowledge library of a workspace through the Nedzo REST API.

<Note>
  This endpoint is for the VIP plan only. Other plans get a `403`. See [Plan access](/api-reference/introduction#plan-access).
</Note>

Add one item to the knowledge library. Set `type` to `website`, `text` or `file`, and send the field for that type. An item does nothing until an agent uses it.

To add a file:

1. Get an upload link from [Get a file upload link](/api-reference/knowledge/upload).
2. `PUT` the file to the `uploadUrl`.
3. Send the `fileUrl` and `fileName` here.

A `fileUrl` must come from an upload link for the same workspace. A link to a file somewhere else is refused. The file can be up to 5 MB, and `fileName` must have the same extension as the upload.

Anyone with the `fileUrl` can open the file.

When we refuse a file because it is over 5 MB, we remove the uploaded file. For any other refusal, the file stays, so you can fix the request and send it again with the same `fileUrl`.

Your plan sets how many knowledge items the account can have. The count covers every workspace in the account.

<Tip>
  `workspaceId` is required for **account-scoped** API keys and taken from the key for **workspace-scoped** keys. See [Workspace ID and Request Scope](/authentication#workspace-id-and-request-scope).
</Tip>

## Body Parameters

<ParamField body="workspaceId" type="string" optional>
  The workspace. Required for an account-scoped key.
</ParamField>

<ParamField body="type" type="string" required>
  `website`, `text` or `file`.
</ParamField>

<ParamField body="name" type="string" required>
  A name for the item, 1 to 255 characters.
</ParamField>

<ParamField body="websiteUrl" type="string">
  For a `website` item. A public web page. We add `https://` when you leave it out. A private or local address is refused.
</ParamField>

<ParamField body="textContent" type="string">
  For a `text` item. Up to 500,000 characters.
</ParamField>

<ParamField body="fileUrl" type="string">
  For a `file` item. The `fileUrl` from your upload link, after the upload is done.
</ParamField>

<ParamField body="fileName" type="string">
  For a `file` item. The file name, with its extension: `pdf`, `docx`, `txt`, `md` or `csv`.
</ParamField>

## Errors

| Status | When |
| - | - |
| `400` | A field is missing or does not fit the type, the website address is not allowed, the file type is not supported, the `fileUrl` is not from an upload link for this workspace, `fileName` has a different extension than the upload, no file was uploaded there yet, the file is over 5 MB, or the plan limit is reached. |
| `402` | The account has no plan, or its subscription is not active. |
| `404` | The workspace is not in your API key's scope. |
| `403` | The workspace is locked. The answer has `workspaceLocked: true`. |
| `502` | We could not check the plan limit, the workspace or the uploaded file, or its size. Try again. |

<RequestExample>
  ```bash Website theme={null}
  curl -X POST "https://api.nedzo.ai/v1/knowledge" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "type": "website",
        "name": "Pricing page",
        "websiteUrl": "https://example.com/pricing"
      }'
  ```

  ```bash Text theme={null}
  curl -X POST "https://api.nedzo.ai/v1/knowledge" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "type": "text",
        "name": "Opening hours",
        "textContent": "We are open 9 to 5, Monday to Friday."
      }'
  ```

  ```bash File theme={null}
  curl -X POST "https://api.nedzo.ai/v1/knowledge" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "type": "file",
        "name": "Price list",
        "fileUrl": "FILE_URL_FROM_THE_UPLOAD_LINK",
        "fileName": "price-list.pdf"
      }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response (201) theme={null}
  {
    "id": "33333333-3333-4333-8333-333333333333",
    "workspaceId": "22222222-2222-4222-8222-222222222222",
    "name": "Opening hours",
    "type": "text",
    "websiteUrl": null,
    "fileUrl": null,
    "fileName": null,
    "textContent": "We are open 9 to 5, Monday to Friday.",
    "agents": [],
    "createdAt": "2026-10-11T10:00:00Z",
    "updatedAt": "2026-10-11T10:00:00Z"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.