Skip to content

Open API

Erupt supports external systems obtaining a token via appid + secret to call Erupt endpoints without requiring a user login.

INFO

APPID and Secret are managed in the UPMS → Open API menu, corresponding to the EruptOpenApi entity class. View the Open API Management →

WARNING

At any given time, each APPID can only have one valid token. Calling the token generation endpoint again will immediately invalidate the previous token. For security, call this endpoint from the backend service to avoid exposing the secret to the frontend.

1. Enable Distributed Session

Tokens generated by Open API depend on Redis Session. Enable it in the configuration file:

yaml
erupt:
  redis-session: true

spring:
  data:
    redis:
      database: 0
      timeout: 10000
      host: 127.0.0.1

Spring Boot 3 removed the spring.redis.* prefix — you must use spring.data.redis.*.

2. Get a Token

http
GET {{host}}/erupt-api/open-api/create-token?appid=xxx&secret=xxx

Response example (wrapped in the standard R envelope — the payload lives under data):

json
{
  "success": true,
  "status": "SUCCESS",
  "promptWay": "NONE",
  "message": null,
  "data": {
    "token": "xxxxxxx",
    "expireTime": "20xx-01-01T00:00:00"
  }
}
FieldDescription
data.tokenAccess token for subsequent API calls
data.expireTimeToken expiration time

3. Query APPID Info by Token

Look up the APPID and name associated with a given token. Useful when a backend service needs to verify the origin of a token.

http
GET {{host}}/erupt-api/open-api/get-appid?token=xxx

Response example (wrapped in the standard R envelope — the payload lives under data):

json
{
  "success": true,
  "status": "SUCCESS",
  "promptWay": "NONE",
  "message": null,
  "data": {
    "appid": "xxx",
    "name": "App Name"
  }
}
FieldDescription
data.appidThe APPID associated with this token
data.nameOpen API application name

4. Call Erupt Endpoints

After obtaining the token, include it in the request header to call protected endpoints:

http
GET {{host}}/erupt-api/your-api
token: xxxxxxx

For information on using endpoint permission annotations, refer to API Development & Operation Logs.

Contributors

The avatar of contributor named as YuePeng YuePeng
The avatar of contributor named as Claude Opus 5 (1M context) Claude Opus 5 (1M context)

Changelog

Released under the Apache-2.0 License.