---
title: "Create AI agent document"
method: POST
path: "/api/v1/aiAgents/documents"
---

# Create AI agent document

`POST /api/v1/aiAgents/documents`

Create a knowledge document. The projectUuid and agentAccess body fields
are deprecated: scope the document by creating it on the agent route
instead. Without them the document is available to every agent.

## Request body

- ApiCreateAiAgentDocument — Body of POST /api/v1/aiAgents/documents. Both scope fields are deprecated: scope now comes from the agent-scoped route path. Once they are removed this endpoint only creates organization level documents.
  - `agentAccess` string[]
  - `projectUuid` string, nullable
  - `content` string, required
  - `mimeType` string, required
  - `originalFilename` string, required
  - `name` string, required

## Response `201`

Created

- ApiAiAgentDocumentResponse
  - `results` AiAgentDocument, required
    - `updatedAt` string, date-time, required
    - `createdAt` string, date-time, required
    - `updatedByUserUuid` string, nullable, required
    - `createdByUserUuid` string, nullable, required
    - `agentAccess` string[], required
    - `storageKey` string, required
    - `summary` AiAgentDocumentStructuredSummary, required
      - `warning` string, nullable, required
      - `relevance` 'high' | 'medium' | 'low' | 'none', required
      - `useWhen` string, required
      - `relatedExploreNames` string[], required
      - `definedTerms` string[], required
      - `description` string, required
    - `alwaysIncludeInContext` boolean, required
    - `contentSizeBytes` number, double, required
    - `mimeType` string, required
    - `originalFilename` string, required
    - `name` string, required
    - `projectUuid` string, nullable, required
    - `organizationUuid` string, required
    - `uuid` string, required
  - `status` 'ok', required

## Other responses

- `default` — Error

---

[API](https://skmtc.net/lightdash/apis/lightdash-api.md) · [All operations](https://skmtc.net/lightdash/apis/lightdash-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lightdash/lightdash-api/versions/40c933755c9a/schema)
