Sleep Logs
Function-calling namespace: sleepLogs
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
deleteSleepLog
Source: backend/endpoints/sleep-logs/delete-sleep-log
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
logId | string | Yes |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "deleteSleepLog",
"data": {
"stackUserId": "stackuser_123",
"logId": "log_123"
}
}'Example Response
{ "status": "ok", "data": {} }getSleepHistory
Source: backend/endpoints/sleep-logs/get-sleep-history
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
limit | int | No |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "getSleepHistory",
"data": {
"stackUserId": "stackuser_123"
}
}'Example Response
{ "status": "ok", "data": {} }getSleepStats
Source: backend/endpoints/sleep-logs/get-sleep-stats
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
days | int | No |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "getSleepStats",
"data": {
"stackUserId": "stackuser_123"
}
}'Example Response
{ "status": "ok", "data": {} }getTodaySleep
Source: backend/endpoints/sleep-logs/get-today-sleep
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "getTodaySleep",
"data": {
"stackUserId": "stackuser_123"
}
}'Example Response
{ "status": "ok", "data": {} }getWeeklySleepSummary
Source: backend/endpoints/sleep-logs/get-weekly-sleep-summary
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "getWeeklySleepSummary",
"data": {
"stackUserId": "stackuser_123"
}
}'Example Response
{ "status": "ok", "data": {} }logSleep
Source: backend/endpoints/sleep-logs/log-sleep
Input Fields
| Field | Type | Required |
|---|---|---|
stackUserId | string | Yes |
date | string | Yes |
hoursSlept | float64 | Yes |
bedTime | string | No |
wakeTime | string | No |
notes | string | No |
Example Request
curl -X POST https://api.aivida.in/api \
-H "Content-Type: application/json" \
-H "x-stack-access-token: <access_token_optional>" \
-d '{
"namespace": "sleepLogs",
"apiName": "logSleep",
"data": {
"stackUserId": "stackuser_123",
"date": "2026-03-10",
"hoursSlept": 1
}
}'Example Response
{ "status": "ok", "data": {} }