Loading...
Loading...
SecondMe API Technical Reference Document for Development Reference
npx skill4agent add mindverse/second-me-skills secondme-referencehttps://app.mindos.com/gate/labhttps://go.second.me/oauth/1. User clicks Login → Redirect to SecondMe authorization page
2. User authorizes → Redirect back to your application (with authorization_code)
3. Backend exchanges code for access_token and refresh_token
4. Call SecondMe API using access_token
5. Refresh with refresh_token when Token expires| Token Type | Prefix | Validity Period |
|---|---|---|
| Authorization Code | | 5 minutes |
| Access Token | | 2 hours |
| Refresh Token | | 30 days |
| Scope | Description |
|---|---|
| Basic user information |
| User interest tags |
| User soft memory |
| Add notes |
| Chat functionality |
| Structured action judgment (Act) |
{
"code": 0,
"data": { ... } // Actual data is in the data field
}// Note: The following /api/secondme/... is a Next.js local route (generated by secondme-nextjs skill),
// which proxies requests to the upstream SecondMe API and passes through the upstream response format.
// ❌ Wrong approach - Directly using the response will cause .map is not a function
const response = await fetch('/api/secondme/user/shades'); // Next.js local route
const shades = await response.json();
shades.map(item => ...) // Error!
// ✅ Correct approach - Extract data from the data field
const response = await fetch('/api/secondme/user/shades'); // Next.js local route
const result = await response.json();
if (result.code === 0) {
const shades = result.data.shades; // Correct!
shades.map(item => ...)
}The following paths are upstream SecondMe API paths, complete URL =Where{base_url}/api/secondme{path}comes frombase_url(defaultstate.api.base_url)https://app.mindos.com/gate/lab
| Upstream API Path | Data Path | Type |
|---|---|---|
| | object (contains fields like email, name, avatarUrl, route, etc.) |
| | array |
| | array |
| | array |
| | array |
| SSE streaming JSON (needs delta concatenation) | SSE stream |
| | number |
chatPOST {base_url}/api/secondme/act/stream| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | User message content |
| actionControl | string | Yes | Action control instructions (20-8000 characters), defining JSON structure and judgment rules |
| appId | string | No | Application ID |
| sessionId | string | No | Session ID, automatically generated if not provided |
| systemPrompt | string | No | System prompt, only valid for the first time in a new session |
Only output valid JSON objects, no explanations.
Output structure: {"is_liked": boolean}.
Set is_liked=true when the user clearly expresses liking or support, otherwise is_liked=false.event: session
data: {"sessionId": "labs_sess_xxx"}
data: {"choices": [{"delta": {"content": "{\"is_liked\": true}"}}]}
data: [DONE]// Call Act API for structured judgment (proxied to upstream via Next.js local route)
const response = await fetch('/api/secondme/act/stream', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: userMessage,
actionControl: 'Only output valid JSON. Structure: {"intent": "like"|"dislike"|"neutral"}. Judge intent based on user expression. Return {"intent": "neutral"} when information is insufficient.'
})
});
// Concatenate delta content in the SSE stream, then JSON.parse to get the result| Scenario | API to Use | Reason |
|---|---|---|
| Free conversation | | Returns natural language text |
| Sentiment/intent judgment | | Returns structured JSON |
| Yes/no decision making | | Returns |
| Multi-category judgment | | Returns |
| Content generation | | Requires long text output |
state@import@charset@layer@import/* Correct approach - @import placed at the top */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC&display=swap');
:root {
--primary-color: #000;
}
/* Wrong approach - @import cannot be placed after other rules */
:root {
--primary-color: #000;
}
@import url('...'); /* This will cause an error! */| Document | URL |
|---|---|
| Quick Start | https://develop-docs.second.me/zh/docs |
| Authentication Overview | https://develop-docs.second.me/zh/docs/authentication |
| OAuth2 Guide | https://develop-docs.second.me/zh/docs/authentication/oauth2 |
| SecondMe API Reference | https://develop-docs.second.me/zh/docs/api-reference/secondme |
| OAuth2 API Reference | https://develop-docs.second.me/zh/docs/api-reference/oauth |
| Error Code Reference | https://develop-docs.second.me/zh/docs/errors |