PerslyPersly API

Authentication

Authenticate your API requests using API keys with Bearer tokens.

All API requests require authentication via an API key passed in the Authorization header.

API Key Format

API keys follow the format psl_{environment}_{32_hex_characters}:

PrefixEnvironmentUsage
psl_test_TestDevelopment and testing
psl_live_ProductionProduction applications
psl_test_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
└──────┘ └──────────────────────────────────┘
 prefix              32 hex characters

Both test and live keys access the same API endpoints with the same functionality.

Making Authenticated Requests

Include your API key as a Bearer token in the Authorization header:

curl https://api.persly.ai/v1/chat/completions \
  -H "Authorization: Bearer psl_test_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{"model": "persly-chat-v1", "messages": [{"role": "user", "content": "Hello"}]}'

Managing API Keys

Create and manage your API keys at platform.persly.ai:

  • Create multiple keys for different services or environments
  • Revoke compromised keys instantly
  • Track usage per key in the dashboard

Security Best Practices

Never expose your API key in client-side code, public repositories, or browser requests.

  • Use environment variables — Store keys in PERSLY_API_KEY environment variable
  • Server-side only — Make API calls from your backend, never from client-side JavaScript
  • Rotate regularly — Revoke and replace keys periodically
  • Scope access — Create separate keys for each service or environment
  • Monitor usage — Review key activity in the dashboard for anomalies
Using environment variables
export PERSLY_API_KEY="psl_test_a1b2c3d4e5f6..."

# Reference in your application
curl https://api.persly.ai/v1/chat/completions \
  -H "Authorization: Bearer $PERSLY_API_KEY" \
  ...

Error Responses

StatusCodeDescription
401authentication_errorMissing or invalid API key
403organization_suspendedYour organization has been suspended
401 Unauthorized
{
  "error": {
    "message": "Invalid API key.",
    "type": "authentication_error",
    "code": "authentication_error",
    "param": null
  }
}

On this page