Upload a document
Uploads a file as multipart form data. vault_id is optional: omit it to reuse the first accessible vault or create the default Agent Vault workspace for the API-key organization. For typed…
curl -X POST "https://public-api.textmine.com/v3/documents?name=John%20Doe&team_id=123&vault_id=123&document_type_id=123&extract=example_string" \
-H "Authorization: Bearer YOUR_API_TOKEN (TextMine tm_ API key)" \
--form file=example_string
import requests
import json
url = "https://public-api.textmine.com/v3/documents?name=John%20Doe&team_id=123&vault_id=123&document_type_id=123&extract=example_string"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN (TextMine tm_ API key)"
}
data = {
"file": "example_string"
}
response = requests.post(url, headers=headers, data=data)
print(response.json())
const formData = new FormData();
formData.append("file", "example_string");
const response = await fetch("https://public-api.textmine.com/v3/documents?name=John%20Doe&team_id=123&vault_id=123&document_type_id=123&extract=example_string", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN (TextMine tm_ API key)"
},
body: formData
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"mime/multipart"
)
func main() {
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
writer.WriteField("file", "example_string")
writer.Close()
req, err := http.NewRequest("POST", "https://public-api.textmine.com/v3/documents?name=John%20Doe&team_id=123&vault_id=123&document_type_id=123&extract=example_string", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (TextMine tm_ API key)")
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://public-api.textmine.com/v3/documents?name=John%20Doe&team_id=123&vault_id=123&document_type_id=123&extract=example_string')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_TOKEN (TextMine tm_ API key)'
request.set_form([
["file", "example_string"]
], 'multipart/form-data')
response = http.request(request)
puts response.body
[
{
"id": 123,
"name": "John Doe",
"status": "example_string",
"team_id": 123,
"vault_id": 123,
"document_type_id": 123,
"mime_type": "example_string",
"size_bytes": 42,
"page_count": 25,
"uploaded_at": "2024-12-25T10:00:00Z",
"processed_at": "2024-12-25T10:00:00Z"
}
]
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Error",
"message": "Payment required for billable agent usage",
"code": 402
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
/v3/documents
Target server for requests. Edit to use your own host.
Bearer token (TextMine tm_ API key) - just enter the token, "Bearer" prefix will be added automatically
Optional. Omit to reuse the first accessible vault or create the default Agent Vault workspace for the API-key organization.
The media type of the request body
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token (TextMine tm_ API key). Authentication token required.
Query Parameters
Optional. Omit to reuse the first accessible vault or create the default Agent Vault workspace for the API-key organization.
Body
Responses
Uploads a file as multipart form data. vault_id is optional: omit it to reuse the first accessible vault or create the default Agent Vault workspace for the API-key organization. For typed processing, pass document_type_id. ZIP files may expand into multiple created documents.