Some providers (e.g., Garmin, Fitbit) require the user to grant consent before Spike API can access their data. Redirect the user to the provider’s consent page using a URL obtained via the API.

Step 1: Configure Redirect URL in Admin Console

To configure the redirect URL in the admin console, navigate to the “Applications” section and locate the “Redirect URLs” option within your application. Here, you can either specify a default redirect URL or add multiple domains to whitelist which would allow you to define your own redirect URL during the integration process.

Step 2: Obtain Redirect URL

When you want to initiate the integration process for an end user, you can use the following endpoint to obtain a redirect URL for a specific provider.

Query arguments

  • (Optional) redirect_uri URI to redirect the end user after integration is complete, domain must be whitelisted in the admin console.
  • (Optional) state an arbitrary string that would be returned to you after integration is complete.
  • (Optional) provider_user_id an id of application users at specific provider. For e.g. Ultrahuman requires to pass email.

Example Request

curl -X GET https://app-api.spikeapi.com/v3/providers/fitbit/integration/init_url -H 'Authorization: Bearer <access_token>

Example Response

{
    "provider_slug": "fitbit",
    "path": "https://app-api.spikeapi.com/v3/providers/fitbit/integration/init/ic/la54yZgBJYlokLDHjh_NRpR6HOfFxkGKwEdRWL93gE0DnqBBqGded5SIcdZVAEdLDO-bGYheFBxZly9Q"
}

Redirect the User

Redirect the user to the path URL provided in the response. This allows them to authorize data access. Once the user is integrated they would be redirected back to your application either using the default redirect URL or using the redirect_uri provided in your request to the API.