> ## Documentation Index
> Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get connection & credentials (deprecated)

> Returns a specific connection with credentials. This endpoint is deprecated, use the /connections/{connectionId} endpoint instead.

<Info>
  Requires an API key with one of: `environment:connections:read` or `environment:connections:read_credentials`. [Learn more about API key scopes](/reference/backend/http-api/api-keys#scopes).
</Info>

<Info>
  The response content depends on the API authentication type (e.g: OAuth 2, OAuth 1, API key, etc.).

  If you do not want to deal with collecting & injecting credentials in requests for multiple authentication types, use the [Proxy](/guides/platform/proxy-requests).
</Info>

<Tip>
  Every time you fetch the connection with this API endpoint, Nango will check if the access token has expired. If it has, it will refresh it.

  **We recommend you always fetch the token just before you use it to make sure it is fresh!**
</Tip>


## OpenAPI

````yaml GET /connection/{connectionId}
openapi: 3.1.0
info:
  title: Nango API
  description: Nango API specs used to authorize & sync data with external APIs.
  version: 1.0.0
servers:
  - url: https://api.nango.dev
    description: Production server
  - url: http://localhost:3003
    description: Local server
security:
  - bearerAuth: []
externalDocs:
  url: https://nango.dev/docs/reference/backend/http-api/authentication
paths:
  /connection/{connectionId}:
    get:
      summary: Get a connection (deprecated)
      description: >-
        Returns a specific connection with credentials. This endpoint is
        deprecated, use the /connections/{connectionId} endpoint instead.
      parameters:
        - name: connectionId
          in: path
          required: true
          schema:
            type: string
          description: The connection ID used to create the connection.
        - name: provider_config_key
          in: query
          required: true
          description: The integration ID used to create the connection (aka Unique Key).
          schema:
            type: string
        - name: force_refresh
          in: query
          description: >-
            If true, Nango will attempt to refresh the access access token
            regardless of its expiration status (false by default).
          schema:
            type: boolean
        - name: refresh_token
          in: query
          description: >-
            If true, return the refresh token as part of the response (false by
            default).
          schema:
            type: boolean
      responses:
        '200':
          description: Successfully returned a connection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionFull'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: Unknown Connection
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '424':
          description: Connection refresh exhausted
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: The error code
                      message:
                        type: string
                        description: A human-readable error message
components:
  schemas:
    ConnectionFull:
      type: object
      required:
        - id
        - connection_id
        - provider_config_key
        - provider
        - errors
        - metadata
        - connection_config
        - tags
        - created_at
        - updated_at
        - last_fetched_at
        - credentials
      properties:
        id:
          type: integer
        connection_id:
          type: string
        provider_config_key:
          type: string
        provider:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ConnectionError'
        end_user:
          deprecated: true
          anyOf:
            - $ref: '#/components/schemas/ConnectionEndUser'
            - type: 'null'
        metadata:
          type: object
          additionalProperties: true
        connection_config:
          type: object
          additionalProperties: true
        tags:
          $ref: '#/components/schemas/Tags'
        created_at:
          type: string
        updated_at:
          type: string
        last_fetched_at:
          type: string
        credentials:
          $ref: '#/components/schemas/AllAuthCredentials'
    ConnectionError:
      type: object
      required:
        - type
        - log_id
      properties:
        type:
          type: string
          enum:
            - auth
            - sync
          example: auth
        log_id:
          type: string
          example: VrnbtykXJFckCm3HP93t
    ConnectionEndUser:
      type: object
      deprecated: true
      required:
        - id
      properties:
        id:
          type: string
          description: Uniquely identifies the end user.
          deprecated: true
        email:
          anyOf:
            - type: string
            - type: 'null'
          deprecated: true
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          deprecated: true
        tags:
          type: object
          additionalProperties: true
          description: >-
            Tags associated with the end user. Only accepts strings values, up
            to 64 keys.
          deprecated: true
        organization:
          deprecated: true
          anyOf:
            - type: object
              required:
                - id
              properties:
                id:
                  type: string
                  description: Uniquely identifies the organization the end user belongs to
                display_name:
                  anyOf:
                    - type: string
                    - type: 'null'
            - type: 'null'
    Tags:
      type: object
      description: Connection tags (key/value strings). Keys are normalized to lowercase.
      maxProperties: 10
      additionalProperties:
        type: string
        maxLength: 255
    AllAuthCredentials:
      anyOf:
        - $ref: '#/components/schemas/OAuth1CredentialsWithRaw'
        - $ref: '#/components/schemas/OAuth2CredentialsWithRaw'
        - $ref: '#/components/schemas/BasicApiCredentials'
        - $ref: '#/components/schemas/ApiKeyCredentials'
        - $ref: '#/components/schemas/AppCredentials'
        - $ref: '#/components/schemas/JwtCredentials'
        - $ref: '#/components/schemas/OAuth2ClientCredentialsWithRaw'
        - $ref: '#/components/schemas/AppStoreCredentialsWithRaw'
        - $ref: '#/components/schemas/UnauthCredentials'
        - $ref: '#/components/schemas/CustomCredentials'
        - $ref: '#/components/schemas/TbaCredentials'
        - $ref: '#/components/schemas/BillCredentialsWithRaw'
        - $ref: '#/components/schemas/TwoStepCredentials'
        - $ref: '#/components/schemas/SignatureCredentials'
    OAuth1CredentialsWithRaw:
      title: OAuth1
      allOf:
        - $ref: '#/components/schemas/OAuth1Credentials'
        - type: object
          additionalProperties: false
          required:
            - raw
          properties:
            raw:
              type: object
    OAuth2CredentialsWithRaw:
      title: OAuth2
      allOf:
        - $ref: '#/components/schemas/OAuth2Credentials'
        - type: object
          additionalProperties: false
          required:
            - raw
          properties:
            raw:
              type: object
    BasicApiCredentials:
      type: object
      title: Basic Auth
      additionalProperties: false
      properties:
        password:
          type: string
        type:
          enum:
            - BASIC
          type: string
        username:
          type: string
      required:
        - type
        - username
        - password
    ApiKeyCredentials:
      type: object
      title: Api Key
      additionalProperties: false
      properties:
        apiKey:
          type: string
        type:
          type: string
          enum:
            - API_KEY
      required:
        - type
        - apiKey
    AppCredentials:
      type: object
      title: GitHub App
      additionalProperties: false
      properties:
        access_token:
          type: string
        expires_at:
          type: string
          format: date-time
        raw:
          type: object
        type:
          type: string
          enum:
            - APP
      required:
        - type
        - access_token
        - raw
    JwtCredentials:
      type: object
      title: JWT
      additionalProperties: false
      properties:
        expires_at:
          type: string
          format: date-time
        issuerId:
          type: string
        privateKey:
          anyOf:
            - additionalProperties: false
              properties:
                id:
                  type: string
                secret:
                  type: string
              required:
                - id
                - secret
              type: object
            - type: string
        privateKeyId:
          type: string
        token:
          type: string
        type:
          type: string
          enum:
            - JWT
      required:
        - type
        - privateKey
    OAuth2ClientCredentialsWithRaw:
      title: OAuth2 Client
      allOf:
        - $ref: '#/components/schemas/OAuth2ClientCredentials'
        - type: object
          additionalProperties: false
          required:
            - raw
          properties:
            raw:
              type: object
    AppStoreCredentialsWithRaw:
      title: App Store
      allOf:
        - $ref: '#/components/schemas/AppStoreCredentials'
        - type: object
          additionalProperties: false
          required:
            - raw
          properties:
            raw:
              type: object
    UnauthCredentials:
      type: object
      title: Unauthenticated
      additionalProperties: false
    CustomCredentials:
      type: object
      title: Custom
      additionalProperties: false
      properties:
        raw:
          type: object
        type:
          type: string
          enum:
            - CUSTOM
      required:
        - raw
        - type
    TbaCredentials:
      type: object
      title: TBA
      additionalProperties: false
      properties:
        config_override:
          additionalProperties: false
          properties:
            client_id:
              type: string
            client_secret:
              type: string
          type: object
        token_id:
          type: string
        token_secret:
          type: string
        type:
          type: string
          enum:
            - TBA
      required:
        - type
        - token_id
        - token_secret
        - config_override
    BillCredentialsWithRaw:
      title: Bill
      allOf:
        - $ref: '#/components/schemas/BillCredentials'
        - type: object
          additionalProperties: false
          required:
            - raw
          properties:
            raw:
              type: object
    TwoStepCredentials:
      type: object
      title: Two Step
      additionalProperties: false
      properties:
        expires_at:
          type: string
          format: date-time
        raw:
          type: object
        token:
          type: string
        type:
          type: string
          enum:
            - TWO_STEP
      required:
        - raw
        - type
    SignatureCredentials:
      type: object
      title: Signature
      additionalProperties: false
      properties:
        expires_at:
          type: string
          format: date-time
        password:
          type: string
        token:
          type: string
        type:
          type: string
          enum:
            - SIGNATURE
        username:
          type: string
      required:
        - type
        - username
        - password
    OAuth1Credentials:
      type: object
      title: OAuth1
      additionalProperties: false
      properties:
        oauth_token:
          type: string
        oauth_token_secret:
          type: string
        type:
          enum:
            - OAUTH1
          type: string
      required:
        - oauth_token
        - oauth_token_secret
        - type
    OAuth2Credentials:
      type: object
      title: OAuth2
      additionalProperties: false
      properties:
        access_token:
          type: string
        config_override:
          additionalProperties: false
          properties:
            client_id:
              type: string
            client_secret:
              type: string
          type: object
        expires_at:
          type: string
          format: date-time
        refresh_token:
          type: string
        type:
          enum:
            - OAUTH2
          type: string
      required:
        - access_token
        - type
    OAuth2ClientCredentials:
      type: object
      title: OAuth2 Client
      additionalProperties: false
      properties:
        client_id:
          type: string
        client_secret:
          type: string
        expires_at:
          type: string
          format: date-time
        token:
          type: string
        type:
          type: string
          enum:
            - OAUTH2_CC
      required:
        - client_id
        - client_secret
        - token
        - type
    AppStoreCredentials:
      type: object
      title: App Store
      additionalProperties: false
      properties:
        access_token:
          type: string
        expires_at:
          type: string
          format: date-time
        private_key:
          type: string
        type:
          type: string
          enum:
            - APP_STORE
      required:
        - access_token
        - private_key
    BillCredentials:
      type: object
      title: Bill
      additionalProperties: false
      properties:
        dev_key:
          type: string
        expires_at:
          type: string
          format: date-time
        organization_id:
          type: string
        password:
          type: string
        session_id:
          type: string
        type:
          type: string
          enum:
            - BILL
        user_id:
          type: string
        username:
          type: string
      required:
        - dev_key
        - organization_id
        - password
        - raw
        - type
        - username
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: The secret key from your Nango environment.

````