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

# Post Team Data Pull Preferences

> Post org team data pull preferences via the Junction API. Requires authentication with your team API key.

<Info>
  [Junction Management API](/api-details/junction-management-api) is available for [the Scale plan](https://tryvital.io/pricing).
</Info>

<Tip>
  The base URL of this endpoint is `https://api.management.junction.com/`.

  The endpoint accepts only [Management Key](/api-details/junction-management-api#authentication) (`X-Management-Key`).
  Team API Key is not accepted.
</Tip>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.management.junction.com/v1/org/{org_id}/team_data_pull_preferences/{env}/{region} \
    --header 'X-Vital-Org-Key: <api-key>' \
    --data '{
      "team_ids": [
          "<uuid>"
      ],
      "providers": {
          "oura": {
              "default": {
                  "historical_days_to_pull": 120
              },
              "resource_overrides": {
                  "sleep": {
                      "historical_days_to_pull": 180
                  }
              }
          }
      }
  }'
  ```
</RequestExample>

<Warning>
  By setting a higher value, you acknowledge your awareness of *the facts of API life* that:

  1. historical pulls may take longer to complete;
  2. historical pulls may run into provider rate limiting; and
  3. regular data polling may consequentially be delayed as a knock-on effect.
</Warning>

<Warning>
  Provider rate limiting typically happens at OAuth application level.

  Therefore, Junction recommends [Bring Your Own OAuth](/wearables/connecting-providers/bring-your-own-oauth/overview)
  if you want to set an extended historical pull range. This creates a rate limit quota dedicated to
  your Junction Team, not being shared with other Junction customers.
</Warning>

<Info>
  The Team Data Pull Preferences you specified are *advisory*. There are scenarios in which Junction systems
  may not adhere strictly to your stated preferences.
</Info>

## Supported Providers

| Provider                                                                     | Default  | Configurable | Remarks                                                                                                                                                                                                                       |
| ---------------------------------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Abbott LibreView](https://www.libreview.com)                                | 90 days  | ❌            | -                                                                                                                                                                                                                             |
| [Fitbit](https://www.fitbit.com/global/uk/home)                              | 90 days  | ⚠️           | Activity and heartrate timeseries data are fixed to 14 days.                                                                                                                                                                  |
| [Garmin](https://www.garmin.com)                                             | 90 days  | ✅            | -                                                                                                                                                                                                                             |
| [Google Fit](https://www.google.com/fit/)                                    | 90 days  | ✅            | -                                                                                                                                                                                                                             |
| [Oura](https://ouraring.com)                                                 | 180 days | ✅            | -                                                                                                                                                                                                                             |
| [Peloton](https://www.onepeloton.com)                                        | 180 days | ✅            | -                                                                                                                                                                                                                             |
| [Strava](https://www.strava.com)                                             | 14 days  | ✅            | -                                                                                                                                                                                                                             |
| [Wahoo](https://wahoofitness.com)                                            | 180 days | ✅            | -                                                                                                                                                                                                                             |
| [WHOOP](https://www.whoop.com)                                               | 180 days | ✅            | -                                                                                                                                                                                                                             |
| [Zwift](https://zwift.com)                                                   | 270 days | ✅            | -                                                                                                                                                                                                                             |
| [Withings](https://www.withings.com)                                         | 90 days  | ✅            | -                                                                                                                                                                                                                             |
| [8Sleep](https://www.eightsleep.com)                                         | 90 days  | ✅            | -                                                                                                                                                                                                                             |
| [Apple HealthKit](https://www.apple.com/uk/ios/health/) (SDK)                | 30 days  | ✅            | -                                                                                                                                                                                                                             |
| [Android Health Connect](https://developer.android.com/health-connect) (SDK) | 30 days  | ❌            | Google restricts access to historical data to [30 days before the first successful permission request](https://developer.android.com/health-and-fitness/guides/health-connect/develop/frequently-asked-questions#time-range). |
| [Hammerhead](https://www.hammerhead.io)                                      | 30 days  | ✅            | -                                                                                                                                                                                                                             |
| [Dexcom](https://www.dexcom.com)                                             | 30 days  | ✅            | -                                                                                                                                                                                                                             |
| [Dexcom (G6 And Older)](https://www.dexcom.com)                              | 1 day    | ❌            | -                                                                                                                                                                                                                             |
| [MyFitnessPal](https://www.myfitnesspal.com)                                 | 14 days  | ✅            | -                                                                                                                                                                                                                             |
| [Polar](https://www.polar.com/accesslink-api/#polar-accesslink-api)          | 28 days  | ❌            | Polar only supports historical backfill for Sleep and Sleep Stream resources.                                                                                                                                                 |
| [Cronometer](https://www.cronometer.com)                                     | 28 days  | ✅            | -                                                                                                                                                                                                                             |

<Note>
  The configurable maximum is 365 days at this time.
</Note>


## OpenAPI

````yaml post /v1/org/{org_id}/team_data_pull_preferences/{env}/{region}
openapi: 3.1.0
info:
  title: Org Management
  version: 0.1.0
servers:
  - url: https://api.management.junction.com
    description: Production Management API server
security:
  - ManagementKey: []
paths:
  /v1/org/{org_id}/team_data_pull_preferences/{env}/{region}:
    post:
      tags:
        - Team Data Pull Preferences
      summary: Upsert Team Data Pull Preferences
      operationId: >-
        upsert_team_data_pull_preferences_v1_org__org_id__team_data_pull_preferences__env___region__post
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Org Id
        - name: env
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/Env'
        - name: region
          in: path
          required: true
          schema:
            type: string
            enum:
              - us
              - eu
            title: Region
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertTeamDataPullPreferencesBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamDataPullPreferencesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Env:
      type: string
      enum:
        - production
        - sandbox
      title: Env
    UpsertTeamDataPullPreferencesBody:
      properties:
        team_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Team Ids
        providers:
          additionalProperties:
            $ref: '#/components/schemas/SingleProviderDataPullPreferences'
          propertyNames:
            enum:
              - oura
              - fitbit
              - garmin
              - strava
              - withings
              - peloton
              - wahoo
              - zwift
              - freestyle_libre
              - abbott_libreview
              - eight_sleep
              - renpho
              - omron
              - dexcom_v3
              - hammerhead
              - polar
              - cronometer
              - kardia
              - whoop_v2
              - my_fitness_pal_v2
              - map_my_fitness
              - runkeeper
              - apple_health_kit
              - google_fit
              - beurer_api
              - ultrahuman
          type: object
          title: Providers
      type: object
      required:
        - team_ids
        - providers
      title: UpsertTeamDataPullPreferencesBody
    TeamDataPullPreferencesResponse:
      properties:
        data_pull_preferences:
          items:
            $ref: '#/components/schemas/TeamDataPullPreferencesWithLimit'
          type: array
          title: Data Pull Preferences
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
      type: object
      required:
        - data_pull_preferences
      title: TeamDataPullPreferencesResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SingleProviderDataPullPreferences:
      properties:
        default:
          $ref: '#/components/schemas/DefaultConfiguration'
        resource_overrides:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/SingleResourceOverride'
              propertyNames:
                $ref: '#/components/schemas/Resource'
              type: object
            - type: 'null'
          title: Resource Overrides
      type: object
      required:
        - default
      title: SingleProviderDataPullPreferences
    TeamDataPullPreferencesWithLimit:
      properties:
        team_id:
          type: string
          format: uuid
          title: Team Id
        providers:
          additionalProperties:
            $ref: '#/components/schemas/SingleProviderDataPullPreferencesWithLimit'
          propertyNames:
            $ref: '#/components/schemas/Providers'
          type: object
          title: Providers
      type: object
      required:
        - team_id
        - providers
      title: TeamDataPullPreferencesWithLimit
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DefaultConfiguration:
      properties:
        historical_days_to_pull:
          type: integer
          title: Historical Days To Pull
      type: object
      required:
        - historical_days_to_pull
      title: DefaultConfiguration
    SingleResourceOverride:
      properties:
        historical_days_to_pull:
          type: integer
          title: Historical Days To Pull
      type: object
      required:
        - historical_days_to_pull
      title: SingleResourceOverride
    SingleProviderDataPullPreferencesWithLimit:
      properties:
        default:
          $ref: '#/components/schemas/DefaultConfigurationWithLimit'
        resource_overrides:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/SingleResourceOverrideWithLimit'
              propertyNames:
                $ref: '#/components/schemas/Resource'
              type: object
            - type: 'null'
          title: Resource Overrides
      type: object
      required:
        - default
      title: SingleProviderDataPullPreferencesWithLimit
    DefaultConfigurationWithLimit:
      properties:
        historical_days_to_pull:
          type: integer
          title: Historical Days To Pull
        historical_days_to_pull_limit:
          type: integer
          title: Historical Days To Pull Limit
      type: object
      required:
        - historical_days_to_pull
        - historical_days_to_pull_limit
      title: DefaultConfigurationWithLimit
    SingleResourceOverrideWithLimit:
      properties:
        historical_days_to_pull:
          type: integer
          title: Historical Days To Pull
        historical_days_to_pull_limit:
          type: integer
          title: Historical Days To Pull Limit
      type: object
      required:
        - historical_days_to_pull
        - historical_days_to_pull_limit
      title: SingleResourceOverrideWithLimit
  securitySchemes:
    ManagementKey:
      type: apiKey
      in: header
      name: X-Management-Key

````