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

# Upload Text Item

> Create a knowledge item from raw text content.
The text is stored in the database and indexed asynchronously.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/knowledge/item/text
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/knowledge/item/text:
    post:
      tags:
        - Knowledge Items
      summary: Upload Text Item
      description: |-
        Create a knowledge item from raw text content.
        The text is stored in the database and indexed asynchronously.
      operationId: upload_text_item_v1_knowledge_item_text_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextKnowledgeItemRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextKnowledgeItemResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    TextKnowledgeItemRequest:
      properties:
        name:
          type: string
          title: Item Name
          description: Name for the knowledge item
        content:
          type: string
          title: Text Content
          description: The text content to index as a knowledge item
        knowledge_base_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Knowledge Base ID
          description: Optional ID of a knowledge base to assign the item to
      type: object
      required:
        - name
        - content
      title: TextKnowledgeItemRequest
    TextKnowledgeItemResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Knowledge Item ID
          description: Unique identifier for the knowledge item
        name:
          type: string
          title: Knowledge Item Name
          description: Name of the knowledge item
        created_date:
          type: string
          format: date-time
          title: Created Date
          description: When the item was created
        category:
          type: string
          const: txt
          title: Category
          default: txt
        status:
          $ref: '#/components/schemas/KnowledgeItemStatus'
          title: Item Status
          description: Current status of the knowledge item
        size_bytes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size Bytes
          description: Size of the knowledge item content in bytes
        knowledge_base_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Knowledge Base ID
          description: ID of the knowledge base this item belongs to, if any
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: Text content of the knowledge item
      type: object
      required:
        - id
        - name
        - created_date
        - status
      title: TextKnowledgeItemResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    KnowledgeItemStatus:
      type: string
      enum:
        - indexing
        - uploaded
        - error
      title: KnowledgeItemStatus
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````