> ## Documentation Index
> Fetch the complete documentation index at: https://docs.junction.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream

> Retrieve timeseries sleep stream via the Junction API. Requires authentication with your team API key.

```bash cURL theme={null}
curl --request GET \
    --url {{BASE_URL}}/v2/summary/sleep/{sleep_id}/stream \
    --header 'Accept: application/json' \
    --header 'x-vital-api-key: <API_KEY>'
```

```python Python theme={null}
from junction import Junction
from junction.environment import JunctionEnvironment

client = Junction(
    api_key="YOUR_API_KEY",
    environment=JunctionEnvironment.SANDBOX,
)

data = client.sleep.get_stream_by_sleep_id("<sleep_id>")
```

```typescript TypeScript theme={null}
import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";

const client = new JunctionClient({
    apiKey: "YOUR_API_KEY",
    environment: JunctionEnvironment.Sandbox,
});

const data = await client.sleep.getStreamBySleepId({ sleepId: "<sleep_id>" });
```

```java Java theme={null}
import com.junction.api.Junction;
import com.junction.api.core.Environment;

Junction client = Junction.builder()
    .apiKey("YOUR_API_KEY")
    .environment(Environment.SANDBOX)
    .build();

var data = client.sleep().getStreamBySleepId("<sleep_id>");
```

```go Go theme={null}
import (
    "context"

    junction "github.com/junction-api/junction-go"
    "github.com/junction-api/junction-go/client"
    "github.com/junction-api/junction-go/option"
)

c := client.NewClient(
    option.WithApiKey("YOUR_API_KEY"),
    option.WithBaseURL(junction.Environments.Sandbox),
)

response, err := c.Sleep.GetStreamBySleepId(context.TODO(), &junction.GetStreamBySleepIdSleepRequest{
    SleepId: "<sleep_id>",
})
if err != nil {
    return err
}
fmt.Printf("Received data %s\n", response)
```


## OpenAPI

````yaml GET /v2/timeseries/sleep/{sleep_id}/stream
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.979
servers:
  - url: https://api.us.junction.com
    x-fern-server-name: Production
  - url: https://api.eu.junction.com
    x-fern-server-name: ProductionEU
  - url: https://api.sandbox.us.junction.com
    x-fern-server-name: Sandbox
  - url: https://api.sandbox.eu.junction.com
    x-fern-server-name: SandboxEU
security:
  - apiKeyAuth: []
paths:
  /v2/timeseries/sleep/{sleep_id}/stream:
    get:
      tags:
        - timeseries
      summary: Get User Sleep Stream
      description: Get Sleep stream for a user_id
      operationId: get_user_sleep_stream_v2_timeseries_sleep__sleep_id__stream_get
      parameters:
        - name: sleep_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The Vital Sleep ID
            title: Sleep Id
          description: The Vital Sleep ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientFacingSleepStream'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ClientFacingSleepStream:
      properties:
        hrv:
          anyOf:
            - items:
                $ref: '#/components/schemas/ClientFacingHRVTimeseries'
              type: array
            - type: 'null'
          title: Hrv
          default: []
        heartrate:
          anyOf:
            - items:
                $ref: '#/components/schemas/ClientFacingHeartRateTimeseries'
              type: array
            - type: 'null'
          title: Heartrate
          default: []
        respiratory_rate:
          anyOf:
            - items:
                $ref: '#/components/schemas/ClientFacingRespiratoryRateTimeseries'
              type: array
            - type: 'null'
          title: Respiratory Rate
          default: []
      type: object
      title: Sleep stream data
      example:
        heartrate:
          - id: 0
            timestamp: '2026-10-29T13:48:12.214689+00:00'
            unit: bpm
            value: 5
          - id: 1
            timestamp: '2026-10-29T13:48:42.214716+00:00'
            unit: bpm
            value: 183
          - id: 2
            timestamp: '2026-10-29T13:49:12.214733+00:00'
            unit: bpm
            value: 165
          - id: 3
            timestamp: '2026-10-29T13:49:42.214749+00:00'
            unit: bpm
            value: 189
          - id: 4
            timestamp: '2026-10-29T13:50:12.214766+00:00'
            unit: bpm
            value: 113
        hrv:
          - id: 0
            timestamp: '2026-10-29T13:48:12.214372+00:00'
            unit: rmssd
            value: 9
          - id: 1
            timestamp: '2026-10-29T13:48:42.214553+00:00'
            unit: rmssd
            value: 78
          - id: 2
            timestamp: '2026-10-29T13:49:12.214591+00:00'
            unit: rmssd
            value: 4
          - id: 3
            timestamp: '2026-10-29T13:49:42.214646+00:00'
            unit: rmssd
            value: 11
          - id: 4
            timestamp: '2026-10-29T13:50:12.214668+00:00'
            unit: rmssd
            value: 24
        respiratory_rate:
          - id: 0
            timestamp: '2026-10-29T13:48:12.214783+00:00'
            unit: bpm
            value: 11
          - id: 1
            timestamp: '2026-10-29T13:48:42.214803+00:00'
            unit: bpm
            value: 8
          - id: 2
            timestamp: '2026-10-29T13:49:12.214820+00:00'
            unit: bpm
            value: 14
          - id: 3
            timestamp: '2026-10-29T13:49:42.214837+00:00'
            unit: bpm
            value: 23
          - id: 4
            timestamp: '2026-10-29T13:50:12.214853+00:00'
            unit: bpm
            value: 10
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    ClientFacingHRVTimeseries:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Deprecated
        timezone_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timezone Offset
          description: >-
            Time zone UTC offset in seconds. Positive offset indicates east of
            UTC; negative offset indicates west of UTC; and null indicates the
            time zone information is unavailable at source.
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Type is always null for this resource.
        unit:
          type: string
          title: Unit
          description: >-
            HRV method: sdnn for Apple HealthKit, rmssd for other providers.
            Values are measured in milliseconds.
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: The timestamp of the measurement.
        value:
          type: number
          title: Value
          description: Heart rate variability in milliseconds.
      type: object
      required:
        - unit
        - timestamp
        - value
      title: ClientFacingHRVTimeseries
      example:
        timestamp: '2023-02-13T14:30:52+00:00'
        unit: rmssd
        value: 48
    ClientFacingHeartRateTimeseries:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Deprecated
        timezone_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timezone Offset
          description: >-
            Time zone UTC offset in seconds. Positive offset indicates east of
            UTC; negative offset indicates west of UTC; and null indicates the
            time zone information is unavailable at source.
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Type is always null for this resource.
        unit:
          type: string
          title: Unit
          description: Measured in bpm.
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: The timestamp of the measurement.
        value:
          type: number
          title: Value
          description: Heart rate in bpm
      type: object
      required:
        - unit
        - timestamp
        - value
      title: ClientFacingHeartRateTimeseries
      example:
        timestamp: '2023-02-13T14:30:52+00:00'
        unit: bpm
        value: 70
    ClientFacingRespiratoryRateTimeseries:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Deprecated
        timezone_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timezone Offset
          description: >-
            Time zone UTC offset in seconds. Positive offset indicates east of
            UTC; negative offset indicates west of UTC; and null indicates the
            time zone information is unavailable at source.
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Type is always null for this resource.
        unit:
          type: string
          title: Unit
          description: Measured in bpm.
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: The timestamp of the measurement.
        value:
          type: number
          title: Value
          description: Average respiratory rate::breaths per minute
      type: object
      required:
        - unit
        - timestamp
        - value
      title: ClientFacingRespiratoryRateTimeseries
      example:
        timestamp: '2023-02-13T14:30:52+00:00'
        unit: bpm
        value: 15.5
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````

## Related topics

- [Stream](https://docs.junction.com/api-reference/data/workouts/get-stream.md)
- [daily.data.workout_stream.created](https://docs.junction.com/event-catalog/daily.data.workout_stream.created.md)
- [daily.data.workout_stream.updated](https://docs.junction.com/event-catalog/daily.data.workout_stream.updated.md)
- [historical.data.workout_stream.created](https://docs.junction.com/event-catalog/historical.data.workout_stream.created.md)
- [Event Structure](https://docs.junction.com/webhooks/event-structure.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.