Create an API key for the authenticated user
Issues a TextMine API key for the authenticated user. The raw tm_... key is returned only once in this response; store it securely and never paste it into docs, code, or chat logs.
curl -X POST "https://api.textmine.com/v3/api-keys" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (JWT)" \
-d '{
"name": "Docs maintenance",
"organizationId": 654,
"environment": "production"
}'
import requests
import json
url = "https://api.textmine.com/v3/api-keys"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (JWT)"
}
data = {
"name": "Docs maintenance",
"organizationId": 654,
"environment": "production"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.textmine.com/v3/api-keys", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (JWT)"
},
body: JSON.stringify({
"name": "Docs maintenance",
"organizationId": 654,
"environment": "production"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Docs maintenance",
"organizationId": 654,
"environment": "production"
}`)
req, err := http.NewRequest("POST", "https://api.textmine.com/v3/api-keys", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (JWT)")
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/api-keys')
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 (JWT)'
request.body = '{
"name": "Docs maintenance",
"organizationId": 654,
"environment": "production"
}'
response = http.request(request)
puts response.body
{
"id": 123,
"name": "John Doe",
"key": "tm_test_xxxxxxxxxxxxxxxxxxxxx",
"keyPrefix": "tm_test",
"createdAt": "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": "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/api-keys
Target server for requests. Edit to use your own host.
Auth0 user-session JWT used by the TextMine web app, for endpoints such as API-key creation.
The media type of the request body
Organization the API key should act in.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token (JWT). Auth0 user-session JWT used by the TextMine web app, for endpoints such as API-key creation.
Body
Codex documentation maintenanceOrganization the API key should act in.
production