Skip to main content

Developer docs

REST API

Use an account API key to read your account data and chat with your own API-enabled Charigents.

Last verified:

Authentication

Use an account key (chgk_…) for account reads and the account chat route. Use the matching Character key (char_…) for /api/v1/characters/{id}/chat, or the matching Charigent key (rag_…) for /api/v1/charigents/{id}/chat. Send each key as a Bearer token; the header alternatives are listed on each operation. Keep keys on your server. Read routes reject requests with an Origin header.

Authenticated request
curl --request GET \
  --url "https://app.charigent.com/api/v1/me" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY"

Account boundary

Every account-key call is scoped to the account that created the key. Each entity chat key resolves one Character or Charigent, and its ID in the URL must match that key. A key cannot reach another account’s entity.

Customer API endpoints

The list includes account-key reads and chat routes for an individual Character or Charigent. Entity chat requires a message, an opaque visitorId, and an Idempotency-Key header. Request and response fields come from the schemas used by the route handlers.

GET /api/v1/me

Read the profile and plan for the account that owns the key.

Account key: Authorization: Bearer chgk_… or X-API-Key.

Response fields: id, email, displayName, company, plan

Code sample
curl --request GET \
  --url "https://app.charigent.com/api/v1/me" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY"

GET /api/v1/models

Read the quality levels and whether each is available to the account.

Account key: Authorization: Bearer chgk_… or X-API-Key.

Response fields: qualityLevels

Code sample
curl --request GET \
  --url "https://app.charigent.com/api/v1/models" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY"

GET /api/v1/charigents

List the account’s Charigents and whether each API channel is on.

Account key: Authorization: Bearer chgk_… or X-API-Key.

Response fields: charigents

Code sample
curl --request GET \
  --url "https://app.charigent.com/api/v1/charigents" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY"

GET /api/v1/usage

Read the account’s current plan, balance, and credit breakdown.

Account key: Authorization: Bearer chgk_… or X-API-Key.

Response fields: plan, currency, balance, planCredits, purchasedCredits

Code sample
curl --request GET \
  --url "https://app.charigent.com/api/v1/usage" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY"

POST /api/rag-agent/chat/{charigentId}

Send a message to a Charigent owned by the account. Its API channel must be on.

Account key: Authorization: Bearer chgk_… or X-API-Key.

Request fields: message

Code sample
curl --request POST \
  --url "https://app.charigent.com/api/rag-agent/chat/ENTITY_ID" \
  --header "Authorization: Bearer $CHARIGENT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"message":"Hello"}'

POST /api/v1/characters/{id}/chat

Chat with the Character whose server key matches the ID in the URL.

Character key: Authorization: Bearer char_… or X-Character-API-Key.

Request fields: message, visitorId

Response fields: message, chatId, messageId, usage, crisisResponse

Code sample
curl --request POST \
  --url "https://app.charigent.com/api/v1/characters/ENTITY_ID/chat" \
  --header "Authorization: Bearer $CHARACTER_API_KEY" \
  --header "Idempotency-Key: request-00000001" \
  --header "Content-Type: application/json" \
  --data '{"message":"Hello","visitorId":"customer-session-1"}'

POST /api/v1/charigents/{id}/chat

Chat with the Charigent whose server key matches the ID in the URL.

Charigent key: Authorization: Bearer rag_…, X-API-Key, or X-Charigent-API-Key.

Request fields: message, visitorId

Response fields: message, usage, crisisResponse

Code sample
curl --request POST \
  --url "https://app.charigent.com/api/v1/charigents/ENTITY_ID/chat" \
  --header "Authorization: Bearer $CHARIGENT_ENTITY_API_KEY" \
  --header "Idempotency-Key: request-00000001" \
  --header "Content-Type: application/json" \
  --data '{"message":"Hello","visitorId":"customer-session-1"}'

Errors

Account-key authentication errors return JSON with error and code fields. Chat errors also return an error field and may include code or retry_after. A 429 response includes Retry-After when the caller should wait.

Authentication error shape
{
  "error": "This API key is not valid.",
  "code": "INVALID_API_KEY"
}

Rate limits

  • Each account key is limited to 120 requests per minute.
  • Before key verification, requests from one network address are limited to 60 attempts per minute.
  • Before an entity key is checked, requests from one network address are limited to 60 attempts per 60 seconds.
  • Account-key chat also uses a per-visitor limit configured for the Charigent, with a default of 10 and a maximum of 60 requests per minute. Its shared agent ceiling scales at 12 times that limit and is clamped from 120 to 600 requests per minute.
  • Entity-key chat allows 10 requests per sender and 30 requests per entity in each 60 second window.

Account-key chat checks an additional limit before API-key verification. Its effective threshold can vary, so use Retry-After when present. Its per-visitor and shared Charigent limits include X-RateLimit-Scope. Entity-key chat returns Retry-After when a limit is reached.

Versioning

Account reads and entity chat routes are under /api/v1. Account-key chat also uses /api/rag-agent/chat/{charigentId}. Keep endpoint paths in your integration configuration.

Review plans and API access