---
title: Trigger a KYB journey with redirect
slug: detected-apis/trigger-a-kyb-journey-with-redirect
createdAt: 2025-09-16T11:18:22.139Z
---

## Overview

This is a common flow for triggering a KYB flow from an external system,&#x20;

The clients system will gather basic information on the company, push that data to Detected and then launch the onboarding journey powered by the Detected portal.

The API flow is:

- Get search results based on a users search for a company
- After showing those back to the user send the selected company to Detected
- Create the user as a 'profile user' in Detected
- Assign that profile user to the profile
- Get the pre-authed link to the profile for that user
- Redirect the user to that link or surface in an iFrame
- Listen for the webhook to confirm the profile has been submitted

```mermaid
---
config:
  theme: redux-dark
  look: classic
---
sequenceDiagram
  participant ClientBackend as Clients Backend App
  participant DetectedApis as Detected APIs
    Note over ClientBackend, DetectedApis: Authorisation
  ClientBackend ->> DetectedApis: POST /oauth/token
  DetectedApis -->> ClientBackend: Auth token
  Note over ClientBackend, DetectedApis: Add company using search
  ClientBackend ->> DetectedApis: POST /search
  DetectedApis -->> ClientBackend: Search results
  ClientBackend ->> DetectedApis: POST /profiles
    DetectedApis -->> ClientBackend: Profile references
  Note over ClientBackend, DetectedApis: Add profile user & assign to profile
  ClientBackend ->> DetectedApis: POST /portal-users
DetectedApis -->> ClientBackend: Portal user references
alt If portal user already exists
    ClientBackend ->> DetectedApis: GET /portal-users?email={usersemail}
    DetectedApis -->> ClientBackend: Portal user references
end

  ClientBackend ->> DetectedApis: PUT /profiles/{uuid}/portal-users
    DetectedApis -->> ClientBackend: Success
  Note over ClientBackend, DetectedApis: Get Authed link to redirect user
  ClientBackend ->> DetectedApis: POST /portal-users/{userId}/login-links
  DetectedApis -->> ClientBackend: Pre-authed link for this user to access this profile
  Note left of ClientBackend: Surface this in <br/> an iframe or redirect the user
  Note over ClientBackend, DetectedApis: Listen for webhook for when the onboarding is submitted
DetectedApis ->> ClientBackend: Profile webhook
```

