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

# Import a provider file into Vault

Imports a file from a connected outbound provider into a TextMine Vault. The server uses the user stored OAuth token, fetches the file, and feeds it into the same magic upload pipeline as direct uploads.

# 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."
    },
    {
      "name": "Integrations",
      "description": "Provider discovery, OAuth connection status, provider browsing, and server-side import."
    }
  ],
  "paths": {
    "/v3/documents/from-provider": {
      "post": {
        "tags": [
          "Documents",
          "Integrations"
        ],
        "summary": "Import a provider file into Vault",
        "description": "Imports a file from a connected outbound provider into a TextMine Vault. The server uses the user stored OAuth token, fetches the file, and feeds it into the same magic upload pipeline as direct uploads.",
        "operationId": "importDocumentFromProvider",
        "requestBody": {
          "required": true,
          "description": "Provider file reference and target Vault.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadFromProviderRequest"
              },
              "examples": {
                "drive": {
                  "summary": "Import from Google Drive",
                  "value": {
                    "provider_id": "google-drive",
                    "external_file_id": "drive-file-abc123",
                    "name": "Acme supplier agreement.pdf",
                    "team_id": 321,
                    "vault_id": 12345,
                    "document_type_id": 777,
                    "extract": "Extract parties, term, renewal, termination, and governing law."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Import accepted. The response contains created Vault document records.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$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.",
          "Check provider connection status before browsing folders or importing files.",
          "Never invent provider file IDs; use IDs returned by folder/file listing endpoints.",
          "Use listIntegrationFolders and listIntegrationFolderFiles to discover `external_file_id` values.",
          "Poll getDocument after import to watch processing status."
        ],
        "x-agent-profile": {
          "type": "mutation",
          "async": true,
          "prerequisites": [
            "listIntegrationProviders",
            "getIntegrationProviderStatus",
            "listIntegrationFolders",
            "listIntegrationFolderFiles",
            "listVaults"
          ],
          "next": [
            "getDocument",
            "listDocumentMetadata",
            "generateReport"
          ],
          "confirmBefore": [
            "Importing provider files into a Vault"
          ]
        }
      }
    }
  },
  "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
          }
        }
      },
      "UploadFromProviderRequest": {
        "type": "object",
        "properties": {
          "provider_id": {
            "$ref": "#/components/schemas/IntegrationProviderId"
          },
          "external_file_id": {
            "type": "string",
            "description": "Provider-native file ID returned by the browse endpoints.",
            "example": "drive-file-abc123"
          },
          "name": {
            "type": "string",
            "example": "Acme supplier agreement.pdf"
          },
          "team_id": {
            "type": "integer",
            "format": "int64",
            "example": 321
          },
          "vault_id": {
            "type": "integer",
            "format": "int64",
            "example": 12345
          },
          "document_type_id": {
            "type": "integer",
            "format": "int64",
            "example": 777
          },
          "extract": {
            "type": "string",
            "example": "Extract parties, term, renewal, termination, and governing law."
          }
        },
        "required": [
          "provider_id",
          "external_file_id",
          "vault_id"
        ]
      },
      "IntegrationProviderId": {
        "type": "string",
        "enum": [
          "notion",
          "google-drive",
          "sharepoint"
        ],
        "description": "Canonical provider ID used in paths, JSON bodies, and MCP tool parameters."
      }
    }
  },
  "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"
      ]
    }
  ]
}
```