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

# Update document

> Update document metadata, tags, or replace the file.



## OpenAPI

````yaml /openapi.yaml patch /documents/{documentId}
openapi: 3.1.0
info:
  title: SquadVault Public API
  version: 1.0.0
  description: >
    Organization-scoped Public API for teams, players, documents, tryout
    applications, and uploads.

    Base path is `/v1`. Authenticate with an organization API key in the
    `x-api-key` header.


    The key is scoped to one organization. List and create calls still require
    that organization ID

    in the path, query, or body, and it must match the key. Tryout get, update,
    and convert-to-player

    always require `organizationId` (query on GET, JSON body on PATCH/POST). Get
    team/player by ID

    uses `/teams/{organizationId}/{teamId}` and
    `/players/{organizationId}/{playerId}`.

    Team, player, and document update/delete resolve the organization from the
    resource ID.
  contact:
    name: SquadVault Support
    email: hello@squadvault.xyz
    url: https://squadvault.xyz
servers:
  - url: https://api.squadvault.xyz/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Teams
  - name: Players
  - name: Documents
  - name: Tryout Applications
  - name: Uploads
paths:
  /documents/{documentId}:
    patch:
      tags:
        - Documents
      summary: Update document
      description: Update document metadata, tags, or replace the file.
      operationId: updateDocument
      parameters:
        - $ref: '#/components/parameters/DocumentIdPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentRequest'
            example:
              name: Playbook Q3 (Final)
              tags:
                - playbook
                - management
      responses:
        '200':
          description: Updated document
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    DocumentIdPath:
      name: documentId
      in: path
      required: true
      schema:
        type: string
  schemas:
    UpdateDocumentRequest:
      type: object
      properties:
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/DocumentTag'
        teamId:
          type:
            - string
            - 'null'
        fileKey:
          type: string
        fileUrl:
          type: string
          format: uri
        contentType:
          $ref: '#/components/schemas/ContentType'
        sizeBytes:
          type: integer
          minimum: 1
          maximum: 26214400
      description: >
        To replace the file, send `fileKey`, `fileUrl`, `contentType`, and
        `sizeBytes` together.
    Document:
      type: object
      properties:
        id:
          type: string
        organizationId:
          type: string
        teamId:
          type:
            - string
            - 'null'
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        fileUrl:
          type: string
        fileKey:
          type: string
        contentType:
          type: string
        sizeBytes:
          type: integer
        uploadedBy:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        tags:
          type: array
          items:
            $ref: '#/components/schemas/DocumentTag'
        team:
          oneOf:
            - $ref: '#/components/schemas/DocumentTeamSummary'
            - type: 'null'
        uploadedByUser:
          oneOf:
            - $ref: '#/components/schemas/DocumentUploader'
            - type: 'null'
    DocumentTag:
      type: string
      enum:
        - playbook
        - contract
        - management
        - content
        - legal
        - other
    ContentType:
      type: string
      enum:
        - application/pdf
        - application/msword
        - >-
          application/vnd.openxmlformats-officedocument.wordprocessingml.document
        - application/vnd.ms-excel
        - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
        - text/plain
        - image/jpeg
        - image/png
        - image/webp
        - image/gif
    DocumentTeamSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    DocumentUploader:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              value:
                error: unauthorized
            invalidApiKey:
              value:
                error: invalidApiKey
    Forbidden:
      description: Valid credentials but missing permission or feature
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              value:
                error: forbidden
            featureNotAvailable:
              value:
                error: featureNotAvailable
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Organization API key from Settings → API keys.

````