Get Route by URL (Public)
/v1/kb/routeorg.permission.kb.readThe API key or user must hold at least one of them. Legacy roles still work; prefer the others for new keys.
Returns route matching the URL path of article or category.
Knowledge base routes
A route maps a URL path on your help center to an article or category, so old and custom links keep working. When a visitor opens a path that matches a route, the help center redirects them to the content's current address.
Every article and category already has a canonical help center address built from its slug and hash, such as /categories/shipping-rJ5Dz7bLL. A route adds another path for the same content. Routes are most useful after a migration: create one for each URL from your old help center, and existing bookmarks and search results still land on the right page. When the help center gets a path it doesn't recognize, it looks the path up and sends a 301 redirect to the canonical address. Routes belong to the org rather than to a single knowledge base. Deleting a route only removes the alias, not the content.
Fields
| Field | Meaning |
|---|---|
url |
The path to match, such as /hc/en-us/articles/360001234. Up to 1024 characters. |
routableType |
article or category. |
routableId |
The ID of the article or category. It must exist. |
pattern |
Optional. A regular expression that lets several routes share one path. |
position |
Optional. The order in which routes that share a path are tried. |
How a URL is matched
Kustomer normalizes the URL, then looks for a route with that exact url and no pattern. If there isn't one, it removes the query string and collects up to 100 routes for that base path, sorted by position.
- If the only route for the path has no
pattern, it matches whatever the query string is. - Otherwise, Kustomer tries each route's
patternin order against the path and query string, ignoring case. The first one that matches wins.
For example, an old help center that used /article.php?id=12 and /article.php?id=34 needs two routes with url /article.php, with patterns id=12$ and id=34$. Each combination of url and pattern must be unique, so a path can have only one route without a pattern. Kustomer rejects a duplicate.
Which endpoint to use
| To | Call |
|---|---|
Find out where a URL goes, with the target article or category in included |
GET /v1/kb/route, with url |
| List all routes, or the routes for one base path in match order | GET /v1/kb/routes, with url to filter |
| List the routes that point at an article or a category | GET /v1/kb/articles/{id}/routes or GET /v1/kb/categories/{id}/routes |
| Create a route to an article or category | POST /v1/kb/routes |
| Create a route to a specific category | POST /v1/kb/categories/{id}/routes |
| Read, change or delete a route | GET, PUT or DELETE /v1/kb/routes/{id} |
Creating a route fails with 404 if routableId doesn't match an existing article or category of routableType. Reads need a knowledge base read role, and writes need org.admin.kb.write or the matching permission.
Query parameters
URL path of article or category.
Responses
OK