GuidesAPI ReferenceChangelog
Log In
Guides

Getting Started

Create a Link Token

In order to initialize Pinwheel Link, your server side code will need to generate a short-lived Link token by sending a POST request to the /link_tokens endpoint. Link tokens are intended to be single-use and expire after one hour. Your server should generate a new Link token each time you wish to launch Pinwheel Link.

❗️

Keep your secrets a secret

Make sure to keep your API secrets secure! You should avoid storing or using API secrets in client-side code, GitHub, or other non-secure spots.

Request

POST /v1/link_tokens
Host: api.getpinwheel.com
Content-Type: application/json
x-api-secret: YOUR-API-SECRET
{
  "org_name": "YOUR APP NAME",
  "required_jobs": ["employment", "income"],
  "end_user_id": "YOUR INTERNAL ID FOR THIS USER"
}

Response

{
  "data": {
    "mode": "production",
    "id": "97f420ff-5d0a-46ee-9cfc-6f17d5d31256",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGci...cyldX8fILelb6A0XKmdWsXZHMH4W1o",
    "expires": "2021-01-09T02:52:26+00:00"
  }
}

📘

Info

The id returned here is identical to the link_token_id included with webhooks, and should be stored accordingly. The end_user_id you provide in this request is also included in any subsequent webhooks events. You can find recommendations for storing identifiers here.

Initialize Modal

The following initialization parameters are available on all SDKs. Please consult the documentation for the SDK you plan to use.

ParameterDescription
linkTokenThe Link token created using the /link_tokens endpoint.
onLogin(payload)Optional. Callback to handle the login event.
onSuccess(payload)Optional. Callback to handle the success event.
onError(payload)Optional. Callback to handle the error event.
onExit(error?)Optional. Callback to handle the exit event. Fires with an error type payload if an error occurred before exit.
onEvent(eventName, payload)Optional. Callback to handle the any event.

Please contact [email protected] for access to our Dashboard.