createAgentToken
# createAgentToken
POST
/agent/tokens
const url = 'http://localhost:8080/api/v1/agent/tokens';const options = { method: 'POST', headers: {cookie: 'hs_session=<hs_session>', 'Content-Type': 'application/json'}, body: '{"name":"example","agentKind":"hermes","preset":"fetcher","scopes":["people:read"],"platforms":["instagram"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/agent/tokens \ --header 'Content-Type: application/json' \ --cookie hs_session=<hs_session> \ --data '{ "name": "example", "agentKind": "hermes", "preset": "fetcher", "scopes": [ "people:read" ], "platforms": [ "instagram" ] }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
agentKind
required
string
preset
string
scopes
Overrides preset when set.
Array<string>
platforms
Array<string>
Responses
Section titled “Responses”Token created. token and setup are returned once.
Media typeapplication/json
object
id
required
string
name
required
string
agentKind
required
string
scopes
required
Array<string>
platforms
Array<string> | null
tokenPrefix
required
string
token
Only on create.
string
setup
Copy-paste setup for the Agents screen. Returned once, with the token inlined.
object
restBaseUrl
required
string format: uri
mcpUrl
required
string format: uri
hermesConfigYaml
required
string
openclawConfigJson5
required
string
openclawCli
string
envBlock
required
HOMESTEAD_URL=… and HOMESTEAD_TOKEN=… lines.
string
skillInstall
object
hermes
string
openclaw
string
createdAt
required
string format: date-time
Examples
Exampleseed
Derived from fixtures/seed.json.
{ "agentKind": "hermes", "createdAt": "2026-09-20T09:00:00.000Z", "id": "tok_01j9cx6fz4dthpcvht9zhkf4g4", "lastUsedAt": "2026-10-17T08:54:00.000Z", "name": "Hermes on homeserver", "platforms": [ "instagram", "facebook", "xiaohongshu" ], "revokedAt": null, "scopes": [ "people:read", "people:write", "circles:read", "circles:write", "feed:read", "tasks:work", "ingest:write" ], "setup": { "envBlock": "HOMESTEAD_URL=http://localhost:8080/api/v1\nHOMESTEAD_TOKEN=hst_demoDemoDemoDemoDemoDemoDemoDemoDemoDemo12\n", "hermesConfigYaml": "mcp_servers:\n homestead:\n url: \"http://localhost:8080/mcp\"\n headers:\n Authorization: \"Bearer hst_demoDemoDemoDemoDemoDemoDemoDemoDemoDemo12\"\n timeout: 120\n connect_timeout: 30\n", "mcpUrl": "http://localhost:8080/mcp", "openclawCli": "openclaw homestead add --url http://localhost:8080/api/v1", "openclawConfigJson5": "{\n mcp: {\n servers: {\n homestead: {\n url: \"http://localhost:8080/mcp\",\n transport: \"streamable-http\",\n headers: { Authorization: \"Bearer hst_demoDemoDemoDemoDemoDemoDemoDemoDemoDemo12\" },\n enabled: true,\n requestTimeoutMs: 120000,\n },\n },\n },\n}\n", "restBaseUrl": "http://localhost:8080/api/v1", "skillInstall": { "hermes": "hermes skills install homestead", "openclaw": "openclaw skills install homestead" } }, "token": "hst_demoDemoDemoDemoDemoDemoDemoDemoDemoDemo12", "tokenPrefix": "hst_demo"}