Create a document type
Creates a custom document type and optionally seeds default extraction questions for one or more Vaults.
curl -X POST "https://public-api.textmine.com/v3/document-types" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (TextMine tm_ API key)" \
-d '{
"name": "Commercial Agreement",
"code": "example_string",
"description": "example_string",
"contractTypeGroupId": 123,
"vaultId": 123,
"vaultIds": [
123
],
"alternativeNames": [
"John Doe"
],
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"defaultTags": [
{
"name": "Summary",
"question": "Summarize this document in one sentence.",
"aggregation": true,
"reasoning": true,
"semantic": true
}
]
}'
import requests
import json
url = "https://public-api.textmine.com/v3/document-types"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (TextMine tm_ API key)"
}
data = {
"name": "Commercial Agreement",
"code": "example_string",
"description": "example_string",
"contractTypeGroupId": 123,
"vaultId": 123,
"vaultIds": [
123
],
"alternativeNames": [
"John Doe"
],
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"defaultTags": [
{
"name": "Summary",
"question": "Summarize this document in one sentence.",
"aggregation": true,
"reasoning": true,
"semantic": true
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://public-api.textmine.com/v3/document-types", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (TextMine tm_ API key)"
},
body: JSON.stringify({
"name": "Commercial Agreement",
"code": "example_string",
"description": "example_string",
"contractTypeGroupId": 123,
"vaultId": 123,
"vaultIds": [
123
],
"alternativeNames": [
"John Doe"
],
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"defaultTags": [
{
"name": "Summary",
"question": "Summarize this document in one sentence.",
"aggregation": true,
"reasoning": true,
"semantic": true
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Commercial Agreement",
"code": "example_string",
"description": "example_string",
"contractTypeGroupId": 123,
"vaultId": 123,
"vaultIds": [
123
],
"alternativeNames": [
"John Doe"
],
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"defaultTags": [
{
"name": "Summary",
"question": "Summarize this document in one sentence.",
"aggregation": true,
"reasoning": true,
"semantic": true
}
]
}`)
req, err := http.NewRequest("POST", "https://public-api.textmine.com/v3/document-types", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (TextMine tm_ API key)")
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/document-types')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN (TextMine tm_ API key)'
request.body = '{
"name": "Commercial Agreement",
"code": "example_string",
"description": "example_string",
"contractTypeGroupId": 123,
"vaultId": 123,
"vaultIds": [
123
],
"alternativeNames": [
"John Doe"
],
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"defaultTags": [
{
"name": "Summary",
"question": "Summarize this document in one sentence.",
"aggregation": true,
"reasoning": true,
"semantic": true
}
]
}'
response = http.request(request)
puts response.body
{
"id": 123,
"name": "John Doe",
"code": "example_string",
"description": "example_string",
"vaultId": 123,
"vaultIds": [
123
],
"documentTypeOrganizationVaultId": 123,
"tableExtractionEnabled": true,
"embeddedImageClassificationEnabled": true,
"alternativeNames": [
"John Doe"
],
"defaultTagCount": 10
}
{
"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
}
POST
/v3/document-types
POST
Base URLstring
Target server for requests. Edit to use your own host.
Bearer Token (TextMine tm_ API key)
Bearer Tokenstring
RequiredBearer token (TextMine tm_ API key) - just enter the token, "Bearer" prefix will be added automatically
Content-Typestring
RequiredThe media type of the request body
Options: application/json
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token (TextMine tm_ API key). Authentication token required.
Body
application/json
namestring
RequiredExample:
Commercial AgreementResponses
Was this page helpful?