For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dashboard
User GuideDeveloper GuidesAPI Reference
User GuideDeveloper GuidesAPI Reference
    • Overview
  • Runtype API
      • GETList client tokens
      • POSTCreate client token
      • GETGet client token
      • PUTUpdate client token
      • DELDelete client token
      • GETList conversations for client token
      • POSTRegenerate client token
      • GETGet client token value
Dashboard
LogoLogo
Runtype APIClient Tokens

Create client token

POST
/v1/client-tokens
POST
/v1/client-tokens
$curl -X POST https://api.runtype.com/v1/client-tokens \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "allowedOrigins": [
> "https://example.com",
> "http://localhost:3000"
> ],
> "name": "My Chat Widget",
> "config": {
> "placeholder": "Type your message...",
> "theme": {
> "mode": "light",
> "primaryColor": "#007bff"
> },
> "welcomeMessage": "Hello! How can I help you today?"
> },
> "defaultFlowId": "flow_01jv0000000000000000000001",
> "environment": "live",
> "flowIds": [
> "flow_01jv0000000000000000000001"
> ],
> "maxMessagesPerSession": 100,
> "rateLimitPerHour": 100,
> "rateLimitPerMinute": 10,
> "sessionIdleTimeoutMinutes": 30
>}'
1{
2 "clientToken": {
3 "agentIds": [
4 "string"
5 ],
6 "allowedOrigins": [
7 "string"
8 ],
9 "config": {},
10 "createdAt": "string",
11 "defaultFlowId": "string",
12 "environment": "test",
13 "flowIds": [
14 "string"
15 ],
16 "id": "string",
17 "isActive": true,
18 "lastUsedAt": "string",
19 "maxMessagesPerSession": 1,
20 "name": "string",
21 "pinToVersion": "string",
22 "rateLimitPerHour": 1,
23 "rateLimitPerMinute": 1,
24 "sessionIdleTimeoutMinutes": 1,
25 "tokenHint": "string",
26 "tokenPrefix": "string",
27 "tokenValue": "string",
28 "updatedAt": "string",
29 "conversationCount": 1
30 },
31 "token": "string",
32 "warnings": [
33 {
34 "message": "string",
35 "type": "string"
36 }
37 ]
38}

Create a new client token for browser-to-API communication. Returns the plain token value once.

Was this page helpful?
Previous

Get client token

Next
Built with

Authentication

AuthorizationBearer
API key or Clerk session token

Request

This endpoint expects an object.
allowedOriginslist of stringsRequired
namestringRequired1-255 characters
agentIdslist of stringsOptionalDefaults to []
configmap from strings to anyOptionalDefaults to {}
defaultFlowIdstringOptional
environmentenumOptionalDefaults to live
Allowed values:
flowIdslist of stringsOptionalDefaults to []
maxMessagesPerSessiondoubleOptional1-1000Defaults to 100
pinToVersionstringOptionalDefaults to latest
productSurfaceIdstringOptional
rateLimitPerHourdoubleOptional1-10000Defaults to 100
rateLimitPerMinutedoubleOptional1-1000Defaults to 10
sessionIdleTimeoutMinutesdoubleOptional1-1440Defaults to 30

Response

Created client token
clientTokenobject
tokenstring
warningslist of objects

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error