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

# Create Semantic Layer Document

> Write a document into the Semantic Layer with an API key.

An API key writes as **the person who created it**, checked on every request. So a key may create a
document exactly where its creator may:

| Plan           | Who may create                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Growth, Custom | Owners and admins anywhere; a member needs **editor** on the destination — the folder, or the root when `folder` is omitted. |
| Free, Starter  | Owners and admins only. Grants are not enforced on these plans, so the rule is the role the key inherits.                    |

Demote the creator and every key they minted narrows on the next call — there is nothing to revoke
separately.

```bash theme={null}
curl --request POST \
  --url "https://api.nekt.ai/api/v1/semantic-layer/documents/" \
  --header "x-api-key: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "MRR definition",
    "content": "MRR counts active subscriptions in @table::silver.subscriptions, excluding trials.",
    "folder": "b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"
  }'
```

Mentions are parsed out of `content` for you and returned in the read-only `mentions` field; the
document is indexed for semantic search right after it is written.

<Note>
  Folders are **read-only** to an API key, so `folder` has to name one that already exists — create
  folders in the app. Deleting a document is not available to a key either and returns `403`.
</Note>

## Related

* [Update a document](/platform-api/semantic-layer/update).
* [List Semantic Layer Documents](/platform-api/permissions/semantic-layer/list-documents) — to find folder and document ids.
* [Assign Semantic Layer Permissions](/platform-api/permissions/semantic-layer/assign) — to give the key's creator editor access somewhere.


## OpenAPI

````yaml POST /api/v1/semantic-layer/documents/
openapi: 3.0.3
info:
  title: Nekt API
  version: v1
  description: Nekt API Documentation
  contact:
    email: support@nekt.ai
servers:
  - url: https://api.nekt.ai
security: []
paths:
  /api/v1/semantic-layer/documents/:
    post:
      tags:
        - v1
      summary: Create a Semantic Layer document
      description: >-
        Writes a document into a folder, or at the root when `folder` is
        omitted. Requires editor access on the destination; mentions are parsed
        from `content` and indexed for search.
      operationId: v1_semantic_layer_documents_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SemanticLayerDocument'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SemanticLayerDocument'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SemanticLayerDocument'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SemanticLayerDocument'
          description: ''
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SemanticLayerDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          maxLength: 255
        content:
          type: string
        mentions:
          readOnly: true
        folder:
          type: string
          format: uuid
          nullable: true
          description: >-
            Folder to place the document in. Omit or send null to put it at the
            root.
        order:
          type: integer
          readOnly: true
          nullable: true
          description: >-
            Manual position among its siblings; NULL falls back to created_at
            ordering.
        created_by:
          type: string
          readOnly: true
          description: Created by (Expandable)
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - created_at
        - created_by
        - id
        - mentions
        - name
        - order
        - updated_at
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API Key authentication. Format: ''x-api-key: api_key'''

````