Create a visitor session

Creates a new anonymous visitor identity every time, without restoring previous visitor history. Credentials last 604800 seconds; subsequent data calls supply query parameter s.

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

Before you call this API

Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5. For private deployments, use the corresponding product API URL.

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

Request

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

Parameter

Location

Type

Required

Description

webapp

Body

string

Yes

Agent ID from the link or resolve.

t

Body

string

Yes

Publication token or short code used by resolve.

Successful response

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

Success returns HTTP 200 with numeric code=0. Read data’s Object descriptions with the example; the conversation-creation example shows a field excerpt only.

Error responses

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

Last updated on