> ## 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.

# Raw

> Retrieve raw sleep data for a specific user as received from their connected wearable provider.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
       --url {{BASE_URL}}/v2/summary/sleep/{user_id}/raw \
       --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_raw(
      "<user_id>",
      start_date="2021-01-01",
      end_date="2021-01-02",
  )
  ```

  ```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.getRaw({
      userId: "<user_id>",
      startDate: "2021-01-01",
      endDate: "2021-01-02",
  });
  ```

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

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

  var data = client.sleep().getRaw(
      "<user_id>",
      GetRawSleepRequest.builder()
          .startDate("2021-01-01")
          .endDate("2021-01-02")
          .build()
  );
  ```

  ```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),
  )

  endDate := "2021-01-02"
  response, err := c.Sleep.GetRaw(context.TODO(), &junction.GetRawSleepRequest{
      UserId:    "<user_id>",
      StartDate: "2021-01-01",
      EndDate:   &endDate,
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>


## OpenAPI

````yaml GET /v2/summary/sleep/{user_id}/raw
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.495
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/summary/sleep/{user_id}/raw:
    get:
      tags:
        - summary
      summary: Get User Sleep Raw
      description: Get raw sleep summary for user_id
      operationId: get_user_sleep_raw_v2_summary_sleep__user_id__raw_get
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: >-
              User id returned by vital create user id request. This id should
              be stored in your database against the user and used for all
              interactions with the vital api.
        - name: provider
          in: query
          required: false
          schema:
            type: string
            description: Provider oura/strava etc
            default: ''
            title: Provider
          description: Provider oura/strava etc
        - name: start_date
          in: query
          required: true
          schema:
            type: string
            description: >-
              Date from in YYYY-MM-DD or ISO formatted date time. If a date is
              provided without a time, the time will be set to 00:00:00
            title: Start Date
          description: >-
            Date from in YYYY-MM-DD or ISO formatted date time. If a date is
            provided without a time, the time will be set to 00:00:00
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Date to YYYY-MM-DD or ISO formatted date time. If a date is
              provided without a time, the time will be set to 23:59:59
            title: End Date
          description: >-
            Date to YYYY-MM-DD or ISO formatted date time. If a date is provided
            without a time, the time will be set to 23:59:59
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RawSleepResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RawSleepResponse:
      properties:
        sleep:
          items:
            $ref: '#/components/schemas/RawSleep'
          type: array
          title: Sleep
      type: object
      required:
        - sleep
      title: Raw Sleep data
      example:
        sleep:
          - data:
              data: ...provider_specific_data
            priority_id: 1
            provider_id: 5e8271a3-e71b-4882-a94a-7e364694cd16
            source_device_id: 550e8400-e29b-41d4-a716-446655440000
            source_id: 1
            timestamp: '2023-02-27T12:31:24+00:00'
            user_id: 1449752e-0d8a-40e0-9206-91ab099b2537
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    RawSleep:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        data:
          additionalProperties: true
          type: object
          title: Data
        user_id:
          type: string
          format: uuid
          title: User Id
        provider_id:
          type: string
          title: Provider Id
          deprecated: true
        source_id:
          type: integer
          title: Source Id
          deprecated: true
        priority_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Priority Id
          deprecated: true
        id:
          type: string
          format: uuid
          title: Id
        source_device_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Source Device Id
        created_at:
          type: string
          format: date-time
          title: Created At
          default: '0001-01-01T00:00:00Z'
        updated_at:
          type: string
          format: date-time
          title: Updated At
          default: '0001-01-01T00:00:00Z'
        source:
          $ref: '#/components/schemas/ClientFacingProvider'
          deprecated: true
        priority:
          anyOf:
            - type: integer
            - type: 'null'
          title: Priority
          deprecated: true
      type: object
      required:
        - timestamp
        - data
        - user_id
        - provider_id
        - source_id
        - priority_id
        - id
        - source
      title: RawSleep
    ClientFacingProvider:
      properties:
        name:
          type: string
          title: Name
          description: Name of source of information
        slug:
          type: string
          title: Slug
          description: Slug for designated source
        logo:
          type: string
          title: Logo
          description: URL for source logo
      type: object
      required:
        - name
        - slug
        - logo
      title: Provider
      description: A vendor, a service, or a platform which Vital can connect with.
      example:
        logo: https://logo_url.com
        name: Oura
        slug: oura
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````