Refresh the same visitor session

Returns a new credential and a full 604800 seconds, retaining end_user_id. Old credentials remain valid until natural expiration. Explicit session invalidation returns 404/code17. A dependency 500 does not mean the visitor is invalid and must not clear identity.

POST https://api.moi.matrixorigin.cn/v5/public/webapp/session/refresh

Before you call this API

Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.

Prepare links and visitor identity in the same environment. Do not supply a product PAT or workspace request headers.

Request

curl --request POST \
  "$BASE_URL/public/webapp/session/refresh" \
  --header "Content-Type: application/json" \
  --data @- <<JSON
{"webapp": "${AGENT_ID}", "t": "${WEBAPP_TOKEN}", "session": "${WEBAPP_SESSION}"}
JSON

Parameter

Location

Type

Required

Description

webapp

Body

string

Yes

Agent ID.

t

Body

string

Yes

Current publication credential.

session

Body

string

Yes

Still-valid visitor session; the field is not named s here.

Successful response

{
  "code": 0,
  "data": {
    "session_token": "example-visitor-session",
    "expires_in": 604800
  }
}

Success returns HTTP 200 and numeric code=0. Read data’s object descriptions alongside the example. The conversation creation example is only a field excerpt.

Error responses

Public errors and identity handling distinguishes unavailable/disabled links, invalid sessions, parameters, and system failures.

Last updated on