Create an enabled workflow
Magic workflow endpoint. A single POST creates an enabled linear workflow graph: trigger, condition, then action. Use the catalog endpoints to choose valid kind values and params.
curl -X POST "https://api.textmine.com/v3/teams/123/workflows" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (`tm_<key>`)" \
-d '{
"name": "Review low-confidence governing law",
"description": "Assign legal review when governing-law extraction confidence is low.",
"trigger": {
"kind": "document_processed",
"params": {
"vault_id": 12345
}
},
"condition": {
"kind": "confidence",
"params": {
"tag": "Governing law",
"operator": "lt",
"threshold": 0.8
}
},
"action": {
"kind": "add_reviewer",
"params": {
"user_ids": [
42
]
}
}
}'
import requests
import json
url = "https://api.textmine.com/v3/teams/123/workflows"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (`tm_<key>`)"
}
data = {
"name": "Review low-confidence governing law",
"description": "Assign legal review when governing-law extraction confidence is low.",
"trigger": {
"kind": "document_processed",
"params": {
"vault_id": 12345
}
},
"condition": {
"kind": "confidence",
"params": {
"tag": "Governing law",
"operator": "lt",
"threshold": 0.8
}
},
"action": {
"kind": "add_reviewer",
"params": {
"user_ids": [
42
]
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.textmine.com/v3/teams/123/workflows", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (`tm_<key>`)"
},
body: JSON.stringify({
"name": "Review low-confidence governing law",
"description": "Assign legal review when governing-law extraction confidence is low.",
"trigger": {
"kind": "document_processed",
"params": {
"vault_id": 12345
}
},
"condition": {
"kind": "confidence",
"params": {
"tag": "Governing law",
"operator": "lt",
"threshold": 0.8
}
},
"action": {
"kind": "add_reviewer",
"params": {
"user_ids": [
42
]
}
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Review low-confidence governing law",
"description": "Assign legal review when governing-law extraction confidence is low.",
"trigger": {
"kind": "document_processed",
"params": {
"vault_id": 12345
}
},
"condition": {
"kind": "confidence",
"params": {
"tag": "Governing law",
"operator": "lt",
"threshold": 0.8
}
},
"action": {
"kind": "add_reviewer",
"params": {
"user_ids": [
42
]
}
}
}`)
req, err := http.NewRequest("POST", "https://api.textmine.com/v3/teams/123/workflows", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (`tm_<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://api.textmine.com/v3/teams/123/workflows')
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 (`tm_<key>`)'
request.body = '{
"name": "Review low-confidence governing law",
"description": "Assign legal review when governing-law extraction confidence is low.",
"trigger": {
"kind": "document_processed",
"params": {
"vault_id": 12345
}
},
"condition": {
"kind": "confidence",
"params": {
"tag": "Governing law",
"operator": "lt",
"threshold": 0.8
}
},
"action": {
"kind": "add_reviewer",
"params": {
"user_ids": [
42
]
}
}
}'
response = http.request(request)
puts response.body
{
"id": 555,
"team_id": 321,
"name": "Review low-confidence governing law",
"trigger_type": "document_processed",
"status": "active",
"step_count": 3,
"created_at": "2024-12-25T10:00:00Z",
"created_by_id": 123
}
{
"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": "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/teams/{teamId}/workflowsTarget server for requests. Edit to use your own host.
Use Authorization: Bearer tm_<key> for API-key access to /v3/** endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts.
Authorization: Bearer tm_<key> for API-key access to /v3/** endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts.Team ID.
The media type of the request body
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token (tm_<key>). Use Authorization: Bearer tm_<key> for API-key access to /v3/** endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts.
Path Parameters
Team ID.
Body
Review low-confidence governing lawAssign legal review when governing-law extraction confidence is low.