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:
erupt:
redis-session: true
spring:
data:
redis:
database: 0
timeout: 10000
host: 127.0.0.1Spring Boot 3 removed the
spring.redis.*prefix — you must usespring.data.redis.*.
2. Get a Token
GET {{host}}/erupt-api/open-api/create-token?appid=xxx&secret=xxxResponse example (wrapped in the standard R envelope — the payload lives under data):
{
"success": true,
"status": "SUCCESS",
"promptWay": "NONE",
"message": null,
"data": {
"token": "xxxxxxx",
"expireTime": "20xx-01-01T00:00:00"
}
}| Field | Description |
|---|---|
data.token | Access token for subsequent API calls |
data.expireTime | Token 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.
GET {{host}}/erupt-api/open-api/get-appid?token=xxxResponse example (wrapped in the standard R envelope — the payload lives under data):
{
"success": true,
"status": "SUCCESS",
"promptWay": "NONE",
"message": null,
"data": {
"appid": "xxx",
"name": "App Name"
}
}| Field | Description |
|---|---|
data.appid | The APPID associated with this token |
data.name | Open API application name |
4. Call Erupt Endpoints
After obtaining the token, include it in the request header to call protected endpoints:
GET {{host}}/erupt-api/your-api
token: xxxxxxxFor information on using endpoint permission annotations, refer to API Development & Operation Logs.