AI Services/Agent
Message list
Get the saved messages of a session. The response is a list of AI SDK UI Messages.
GET
/
api
/
ai
/
agent
/
sessions
/
{sessionId}
/
messages
Message list
curl --request GET \
--url https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "Request succeeded",
"data": [
{
"id": "string",
"sessionId": "string",
"message": {
"id": "string",
"role": "system",
"parts": [
{}
]
},
"createdAt": "2026-07-02T12:00:00.000Z",
"runId": "string",
"stepNumber": 1
}
]
}Authorizations
Need to get API Key from AiToEarn. Click to go to "API Key Obtaining Tutorial".
Path Parameters
Session ID.
Response
200 - application/json
The request has been processed by the service. Business success is determined by whether the response body has code === 0.
Business status code. 0 means success; non-zero means a business error.
Response message.
Session message list.
Hide child attributes
Hide child attributes
Message ID.
Owning session ID.
Created at.
Associated run ID.
Associated step number, starting at 0.
Request ID.
Error response timestamp in Unix milliseconds.
Last modified on September 29, 2026
⌘I
Message list
curl --request GET \
--url https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://aitoearn.cn/api/ai/agent/sessions/{sessionId}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "Request succeeded",
"data": [
{
"id": "string",
"sessionId": "string",
"message": {
"id": "string",
"role": "system",
"parts": [
{}
]
},
"createdAt": "2026-07-02T12:00:00.000Z",
"runId": "string",
"stepNumber": 1
}
]
}
