Getting started

Authentication

TurnstileAI uses API keys to authenticate requests.

Key types

PrefixUse
ts_live_Production traffic
ts_test_Development and testing
ts_agent_Restricted agent access

Example

import { TurnstileAI } from "@turnstileai/sdk";

const client = new TurnstileAI({
  apiKey: process.env.TURNSTILE_API_KEY!
});

Environment variable

export TURNSTILE_API_KEY=ts_live_xxx

Good practice

  • Keep keys in environment variables.
  • Do not commit keys to source control.
  • Use test keys in development.
  • Rotate keys when needed.
  • Use restricted keys for agents and automations.