Skip to content
TurnitPass
DevelopersAPI v1Get an API key
Browse documentation

DevelopersAuthentication

Authenticate with Bearer API keys

Send your API key as a Bearer token in the Authorization header of every request.

Request header

Authorization
Bearer
Authorization: Bearer tp_live_your_api_key
Content-Type: application/json
Request
fetch
await fetch('https://turnitpass.com/api/v1/humanize', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.TURNITPASS_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ text: draft, language: 'en' })
});

Managing keys

Create

Name a key in the workspace. Up to 5 active keys per account.

Revoke

A revoked key stops working immediately. Other keys keep working.

Environment setup

.env
server
TURNITPASS_API_KEY=tp_live_your_api_key
TURNITPASS_API_BASE_URL=https://turnitpass.com/api/v1
Local development
.env.local or a local secret managerUse a separate key with a clear name.
Preview deploys
Staging keyKeep test traffic off the production key.
Production
Backend-only secretRead the key only in server code.

Security best practices

Server-side only
Never expose keys in browser codeUse keys from backend services, jobs, or server routes.
Environment variables
Use TURNITPASS_API_KEYKeep live keys out of source control.
Rotate keys
Create a replacement before revokingDeploy the new key, then revoke the old one.
Leaked key
Revoke immediatelyThen create a new key in the workspace.

Authentication errors

missing_api_key
No Authorization header was sent.
invalid_api_key
The header is malformed, or the key is unknown or revoked.
Response
401
{
  "error": "invalid_api_key",
  "code": "invalid_api_key",
  "message": "Invalid or revoked API key."
}

Next steps