---
descriptions:
  pipes_access_token: The OAuth access token for the connected integration.
  pipes_active: >-
    Indicates whether the access token is valid and ready for use, or if
    reauthorization is required.
  pipes_expires_at: The ISO-8601 formatted timestamp indicating when the access token expires.
  pipes_scopes: The scopes granted to the access token.
  pipes_missing_scopes: >-
    If the integration has requested scopes that aren't present on the access
    token, they're listed here.
  pipes_get_token:
    slug: The identifier of the integration.
    user_id: >-
      A [User](/reference/authkit/user) identifier. The user must have an active
      connection to the specified integration.
    organization_id: >-
      An [Organization](/reference/organization) identifier. Optional parameter
      to scope the integration lookup to a specific organization.
    access_token: >-
      The [access token](/reference/pipes/access-token) object, present when
      `active` is `true`.
    error: >
      - `"not_installed"`: The user does not have the integration installed.

      - `"needs_reauthorization"`: The user needs to reauthorize the
      integration.
reference:
  curl:
    - key: pipes_get_token
      id: pipes_get_token
      url: /reference/pipes/access-token/get
      title: '/data-integrations/:slug/token'
      type: POST
      parameters:
        - key: slug
          type: string
          description: (pipes_get_token.slug)
        - key: user_id
          type: string
          description: (pipes_get_token.user_id)
        - key: organization_id
          type: string
          description: (pipes_get_token.organization_id)
          optional: true
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: active
              type: boolean
              description: (pipes_active)
            - key: access_token
              type: access_token
              optional: true
              description: (pipes_get_token.access_token)
            - key: error
              type: '"not_installed" | "needs_reauthorization"'
              optional: true
              description: (pipes_get_token.error)
  js:
    - key: pipesGetToken
      id: pipes_get_token
      url: /reference/pipes/access-token/get
      title: pipes.getAccessToken()
      parameters:
        - key: options
          type: object
          unwrap: true
          properties:
            - key: provider
              type: string
              description: (pipes_get_token.slug)
            - key: userId
              type: string
              description: (pipes_get_token.user_id)
            - key: organizationId
              type: string
              optional: true
              description: (pipes_get_token.organization_id)
      returns:
        - key: accessToken
          type: object | null
          description: >-
            Includes the access token value itself, as well as metadata about
            the token. It's null if the token is invalid; check the `reason`
            property for more information.
          properties:
            - key: token
              type: string
              description: (pipes_access_token)
            - key: expiresAt
              type: Date | null
              description: (pipes_expires_at)
            - key: scopes
              type: 'string[]'
              description: (pipes_scopes)
            - key: missingScopes
              type: 'string[]'
              description: (pipes_missing_scopes)
        - key: error
          type: '"not_installed" | "needs_reauthorization"'
          optional: true
          description: (pipes_get_token.error)
  go:
    - key: GetAccessToken
      id: pipes_get_token
      url: /reference/pipes/access-token/get
      title: pipes.GetAccessToken()
      parameters:
        - key: ctx
          type: context.Context
          description: >-
            The [Context](https://pkg.go.dev/context) type provides information
            about the client making the request.
        - key: opts
          type: pipes.GetAccessTokenOpts
          unwrap: true
          properties:
            - key: Provider
              type: string
              description: (pipes_get_token.slug)
            - key: UserID
              type: string
              description: (pipes_get_token.user_id)
            - key: OrganizationID
              type: string
              optional: true
              description: (pipes_get_token.organization_id)
      returns:
        - key: accessToken
          type: pipes.AccessToken
          description: >-
            Includes the access token value itself, as well as metadata about
            the token. It's null if the token is invalid; check the `reason`
            property for more information.
          properties:
            - key: AccessToken
              type: string
              description: (pipes_access_token)
            - key: ExpiresAt
              type: time.Time | null
              description: (pipes_expires_at)
            - key: Scopes
              type: '[]string'
              description: (pipes_scopes)
            - key: MissingScopes
              type: '[]string'
              description: (pipes_missing_scopes)
        - key: err
          type: pipes.NotInstalled | pipes.NeedsReauthorization | error
          description: >
            Includes Pipes-specific errors:

            - `pipes.NotInstalled`: The user does not have the integration
            installed.

            - `pipes.NeedsReauthorization`: The user needs to reauthorize the
            integration.


            Network and other transient errors may also be returned.
originalPath: .tmp-workos-clone/packages/docs/content/reference/pipes/access-token/get.mdx
---

## Get an access token for a connected account

Fetches a valid OAuth access token for a user's connected account. WorkOS automatically handles token refresh, ensuring you always receive a valid, non-expired token.

<CodeBlock referenceId="pipes_get_token">
  <CodeBlockTab title="Request" file="get-token-request" />
  <CodeBlockTab title="Response" file="get-token-response" />
</CodeBlock>
