Can I Provision an Instance with an Existing Refresh Token?

If you have an existing refresh token and you want to create a new instance without having to go through the authentication flow, it's possible to do so by making a POST /instances call and supplying the refresh token as part of your configurations. There's also one key field that is needed to make this happen. In your request body, you'll add "externalAuthentication": "initial". Essentially, this lets you bypass the authentication flow and proceed to provision an instance. When the refresh occurs, we'll update your access and refresh token accordingly.

 

curl -X POST \
 https://api.cloud-elements.com/elements/api-v2/instances \
 -H 'Authorization: Organization <ORG_SECRET>, User <USER_SECRET>' \
 -H 'Content-Type: application/json' \
 -H 'cache-control: no-cache' \
 -d '{
 "element": {
 "key": "<ELEMENT_KEY>"
 },
 "configuration": {
 "oauth.user.refresh_token": "<OAUTH_REFRESH_TOKEN>",
 "oauth.api.key": "<OAUTH_API_KEY>",
 "oauth.api.secret": "<OAUTH_API_SECRET>",
 "oauth.scope": "<OPTIONAL_SCOPE>"
 },
 "name": "Creating instance from refresh token",
 "externalAuthentication": "initial"
}'