> ## 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.

# Get a file upload link

> Get a link to upload a file for the knowledge library through the Nedzo REST API, so you don't have to host the file yourself.

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

Get a link to upload one file. Then:

1. `PUT` the file bytes to `uploadUrl`, with the `Content-Type` header set to `contentType`.
2. Add the file with [Add knowledge](/api-reference/knowledge/create), using the `fileUrl` and `fileName` from this answer.

Each link puts the file at a new address, so it can't replace another file. The link works for 2 hours.

A file can be up to 5 MB. That is the most we can read. A bigger file uploads, but [Add knowledge](/api-reference/knowledge/create) refuses it and removes it.

The link fixes the address, not the file type. Send the `contentType` from this answer. When you add the file, `fileName` must have the same extension as the upload.

Anyone with the `fileUrl` can open the file.

| Extension | `contentType` |
| - | - |
| `pdf` | `application/pdf` |
| `docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |
| `txt` | `text/plain` |
| `md` | `text/markdown` |
| `csv` | `text/csv` |

<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="fileName" type="string" required>
  The file name, with its extension.
</ParamField>

<ParamField body="contentType" type="string" required>
  The file type from the table above. It must match the extension.
</ParamField>

## Errors

| Status | When |
| - | - |
| `400` | The file type is not supported, or `contentType` does not match the extension. |
| `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 workspace or create a link. Try again. |

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

  # Then upload the file to the uploadUrl from the answer
  curl -X PUT "UPLOAD_URL" \
      -H "Content-Type: application/pdf" \
      --data-binary @price-list.pdf
  ```
</RequestExample>

<ResponseExample>
  ```json Response (201) theme={null}
  {
    "uploadUrl": "https://...",
    "method": "PUT",
    "fileUrl": "https://...",
    "fileName": "price-list.pdf",
    "contentType": "application/pdf",
    "maxBytes": 5242880,
    "expiresAt": "2026-10-11T12:00:00Z"
  }
  ```
</ResponseExample>


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