Create redirect link
Create redirect link
POST /api/v1/companies/{companyId}/users/{userId}/redirects/web-app
The Redirects API lets your integration hand an already-authenticated user off to the Repset web app without asking them to log in again. You call the endpoint with the user’s companyId and userId, optionally tell it which page to land on, and get back a one-time URL you redirect the browser to.
One-time and short-lived
redirectUrl is single-use and expires after expiresIn seconds — generate a fresh one for every redirect.
Using the redirect
Request a Redirect URL, then open it in a new tab, an iframe, etc.
redirect-new-tab-example.js
const res = await fetch(
`/api/v1/companies/${companyId}/users/${userId}/redirects/web-app`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
target: "program.edit",
params: { programId },
appearance: { theme: "repset" },
}),
},
);
const { redirectUrl } = await res.json();
// Open Repset logged in, in whatever context you like
window.open(redirectUrl, "_blank", "noopener");
Specifying page
Set target and matching params in the request body to open a specific page within Repset.
E.g. useful for opening program editor with customer context.
New program
New program with customer
New program from template
Edit program
Customer list
Customer preview
Settings
{
"target": "program.new"
}
{
"target": "program.new",
"params": { "customerId": "9d3f1a2b-4c5d-4e6f-8a9b-0c1d2e3f4a5b" }
}
{
"target": "program.new",
"params": { "templateId": "1a2b3c4d-5e6f-4a5b-8c9d-0e1f2a3b4c5d" }
}
{
"target": "program.edit",
"params": { "programId": "5c9d3b1a-1e2f-4a3b-9c1d-0a1b2c3d4e5f" }
}
{
"target": "customer.list"
}
{
"target": "customer.preview",
"params": { "customerId": "9d3f1a2b-4c5d-4e6f-8a9b-0c1d2e3f4a5b" }
}
{
"target": "settings",
"params": { "tab": "billing" }
}
Specifying theme
request body
// Forces Repset to use light mode. This is not persisted on the user and is only
// used to match your application's theme, so it does not affect the user's saved
// theme preference.
{
"appearance": { "theme": "light" }
}