---
updatedAt: 2026-06-05T22:45:55.000Z
agentTools:
  projectIndex: https://developers.textmine.com/llms.txt
---

# Update document metadata

Renames a document, changes its document type, and optionally queues reprocessing.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "TextMine Public API V3",
    "version": "3.0.0",
    "description": "TextMine Public API V3 exposes Vault, document, integration, workflow, agent, report, alert, search, metadata, and business-record operations for API clients and AI agents.\n\nAgent-friendly conventions:\n- Use stable `operationId` values rather than path text when selecting tools.\n- Prefer catalog endpoints before creation endpoints, for example list workflow triggers/conditions/actions before creating a workflow.\n- Treat `202 Accepted` resources such as document uploads and reports as asynchronous. Poll the returned resource until the status reaches a terminal state.\n- Use cursor pagination by passing `nextCursor` from one response into the next request.\n- Do not call endpoints marked with `501 Not Implemented` in production plans.\n- Use placeholder values such as `tm_test_...`, `vault_id: 12345`, and `document_id: 67890` in examples. Never store or repeat real credentials from docs."
  },
  "servers": [
    {
      "url": "https://api.textmine.com",
      "description": "Production public API"
    }
  ],
  "security": [
    {
      "bearerApiKey": []
    }
  ],
  "externalDocs": {
    "description": "Agent instructions, client setup, and product context for TextMine API users.",
    "url": "https://developers.textmine.com/docs/for-agents"
  },
  "x-agent-entrypoints": {
    "mcpUrl": "https://developers.textmine.com/mcp",
    "llmsTxt": "https://developers.textmine.com/llms.txt",
    "agentInstructions": "https://developers.textmine.com/docs/for-agents",
    "agentContextPack": "https://developers.textmine.com/page/llms-full",
    "developerHome": "https://developers.textmine.com/page/developer-home",
    "docsHome": "https://docs.textmine.com"
  },
  "x-agent-safety-rules": [
    "Use the caller-owned bearer token. Do not ask users to paste API keys into prompts, source code, screenshots, or shared docs.",
    "Prefer discovery operations before mutation operations: listVaults, listIntegrationProviders, listDocumentTypes, listTags, listTeamUsers, and workflow catalogs.",
    "Do not invent IDs. Use IDs returned by earlier API calls, or ask the user to confirm the target resource.",
    "Treat direct uploads, provider imports, reprocessing, and reports as asynchronous. Poll the returned resource until a terminal status.",
    "Explain before destructive actions such as delete, disconnect provider, cancel alert, or soft-delete record/schema/report.",
    "Keep Vault and Legislate distinct. Vault is for active document processing and analysis; Legislate is the validated archive for documents published from Vault.",
    "Do not rely on routes documented as 501 Not Implemented for production workflows."
  ],
  "x-agent-task-playbooks": [
    {
      "name": "Import a provider file into Vault",
      "whenToUse": "The user wants a Google Drive, SharePoint, Notion, or other connected-provider file to become a Vault document.",
      "steps": [
        "listIntegrationProviders",
        "getIntegrationProviderStatus",
        "listIntegrationFolders",
        "listIntegrationFolderFiles",
        "listVaults",
        "importDocumentFromProvider",
        "getDocument"
      ],
      "confirmBefore": [
        "Importing many files",
        "Using a Vault name that has multiple matches"
      ]
    },
    {
      "name": "Upload local documents",
      "whenToUse": "The caller has file bytes and wants TextMine to process them in Vault.",
      "steps": [
        "listVaults",
        "listDocumentTypes",
        "createOrUploadDocument",
        "getDocument",
        "listDocumentMetadata",
        "listDocumentTags"
      ],
      "confirmBefore": [
        "Uploading ZIP files that may expand into many documents"
      ]
    },
    {
      "name": "Generate a repeatable report",
      "whenToUse": "The user needs a structured, repeatable answer across documents rather than a one-off chat summary.",
      "steps": [
        "listVaults",
        "listDocuments or searchDocuments",
        "generateReport",
        "getReport",
        "exportReportPdf or exportReportDocx"
      ],
      "terminalStatuses": [
        "COMPLETED",
        "FAILED"
      ]
    },
    {
      "name": "Create a workflow",
      "whenToUse": "The user wants a repeatable process triggered by document, email, schedule, intake, or manual events.",
      "steps": [
        "listTeamUsers",
        "listWorkflowTriggers",
        "listWorkflowConditions",
        "listWorkflowActions",
        "createWorkflow"
      ],
      "confirmBefore": [
        "Creating enabled workflows",
        "Sending emails",
        "Requesting approvals",
        "Publishing to Legislate"
      ]
    },
    {
      "name": "Validate extracted data and create records",
      "whenToUse": "Document evidence should become durable structured business data.",
      "steps": [
        "listDocumentMetadata",
        "getDocumentMetadataField",
        "updateDocumentMetadataField",
        "listRecordSchemas",
        "createBusinessRecord",
        "upsertBusinessRecordFieldValue"
      ],
      "evidenceGuidance": "Include document ID, page number, passage text, confidence, and validation state whenever available."
    }
  ],
  "tags": [
    {
      "name": "Documents",
      "description": "Upload, import, list, update, reprocess, delete, and publish documents."
    }
  ],
  "paths": {
    "/v3/documents/{documentId}": {
      "patch": {
        "tags": [
          "Documents"
        ],
        "summary": "Update document metadata",
        "description": "Renames a document, changes its document type, and optionally queues reprocessing.",
        "operationId": "updateDocument",
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Document ID."
          }
        ],
        "requestBody": {
          "required": false,
          "description": "Document fields to update.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDocumentRequest"
              },
              "examples": {
                "retypeAndReprocess": {
                  "summary": "Change type and reprocess",
                  "value": {
                    "name": "Acme supplier agreement - signed.pdf",
                    "document_type_id": 777,
                    "reprocess": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Check the response body for a machine-readable error code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "The authenticated user or API key cannot access this resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "The requested resource was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "x-agent-hints": [
          "For direct upload use multipart createOrUploadDocument; for connected provider files use importDocumentFromProvider.",
          "Treat upload, import, and reprocess responses as asynchronous and poll getDocument."
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tm_<key>",
        "description": "Use `Authorization: Bearer tm_<key>` for API-key access to `/v3/**` endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts."
      }
    },
    "schemas": {
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "INVALID_REQUEST"
              },
              "message": {
                "type": "string",
                "example": "vault_id is required"
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "DocumentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 67890
          },
          "name": {
            "type": "string",
            "example": "Acme supplier agreement.pdf"
          },
          "status": {
            "type": "string",
            "example": "processed",
            "description": "Public document status derived from the internal processing state."
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "example": 321
          },
          "vault_id": {
            "type": "integer",
            "format": "int64",
            "example": 12345
          },
          "document_type_id": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "example": 777
          },
          "mime_type": {
            "type": "string",
            "example": "application/pdf"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "example": 245760
          },
          "page_count": {
            "type": "integer",
            "example": 12
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time"
          },
          "processed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "UpdateDocumentRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Acme supplier agreement - signed.pdf"
          },
          "document_type_id": {
            "type": "integer",
            "format": "int64",
            "example": 777
          },
          "reprocess": {
            "type": "boolean",
            "description": "When true, queue the document for processing after updating metadata.",
            "example": true
          }
        }
      }
    }
  },
  "x-agent-workflows": [
    {
      "name": "Import a provider file into Vault and wait for processing",
      "steps": [
        "listIntegrationProviders",
        "listIntegrationFolders",
        "listIntegrationFolderFiles",
        "importDocumentFromProvider",
        "getDocument"
      ]
    },
    {
      "name": "Generate a contract-risk report",
      "steps": [
        "listVaults",
        "listDocuments",
        "generateReport",
        "getReport",
        "exportReportPdf"
      ]
    },
    {
      "name": "Create an automated review workflow",
      "steps": [
        "listTeamUsers",
        "listWorkflowTriggers",
        "listWorkflowConditions",
        "listWorkflowActions",
        "createWorkflow"
      ]
    },
    {
      "name": "Validate extracted metadata",
      "steps": [
        "listDocumentMetadata",
        "getDocumentMetadataField",
        "updateDocumentMetadataField"
      ]
    },
    {
      "name": "Publish and track validated Legislate data",
      "steps": [
        "listContractAlerts",
        "createContractAlert"
      ]
    }
  ]
}
```