EndpointsSleep Logs

Sleep Logs

Function-calling namespace: sleepLogs

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

deleteSleepLog

Source: backend/endpoints/sleep-logs/delete-sleep-log

Input Fields

FieldTypeRequired
stackUserIdstringYes
logIdstringYes

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

FieldTypeRequired
stackUserIdstringYes
limitintNo

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

FieldTypeRequired
stackUserIdstringYes
daysintNo

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

FieldTypeRequired
stackUserIdstringYes

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

FieldTypeRequired
stackUserIdstringYes

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

FieldTypeRequired
stackUserIdstringYes
datestringYes
hoursSleptfloat64Yes
bedTimestringNo
wakeTimestringNo
notesstringNo

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": {} }