Connections
Get a Connection
GET

/connection/{connectionId}

Bearer*
curl --request GET \
  --url https://api.nango.dev/connection/{connectionId} \
  --header 'Authorization: Bearer <token>'
{
  id: 18393,                                  // Nango internal connection id
  created_at: '2023-03-08T09:43:03.725Z',     // Creation timestamp
  updated_at: '2023-03-08T09:43:03.725Z',     // Last updated timestamp (e.g. last token refresh)
  provider_config_key: 'github',              // <INTEGRATION-ID>
  connection_id: '1',                         // <CONNECTION-ID>
  credentials: {
      type: 'OAUTH2',                         // OAUTH2 or OAUTH1
      access_token: 'gho_tsXLG73f....',       // The current access token (refreshed if needed)
      refresh_token: 'gho_fjofu84u9....',     // Refresh token (Only returned if the REFRESH_TOKEN boolean parameter is set to true and the refresh token is available)
      expires_at: '2024-03-08T09:43:03.725Z', // Expiration date of access token (only if refresh token is present, otherwise missing)
      raw: {                                  // Raw token response from the OAuth provider: Contents vary!
          access_token: 'gho_tsXLG73f....',
          refresh_token: 'gho_fjofu84u9....', // Refresh token (Only returned if the REFRESH_TOKEN boolean parameter is set to true and the refresh token is available)
          token_type: 'bearer',
          scope: 'public_repo,user'
      }
  },
  connection_config: {},                      // Additional configuration, see Frontend SDK reference
  account_id: 0,                              // ID of your Nango account (Nango Cloud only)
  "metadata": {                               // Structured metadata retrieved by Nango
      realmId: "XXXXX",
      instance_id: "YYYYYYY"
  }
}                              

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!

Path Parameters

connectionIdrequired
string

The Connection ID used to create the Connection.

Query Parameters

provider_config_keyrequired
string

The Integration ID used to create the Connection (aka Unique Key).

force_refresh
boolean

If true, Nango will attempt to refresh the access access token regardless of its expiration status (false by default).

refresh_token
boolean

If true, return the refresh token as part of the response (false by default).