Authentication

All API requests require an API key passed in the x-api-key header.

Getting Your API Key

  1. Go to your Profile > API Keys
  2. Click "Create New Key"
  3. Copy the key (shown only once)
  4. Store it securely — never expose it in client-side code

Making Requests

cURL
curl -X POST https://www.turingmate.com/api/v1/chat \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"characterId": "abc123", "message": "Hello!"}'
JavaScript (fetch)
const response = await fetch("https://www.turingmate.com/api/v1/chat", {
  method: "POST",
  headers: {
    "x-api-key": "your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    characterId: "abc123",
    message: "Hello!",
  }),
});

const data = await response.json();
console.log(data.message.content);
Python (requests)
import requests

response = requests.post(
    "https://www.turingmate.com/api/v1/chat",
    headers={
        "x-api-key": "your_api_key",
        "Content-Type": "application/json",
    },
    json={
        "characterId": "abc123",
        "message": "Hello!",
    },
)

data = response.json()
print(data["message"]["content"])

Access Modes

Each API key has an access mode that controls which characters it can access:

ModeDescription
own_onlyOnly characters you created (default)
own_and_presetsYour characters + official preset characters
allAll accessible characters (same as web UI)

Error Responses

Invalid or missing API keys return a 401 status:

401 Unauthorized
{
  "error": "Unauthorized"
}