Skip to main content

Customer Portal Access Token

Returns a short-lived token that signs a customer in to the Customer Portal iframe. Call it from your server each time you render the portal.

Request​

curl -X GET '{api_host}/tokens/{email}/ucp' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

URL-encode the email, for example jane%2Bllc%40example.com for [email protected].

Response​

{
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...",
"partner_id": 1234
},
"success": true
}

Request parameters​

ParameterTypeDescriptionValidation
emailString (path)The customer's email.Must belong to a customer with at least one order placed through your partner account.

Response parameters​

ParameterTypeDescriptionPresence
tokenStringToken for the iframe URL's id parameter.Always
partner_idIntegerYour partner identifier, for the iframe URL's partner-id parameter.Always

Token lifetime​

  • Tokens expire after a short time. Request a new one every time you render the iframe, and don't store it.
  • Each new token replaces the customer's previous one. This also happens when the customer signs in to SwyftFilings directly, or when SwyftFilings support opens their account. A portal that is already open keeps working until its session expires. A new iframe built from an old token fails.
  • Keep the token on your page only as part of the iframe URL. Don't log it or send it to analytics.

Errors​

StatusWhenWhat to do
401Your access token is missing or expired.Log in again with POST /auth/login and retry.
422No user has this email, or the user isn't one of your customers. The error is reported under the email or customer_uuid key, with the message User is not associated with partner.Check the email, and that the customer has an order placed through your partner account.
500The token couldn't be created.Retry. If it keeps failing, contact SwyftFilings.