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

# Link Email provider

> Create or submit link provider email via the Junction API. Requires authentication with your team API key.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url {{BASE_URL}}/v2/link/provider/email/{provider} \
       --header 'Accept: application/json' \
       --header 'Content-Type: application/json' \
       --header 'x-vital-link-token: <VITAL-LINK-TOKEN>' \
       --data '
  {
       "email": "test@email.com",
       "region": "us"
  }
  '
  ```

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

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

  const tokenResponse = await client.link.token({ userId: "<user_id>" });

  const data = await client.link.connectEmailAuthProvider({
      provider: "freestyle_libre",
      email: "<email>",
      vitalLinkToken: tokenResponse.linkToken,
  });
  ```

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

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

  token_response = client.link.token(user_id="<user_id>")

  data = client.link.connect_email_auth_provider(
      email="<email>",
      vital_link_token=token_response.link_token,
  )
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.link.requests.EmailProviderAuthLink;
  import com.junction.api.resources.link.requests.LinkTokenExchange;

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

  var tokenResponse = client.link().token(
      LinkTokenExchange.builder()
          .userId("<user_id>")
          .build()
  );

  var data = client.link().connectEmailAuthProvider(
      "freestyle_libre",
      EmailProviderAuthLink.builder()
          .email("<email>")
          .vitalLinkToken(tokenResponse.getLinkToken())
          .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),
  )

  tokenResponse, err := c.Link.Token(context.TODO(), &junction.LinkTokenExchange{
      UserId: "<user_id>",
  })
  if err != nil {
      return err
  }

  response, err := c.Link.ConnectEmailAuthProvider(context.TODO(), &junction.EmailProviderAuthLink{
      Provider:       "freestyle_libre",
      Email:          "<email>",
      VitalLinkToken: &tokenResponse.LinkToken,
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>


## OpenAPI

````yaml POST /v2/link/provider/email/{provider}
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.483
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/link/provider/email/{provider}:
    post:
      tags:
        - link
      summary: Connect Email Auth Provider
      description: This connects auth providers that are email based.
      operationId: connect_email_auth_provider_v2_link_provider_email__provider__post
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/EmailProviders'
            title: Email providers that require emails freestyle_auth
        - name: x-vital-link-token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Vital-Link-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailProviderAuthLink'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security: []
components:
  schemas:
    EmailProviders:
      type: string
      enum:
        - freestyle_libre
      title: EmailProviders
      description: ℹ️ This enum is non-exhaustive.
    EmailProviderAuthLink:
      properties:
        email:
          type: string
          title: Email
        provider:
          anyOf:
            - $ref: '#/components/schemas/Providers'
            - type: 'null'
          deprecated: true
          description: ℹ️ This enum is non-exhaustive.
        region:
          $ref: '#/components/schemas/Region'
          description: ℹ️ This enum is non-exhaustive.
      type: object
      required:
        - email
      title: EmailProviderAuthLink
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    Providers:
      type: string
      enum:
        - oura
        - fitbit
        - garmin
        - whoop
        - strava
        - renpho
        - peloton
        - wahoo
        - zwift
        - freestyle_libre
        - abbott_libreview
        - tandem_source
        - freestyle_libre_ble
        - eight_sleep
        - withings
        - apple_health_kit
        - manual
        - ihealth
        - google_fit
        - beurer_api
        - beurer_ble
        - omron
        - omron_ble
        - onetouch_ble
        - accuchek_ble
        - contour_ble
        - dexcom
        - dexcom_v3
        - hammerhead
        - my_fitness_pal
        - health_connect
        - samsung_health
        - polar
        - cronometer
        - kardia
        - whoop_v2
        - ultrahuman
        - my_fitness_pal_v2
        - map_my_fitness
        - runkeeper
      title: Providers
      description: ℹ️ This enum is non-exhaustive.
    Region:
      type: string
      enum:
        - us
        - eu
        - de
        - fr
        - ca
        - br
        - ar
        - cl
        - co
        - mx
        - gb
        - ie
        - au
        - nz
        - nl
        - at
        - be
        - bh
        - ch
        - cz
        - dk
        - eg
        - es
        - fi
        - gr
        - hr
        - il
        - it
        - jo
        - kw
        - lb
        - lu
        - 'no'
        - om
        - pl
        - pt
        - qa
        - sa
        - se
        - si
        - sk
        - tr
        - za
        - in
        - sg
        - hk
        - kr
        - ph
        - tw
      title: Region
      description: ℹ️ This enum is non-exhaustive.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````