POST
/
connection

When to use

Use this API endpoint to import existing access tokens into Nango. It is mostly meant for one-off import scripts.

To trigger OAuth flows with Nango, use the Nango frontend SDK.

Request body

You can use this endpoint to import OAuth 2, OAuth 1, API Keys, and Basic auth credentials.

The required fields depend on the type of authentication of the connections you are trying to import.

Body

application/json
connection_id
string
required

The connection ID used to create the connection.

provider_config_key
string
required

The integration ID that you created on Nango.

access_token
string

(OAuth 2, required) Existing access token.

refresh_token
string

(OAuth 2, optional) Pass the refresh token if you have it.

expires_at
string

(OAuth 2, optional) Safer and preferred.

expires_in
integer

(OAuth 2, optional) In seconds.

no_expiration
boolean

(OAuth2, optional) If the provider gives access tokens that don't expire, pass in true to avoid an import validation error.

oauth_token
string

(OAuth 1, required) The client token to be attached to the connection.

oauth_token_secret
string

(OAuth 1, required) The client token secret to be attached to the connection.

metadata
object

(OAuth, required for some APIs) Metadata to be attached to the connection.

connection_config
object

(OAuth, required for some APIs) Additional configuration to be attached to the connection.

username
string

(Basic, required) username to be attached to the connection.

password
string

(Basic, required) password to be attached to the connection.

api_key
string

(API Key, required) API key to be attached to the connection.