replr
Authentication
Log inGet Started

Documentation

OverviewQuick StartAuthentication
AuthCharactersConversationsVoiceMarketplaceStudioIntegrationsRoomsSocialKnowledgeImagesBillingWebSocket
WebhooksEmbeddingRate LimitsErrors

Authentication

The REPLR API supports three authentication methods. Choose the one that fits your use-case: Bearer tokens for user sessions, API keys for server-to-server calls, and OAuth 2.0 for third-party integrations.

Base URL
https://api.replr.ai/v1

Bearer Token

Short-lived JWTs for user sessions. Obtained via login.

API Key

Long-lived keys with scoped permissions for backends.

OAuth 2.0

Authorization code flow for third-party apps.

Bearer Token (JWT)

Authenticate as a user by exchanging credentials for a short-lived JWT. Access tokens expire after 1 hour. Use the refresh token to obtain a new access token without re-entering credentials.

1. Obtain a token

POST/v1/auth/login

Exchange email and password for an access token and refresh token.

Request Body

NameTypeRequiredDescription
emailstringRequiredAccount email address.
passwordstringRequiredAccount password.

Response

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "rt_a1b2c3d4e5f6..."
}

Examples

curl -X POST https://api.replr.ai/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "password": "your-password"
  }'

2. Use the token

Pass the access token in the Authorization header on every request.

curl https://api.replr.ai/v1/replrs \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."

3. Refresh the token

When the access token expires (HTTP 401), exchange the refresh token for a new pair. Refresh tokens are single-use and rotate on every call.

POST/v1/auth/refresh

Exchange a refresh token for a new access token and refresh token.

Request Body

NameTypeRequiredDescription
refresh_tokenstringRequiredThe refresh token returned from login or a previous refresh.

Response

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "rt_x9y8z7w6v5u4..."
}

Examples

curl -X POST https://api.replr.ai/v1/auth/refresh \
  -H "Content-Type: application/json" \
  -d '{ "refresh_token": "rt_a1b2c3d4e5f6..." }'

API Keys

API keys are long-lived credentials designed for server-to-server communication. Each key is scoped to a specific set of permissions and tied to your account. You can create keys from the settings or programmatically via the API.

Scopes

ScopePermissions
readList and retrieve characters, conversations, messages, and account info.
chatSend messages, create conversations, and interact with characters.
adminCreate and delete characters, manage API keys, configure webhooks, and access billing.

Create a key

POST/v1/api-keysAuth Required

Create a new API key with the specified scopes.

Request Body

NameTypeRequiredDescription
namestringRequiredA human-readable label for this key.
scopesstring[]RequiredPermissions granted to the key. One or more of "read", "chat", "admin".
expires_in_daysnumberOptionalDays until expiry. Omit for a non-expiring key.

Response

{
  "id": "key_9f3a1b2c4d5e",
  "name": "Production backend",
  "key": "rk_live_abc123def456ghi789...",
  "scopes": ["read", "chat"],
  "created_at": "2026-03-09T12:00:00Z",
  "expires_at": null
}

Examples

curl -X POST https://api.replr.ai/v1/api-keys \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production backend",
    "scopes": ["read", "chat"]
  }'

Use an API key

Pass the key in the X-API-Key header.

curl https://api.replr.ai/v1/replrs \
  -H "X-API-Key: rk_live_abc123def456ghi789..."

OAuth 2.0

Use the authorization code flow to let users grant your application access to their REPLR account without sharing credentials. This is the recommended approach for third-party integrations and marketplace apps.

1. Redirect the user to authorize

Send the user to the REPLR authorization page. After they approve, they will be redirected back to your redirect_uri with a code parameter.

Authorization URL
https://api.replr.ai/v1/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=https://yourapp.com/callback&scope=read%20chat&state=random_csrf_token

Query Parameters

NameTypeRequiredDescription
response_typestringRequiredMust be "code".
client_idstringRequiredYour application client ID.
redirect_uristringRequiredURI to redirect the user back to after authorization.
scopestringRequiredSpace-separated scopes, e.g. "read chat".
statestringRequiredAn opaque CSRF-prevention value your app generates.

2. Exchange code for tokens

Once the user is redirected back with a code, exchange it for an access token on your backend. The authorization code is single-use and expires after 10 minutes.

POST/v1/oauth/token

Exchange an authorization code for access and refresh tokens.

Request Body

NameTypeRequiredDescription
grant_typestringRequiredMust be "authorization_code".
codestringRequiredThe authorization code from the redirect.
redirect_uristringRequiredMust match the URI used in the authorize request.
client_idstringRequiredYour application client ID.
client_secretstringRequiredYour application client secret.

Response

{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "rt_oauth_m4n5o6p7...",
  "scope": "read chat"
}

Examples

curl -X POST https://api.replr.ai/v1/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "authorization_code",
    "code": "ac_xyz789...",
    "redirect_uri": "https://yourapp.com/callback",
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET"
  }'

3. Refresh an OAuth token

OAuth access tokens expire after 1 hour. Use the refresh token exactly as described in the Bearer Token section above. Include your client_id and client_secret in the refresh request body for OAuth tokens.

Error Responses

Authentication failures return standard JSON error objects. The two status codes you will encounter are:

StatusErrorMeaning
401unauthorizedMissing, malformed, or expired credentials. Re-authenticate or refresh the token.
403forbiddenValid credentials but insufficient permissions. Check that your API key includes the required scope.
// 401 Unauthorized — missing or invalid credentials
{
  "error": "unauthorized",
  "message": "Invalid or expired access token."
}

// 403 Forbidden — valid credentials, insufficient permissions
{
  "error": "forbidden",
  "message": "This API key does not have the \"admin\" scope required for this action."
}

Security Best Practices

Treat all tokens and API keys as secrets. A leaked credential gives full access to the associated scopes until revoked.

  • •Store tokens server-side. Never expose access tokens, refresh tokens, or API keys in client-side code, URLs, or version control.
  • •Rotate API keys regularly. Create a new key, migrate your services, then revoke the old one. Use the expires_in_days parameter to enforce automatic expiry.
  • •Use minimal scopes. Only request the scopes your application actually needs. A read-only dashboard should not have the admin scope.
  • •Validate the state parameter in OAuth. Always verify the state value returned from the authorization redirect matches the one you generated to prevent CSRF attacks.
  • •Handle token refresh proactively. Refresh access tokens before they expire rather than waiting for a 401 response to avoid interruptions in your application flow.
  • •Use HTTPS exclusively. All REPLR API endpoints require TLS. Never send credentials over unencrypted connections.
← Quick StartAPI Reference →
replr
replr

Your AI, everywhere.

Product

  • Features
  • Explore
  • Discover
  • Pricing
  • API Docs

Safety

  • Safety Center
  • Community Guidelines
  • Content Moderation
  • Parental Insights
  • Reporting

Company

  • Company
  • Help Center
  • Contact
  • Legal
  • Privacy

Connect

  • Twitter
  • Discord
  • GitHub

© 2026 REPLR, Inc. All rights reserved.

PrivacyTerms