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

# Get User Connections

> Retrieve user providers via the Junction API. Requires authentication with your team API key.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
       --url {{BASE_URL}}/v2/user/providers/{user_id} \
       --header 'Accept: application/json' \
       --header 'x-vital-api-key: <API_KEY>'
  ```

  ```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.user.getConnectedProviders({ userId: "<user_id>" });
  ```

  ```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.user.get_connected_providers("<user_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.user().getConnectedProviders("<user_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.User.GetConnectedProviders(context.TODO(), &junction.GetConnectedProvidersUserRequest{
      UserId: "<user_id>",
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "providers": [
          {
              "name": "Fitbit",
              "slug": "fitbit",
              "logo": "https://example.com/fitbit.png",
              "status": "connected",
              "created_on": "2010-01-23T12:34:56+00:00",
              "resource_availability": {
                  "body": {
                      "status": "available",
                      "scope_requirements": {
                          "user_granted": {
                              "required": [
                                  "weight"
                              ],
                              "optional": []
                          },
                          "user_denied": {
                              "required": [],
                              "optional": []
                          }
                      }
                  },
                  "sleep": {
                      "status": "unavailable",
                      "scope_requirements": {
                          "user_granted": {
                              "required": [],
                              "optional": []
                          },
                          "user_denied": {
                              "required": [
                                  "sleep"
                              ],
                              "optional": [
                                  "heartrate",
                                  "oxygen_saturation",
                                  "respiratory_rate"
                              ]
                          }
                      }
                  }
              },
              "error_details": null
          }
      ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v2/user/providers/{user_id}
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/user/providers/{user_id}:
    get:
      tags:
        - user
      summary: Get Connected Providers
      description: GET Users connected providers
      operationId: get_connected_providers_v2_user_providers__user_id__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.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/ClientFacingProviderWithStatus'
                propertyNames:
                  const: providers
                title: >-
                  Response Get Connected Providers V2 User Providers  User Id 
                  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ClientFacingProviderWithStatus:
      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
        created_on:
          type: string
          format: date-time
          title: Created On
        status:
          type: string
          title: Status
          description: Status of source, either error or connected
        external_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External User Id
          description: |

            The unique identifier of the associated external data provider user.

            * OAuth Providers: User unique identifier; provider-specific formats
            * Password Providers: Username
            * Email Providers: Email
            * Junction Mobile SDK Providers: `null` (not available)
        error_details:
          anyOf:
            - $ref: '#/components/schemas/ClientFacingConnectionErrorDetails'
            - type: 'null'
          description: >-
            Details of the terminal connection error — populated only when the
            status is `error`.
        resource_availability:
          additionalProperties:
            $ref: '#/components/schemas/ResourceAvailability'
          propertyNames:
            $ref: '#/components/schemas/Resource'
          type: object
          title: Resource Availability
      type: object
      required:
        - name
        - slug
        - logo
        - created_on
        - status
        - resource_availability
      title: Provider
      example:
        created_on: '2010-01-23T12:34:56+00:00'
        error_details:
          error_message: >-
            The user has deregistered the connection per notification from
            Garmin.
          error_type: deregistered_per_provider
          errored_at: '2010-01-24T23:45:32+00:00'
        logo: https://logo_url.com
        name: Garmin
        resource_availability:
          sleep:
            scope_requirements:
              user_denied:
                optional:
                  - spo2Daily
                required: []
              user_granted:
                optional: []
                required:
                  - daily
            status: available
        slug: garmin
        status: error
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    ClientFacingConnectionErrorDetails:
      properties:
        error_type:
          type: string
          enum:
            - token_refresh_failed
            - webhook_registration_failed
            - user_not_found
            - deregistered_per_provider
            - required_scopes_not_granted
            - provider_credential_error
            - provider_password_expired
            - unknown
          title: Error Type
          description: ℹ️ This enum is non-exhaustive.
        error_message:
          type: string
          title: Error Message
        errored_at:
          type: string
          format: date-time
          title: Errored At
      type: object
      required:
        - error_type
        - error_message
        - errored_at
      title: ConnectionErrorDetails
    ResourceAvailability:
      properties:
        status:
          $ref: '#/components/schemas/Availability'
          description: ℹ️ This enum is non-exhaustive.
        scope_requirements:
          anyOf:
            - $ref: '#/components/schemas/ScopeRequirementsGrants'
            - type: 'null'
      type: object
      required:
        - status
      title: ResourceAvailability
    Availability:
      type: string
      enum:
        - available
        - unavailable
      title: Availability
      description: ℹ️ This enum is non-exhaustive.
    ScopeRequirementsGrants:
      properties:
        user_granted:
          $ref: '#/components/schemas/ScopeRequirements_str_'
        user_denied:
          $ref: '#/components/schemas/ScopeRequirements_str_'
      type: object
      required:
        - user_granted
        - user_denied
      title: ScopeRequirementsGrants
    ScopeRequirements_str_:
      properties:
        required:
          items:
            type: string
          type: array
          title: Required
        optional:
          items:
            type: string
          type: array
          title: Optional
      type: object
      required:
        - required
        - optional
      title: ScopeRequirements[str]
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````