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

# Update Document

> Modify an existing document's data and properties by its unique ID.



## OpenAPI

````yaml PUT /document/{id}
openapi: 3.0.1
info:
  title: Machina Sports SDK
  description: >-
    Machina Sports API for seamless AI integration in sports, offering real-time
    insights, personalized content, and fan sentiment analysis.
  version: '1.0'
  termsOfService: http://machina.gg/tos/
  contact:
    email: support@machina.gg
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://{api-address}.org.machina.gg
    description: Production server
    variables:
      api-address:
        default: https://api.machina.gg
        description: Your api-address
  - url: http://local.machina:5001
    description: Local development server
security:
  - ApiToken: []
paths:
  /document/{id}:
    put:
      tags:
        - documents
      summary: Update Document
      description: Modify an existing document's data and properties by its unique ID.
      operationId: updateDocument
      parameters:
        - name: id
          in: path
          required: true
          description: Unique ID of the document to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                value:
                  type: object
                  description: >-
                    The main data of the document, can be any type (string,
                    object, array, etc.)
                  example:
                    messages:
                      - content: How do the odds look for Man City vs Real Madrid?
                        date: '2024-12-07T23:09:39.784Z'
                        role: user
                      - content: Manchester City vs Real Madrid
                        date: '2024-12-07T23:11:39.784Z'
                        role: assistant
                metadata:
                  type: object
                  description: Additional metadata for the document
                status:
                  type: string
                  enum:
                    - active
                    - draft
                    - archived
                  description: Updated status of the document
      responses:
        '200':
          description: Document updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      _id:
                        type: string
                        description: Unique identifier of the document
                        example: 67e1fc8c2a5ade8c69c03fe7
                      name:
                        type: string
                        description: Unique name of the document
                        example: New test document
                      value:
                        type: object
                        description: Updated main data of the document
                        example:
                          messages:
                            - content: >-
                                How do the odds look for Man City vs Real
                                Madrid?
                              date: '2024-12-07T23:09:39.784Z'
                              role: user
                            - content: Manchester City vs Real Madrid
                              date: '2024-12-07T23:11:39.784Z'
                              role: assistant
                      metadata:
                        type: object
                        description: Updated metadata for the document
                        example:
                          agent_id: '123'
                      status:
                        type: string
                        description: Updated status of the document
                        example: null
                      created:
                        type: string
                        description: Creation timestamp
                        example: Tue, 25 Mar 2025 00:45:00 GMT
                      updated:
                        type: string
                        description: Update timestamp
                        example: Tue, 25 Mar 2025 01:54:59 GMT
                      embed-vector:
                        type: boolean
                        description: Whether a vector embedding was created
                        example: false
                  message:
                    type: string
                    description: Success message
                    example: document updated
                  status:
                    type: boolean
                    description: Operation status
                    example: true
                example:
                  data:
                    _id: 67e1fc8c2a5ade8c69c03fe7
                    created: Tue, 25 Mar 2025 00:45:00 GMT
                    embed-vector: false
                    metadata:
                      agent_id: '123'
                    name: New test document
                    status: null
                    updated: Tue, 25 Mar 2025 01:54:59 GMT
                    value:
                      messages:
                        - content: How do the odds look for Man City vs Real Madrid?
                          date: '2024-12-07T23:09:39.784Z'
                          role: user
                        - content: Manchester City vs Real Madrid
                          date: '2024-12-07T23:11:39.784Z'
                          role: assistant
                  message: document updated
                  status: true
        '401':
          description: Unauthorized
        '404':
          description: Document not found
components:
  securitySchemes:
    ApiToken:
      type: apiKey
      name: x-api-token
      in: header
      description: API key authentication

````