SparkyFitness Sleep Science API

The SleepScience API from SparkyFitness — 7 operation(s) for sleepscience.

Operations 7

GET /sleep-science/sleep-debt Get current sleep debt with 14-day breakdown #
POST /sleep-science/calculate-baseline Calculate and persist MCTQ baseline sleep need #
GET /sleep-science/mctq-stats Get MCTQ statistics and calculation history #
GET /sleep-science/daily-need Get dynamic daily sleep need (WHOOP-style decomposition) #
GET /sleep-science/energy-curve Get 24-hour energy curve (Two-Process Model) #
GET /sleep-science/chronotype Get chronotype analysis #
GET /sleep-science/data-sufficiency Check if enough sleep data exists for MCTQ calculation #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sparkyfitness-sleepscience-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sparkyfitness-sleepscience-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: SparkyFitness Sleep Science API
  version: 1.0.0
  description: API documentation for the SparkyFitness application, providing a comprehensive guide to all available endpoints.
  contact:
    name: SparkyFitness Support
servers:
- url: https://{host}/api
  description: Self-hosted SparkyFitness instance (the operator supplies the host). The upstream spec declares the relative base "/api".
  variables:
    host:
      default: sparkyfitness.example.com
      description: Hostname of your own SparkyFitness deployment. SparkyFitness is self-hosted; there is no vendor-operated API host.
security:
- apiKeyAuth: []
tags:
- name: SleepScience
paths:
  /sleep-science/sleep-debt:
    get:
      summary: Get current sleep debt with 14-day breakdown
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: targetUserId
        schema:
          type: string
        description: Optional user ID for family access
      responses:
        '200':
          description: Sleep debt data
      operationId: getSleepScienceSleepDebt
      x-operation-id-source: derived
  /sleep-science/calculate-baseline:
    post:
      summary: Calculate and persist MCTQ baseline sleep need
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                windowDays:
                  type: number
                  default: 90
      responses:
        '200':
          description: MCTQ calculation result
      operationId: postSleepScienceCalculateBaseline
      x-operation-id-source: derived
  /sleep-science/mctq-stats:
    get:
      summary: Get MCTQ statistics and calculation history
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: targetUserId
        schema:
          type: string
      responses:
        '200':
          description: MCTQ stats
      operationId: getSleepScienceMctqStats
      x-operation-id-source: derived
  /sleep-science/daily-need:
    get:
      summary: Get dynamic daily sleep need (WHOOP-style decomposition)
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: date
        schema:
          type: string
          format: date
        description: Target date (defaults to today)
      - in: query
        name: targetUserId
        schema:
          type: string
      responses:
        '200':
          description: Daily sleep need breakdown
      operationId: getSleepScienceDailyNeed
      x-operation-id-source: derived
  /sleep-science/energy-curve:
    get:
      summary: Get 24-hour energy curve (Two-Process Model)
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: targetUserId
        schema:
          type: string
      responses:
        '200':
          description: 96-point energy curve with zones
      operationId: getSleepScienceEnergyCurve
      x-operation-id-source: derived
  /sleep-science/chronotype:
    get:
      summary: Get chronotype analysis
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: targetUserId
        schema:
          type: string
      responses:
        '200':
          description: Chronotype classification and circadian markers
      operationId: getSleepScienceChronotype
      x-operation-id-source: derived
  /sleep-science/data-sufficiency:
    get:
      summary: Check if enough sleep data exists for MCTQ calculation
      tags:
      - SleepScience
      security:
      - bearerAuth: []
      parameters:
      - in: query
        name: targetUserId
        schema:
          type: string
      responses:
        '200':
          description: Data sufficiency assessment
      operationId: getSleepScienceDataSufficiency
      x-operation-id-source: derived
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key authentication via x-api-key header.
x-provenance:
  generated: '2026-08-27'
  method: derived
  source: https://github.com/CodeWithCJ/SparkyFitness — assembled from the project's own swagger-jsdoc configuration (SparkyFitnessServer/config/swagger.ts) and the 419 @swagger JSDoc blocks in SparkyFitnessServer/routes/**, using the same scan paths and the same cookieAuth->apiKeyAuth post-processing the server applies. This is the identical document a running instance serves at GET /api/api-docs/json (Swagger UI at /api/api-docs/swagger, ReDoc at /api/api-docs/redoc).
  note: 'Not fetched from a live host: SparkyFitness is self-hosted and the project operates no public instance, so the contract can only be read from the source that generates it. Upstream sets no operationIds; paths+methods are the stable identifiers.'
  upstream_version: server package.json 1.6.4 (release v1.6.4, 2026-08-27)