POST
/
connection
curl --request POST \
  --url https://api.nango.dev/connection \
  --header 'Content-Type: application/json' \
  --data '{
  "connection_id": "<string>",
  "provider_config_key": "<string>",
  "access_token": "<string>",
  "refresh_token": "<string>",
  "expires_at": "2023-12-25",
  "expires_in": 123,
  "no_expiration": true,
  "oauth_client_id_override": "<string>",
  "oauth_client_secret_override": "<string>",
  "oauth_token": "<string>",
  "oauth_token_secret": "<string>",
  "metadata": {},
  "connection_config": {},
  "username": "<string>",
  "password": "<string>",
  "api_key": "<string>"
}'
This response has no body data.

When to use

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

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_client_id_override
string

(OAuth2, optional) Override the integration's OAuth client id

oauth_client_secret_override
string

(OAuth2, optional) Override the integration's OAuth client secret

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.