Parameters
The link carries these parameters and, besides them, onlylang, which is optional and outside the signature. An unknown or repeated parameter makes the link invalid.
Leave out an optional parameter you do not use. An empty parameter makes the link invalid. No value can contain a line break.
The first valid link creates the customer project, if it does not exist yet.
The signature
signature is an HMAC-SHA256, in lowercase hexadecimal, with your signing secret as the key, computed over this string and nothing else:
- The first line is the fixed label
routa-partner-link-v1. Each following line isname=valuefor every parameter you send, exceptsignature. - The names are in ascending byte order (
external_ref,name,partner_id,redirect_url,state,ts), separated by a single\n, with no trailing line break. - The values are the decoded strings, exactly what you put in the link, before any URL encoding.
The SDK’s
buildOnboardingLink is a pure function: it makes no requests and validates the parameters locally. That matters, because Routa answers every invalid link with the same message, without saying why. The SDK is the only place where you find out why a value would be refused. It is marked as experimental.Page language
The connect page exists in Portuguese and in English. To choose the language, addlang to the link you already signed:
Node.js (SDK)
- The values are
pt-BRoren, written exactly like that. Any other value, such aspt_BRorpt, is ignored, and the link stays valid. langis not part of the signature. Do not include it in the signed string.- Without
lang, the page uses the language the person had already chosen on Routa or, without a choice, the browser’s first language: Portuguese for any variant of Portuguese, English for everything else. - Someone signed in to a Routa account sees the language of the account, even with
langin the link. - The person can switch the language on the page itself.
Validity
Routa accepts the link for 10 minutes afterts, and up to 60 seconds ahead of its own clock, to tolerate clock differences. Within that window, the customer can open the same link more than once.
Build the link when the customer clicks, not earlier. If it has to last longer, in an email for example, host your own redirector that signs on click.
The redirect_url origin
redirect_url must:
- use
https, with no username or password, spaces, control characters or backslash; - have a full origin (scheme, host and port) equal to an origin you registered in the dashboard.
Returning to your site
When the attempt ends, the customer’s browser is sent to yourredirect_url. Your own query string is preserved, and Routa adds:
If the page was opened with
window.open, it also posts the same fields to window.opener, addressed to the registered origin of your redirect_url, never to *:
error field uses these values:
No key, secret or provider credential appears in the URL or in the message.
When a link is refused
Every kind of bad link gets the same response: the customer sees “this link is not valid”, and so does anyone testing links. This includes:- an unknown
partner_idor a wrong signature; - a
tsoutside the window; - a
redirect_urlthat is nothttpsor is not on a registered origin; - a malformed, unknown or repeated parameter, except for
lang; - a plan without the Partner API.
- The signing secret in use. After a rotation, the old secret stays valid for 24 hours.
- The canonical string. Compare it with the test vectors below.
- Your server clock.
- The origins registered in the dashboard.
Test vectors
Use these two examples to check your implementation. The test secret isrt_psign_TESTVECTORSECRET0000000000000000000000.
Minimal. Parameters: partner_id=ptn_TestPartner0000000000, external_ref=lead_123, ts=1790000000.
signature = 0676f9f5ee8e76eff763defdac73798afd0b7cf165abb875356ef4f370ff524a
Complete. Adds name=Acme Ltda, redirect_url=https://partner.example/connected?x=1 and state=opaque:state/42.
signature = ff77d689a13e1057dda3b87e9f3f4e0788a98568d3022794ea6ecfc7c6dbb90c
Both values were computed with Node.js createHmac('sha256', secret) over the strings above.