Create a business record schema
Creates a schema that defines structured record types, fields, and relationships for a team or Vault.
curl -X POST "https://api.textmine.com/v3/record-schemas" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (`tm_<key>`)" \
-d '{
"teamId": 321,
"vaultId": 12345,
"name": "Supplier master data",
"description": "Structured supplier facts extracted from contracts.",
"scopeType": "VAULT",
"scopeId": "12345",
"schema": {
"recordTypes": [
{
"recordTypeKey": "supplier",
"label": "Supplier",
"fields": [
{
"fieldKey": "jurisdiction",
"label": "Jurisdiction",
"fieldType": "text",
"evidenceRequired": true
},
{
"fieldKey": "renewal_type",
"label": "Renewal type",
"fieldType": "text",
"evidenceRequired": true
}
]
}
],
"relationshipTypes": []
}
}'
import requests
import json
url = "https://api.textmine.com/v3/record-schemas"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (`tm_<key>`)"
}
data = {
"teamId": 321,
"vaultId": 12345,
"name": "Supplier master data",
"description": "Structured supplier facts extracted from contracts.",
"scopeType": "VAULT",
"scopeId": "12345",
"schema": {
"recordTypes": [
{
"recordTypeKey": "supplier",
"label": "Supplier",
"fields": [
{
"fieldKey": "jurisdiction",
"label": "Jurisdiction",
"fieldType": "text",
"evidenceRequired": true
},
{
"fieldKey": "renewal_type",
"label": "Renewal type",
"fieldType": "text",
"evidenceRequired": true
}
]
}
],
"relationshipTypes": []
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.textmine.com/v3/record-schemas", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (`tm_<key>`)"
},
body: JSON.stringify({
"teamId": 321,
"vaultId": 12345,
"name": "Supplier master data",
"description": "Structured supplier facts extracted from contracts.",
"scopeType": "VAULT",
"scopeId": "12345",
"schema": {
"recordTypes": [
{
"recordTypeKey": "supplier",
"label": "Supplier",
"fields": [
{
"fieldKey": "jurisdiction",
"label": "Jurisdiction",
"fieldType": "text",
"evidenceRequired": true
},
{
"fieldKey": "renewal_type",
"label": "Renewal type",
"fieldType": "text",
"evidenceRequired": true
}
]
}
],
"relationshipTypes": []
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"teamId": 321,
"vaultId": 12345,
"name": "Supplier master data",
"description": "Structured supplier facts extracted from contracts.",
"scopeType": "VAULT",
"scopeId": "12345",
"schema": {
"recordTypes": [
{
"recordTypeKey": "supplier",
"label": "Supplier",
"fields": [
{
"fieldKey": "jurisdiction",
"label": "Jurisdiction",
"fieldType": "text",
"evidenceRequired": true
},
{
"fieldKey": "renewal_type",
"label": "Renewal type",
"fieldType": "text",
"evidenceRequired": true
}
]
}
],
"relationshipTypes": []
}
}`)
req, err := http.NewRequest("POST", "https://api.textmine.com/v3/record-schemas", 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/record-schemas')
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 = '{
"teamId": 321,
"vaultId": 12345,
"name": "Supplier master data",
"description": "Structured supplier facts extracted from contracts.",
"scopeType": "VAULT",
"scopeId": "12345",
"schema": {
"recordTypes": [
{
"recordTypeKey": "supplier",
"label": "Supplier",
"fields": [
{
"fieldKey": "jurisdiction",
"label": "Jurisdiction",
"fieldType": "text",
"evidenceRequired": true
},
{
"fieldKey": "renewal_type",
"label": "Renewal type",
"fieldType": "text",
"evidenceRequired": true
}
]
}
],
"relationshipTypes": []
}
}'
response = http.request(request)
puts response.body
{
"id": 3001,
"teamId": 123,
"vaultId": 123,
"name": "John Doe",
"description": "example_string",
"status": "active",
"scopeType": "example_string",
"scopeId": "example_string",
"activeVersionId": 123,
"created": "2024-12-25T10:00:00Z",
"updated": "2024-12-25T10:00:00Z",
"versions": [
{
"id": 4001,
"schemaId": 3001,
"versionNumber": 1,
"status": "active",
"recordTypes": [
{
"id": 5001,
"recordTypeKey": "supplier",
"label": "Supplier"
}
],
"relationshipTypes": []
}
]
}
{
"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
}
POST
/v3/record-schemas
POST
Base URLstring
Target server for requests. Edit to use your own host.
Bearer Token (`tm_<key>`)
Bearer Tokenstring
RequiredUse Authorization: Bearer tm_<key> for API-key access to /v3/** endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts.
Use
Authorization: Bearer tm_<key> for API-key access to /v3/** endpoints. V3 also accepts Auth0 JWT and HTTP Basic for user-session contexts.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 (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.
Body
application/json
teamIdinteger
RequiredExample:
321vaultIdinteger
Example:
12345namestring
RequiredExample:
Supplier master datadescriptionstring
Example:
Structured supplier facts extracted from contracts.scopeTypestring
Example:
VAULTscopeIdstring
Example:
12345suggestionSourcestring
Example:
promptsuggestionPromptstring
Example:
Track supplier name, jurisdiction, renewal type, and termination notice.Responses
Was this page helpful?