Evaluate Routing Form
Submit the visitor’s answers and get the routing result — which event type to book or where to redirect.
Endpoint
POST /api/public/routing/{userSlug}/{formSlug}/evaluateAuthentication: None required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
userSlug | string | The user’s unique URL slug |
formSlug | string | The routing form’s URL slug |
Request Body
{
"answers": {
"field_company_size": "opt_3",
"field_topic": "opt_a",
"field_email": "alex@example.com"
}
}Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
answers | object | Yes | Map of field IDs to answer values. For select fields, the value is the selected option’s id. For text fields, the value is the entered text. |
Response
Returns 200 OK with the routing result.
Route to Event Type
{
"action": "routeToEvent",
"eventTypeSlug": "enterprise-demo",
"eventTypeName": "Enterprise Demo (45 min)",
"message": null
}Redirect to URL
{
"action": "redirect",
"redirectUrl": "https://support.proximity.io/billing",
"message": null
}Show Message
{
"action": "message",
"message": "Thanks for your interest! We'll reach out to schedule a call.",
"redirectUrl": null
}Response Fields
| Field | Type | Description |
|---|---|---|
action | string | Result action: routeToEvent, redirect, or message |
eventTypeSlug | string | null | Event type to route to (when action is routeToEvent) |
eventTypeName | string | null | Human-readable name of the event type |
redirectUrl | string | null | URL to redirect to (when action is redirect) |
message | string | null | Message to display (when action is message) |
Handling the Result
After evaluation, take action based on the action field:
const result = await evaluateForm(answers);
switch (result.action) {
case 'routeToEvent':
// Navigate to the booking page for this event type
window.location.href = `/schedule/${userSlug}/${result.eventTypeSlug}`;
break;
case 'redirect':
// Redirect to the external URL
window.location.href = result.redirectUrl;
break;
case 'message':
// Show the message to the visitor
showSuccessMessage(result.message);
break;
}Errors
| Status | Description |
|---|---|
400 | Missing required fields or invalid answer values |
404 | User or routing form not found |
Code Examples
cURL
curl -X POST https://app.proximity.io/api/public/routing/jane-doe/book-a-meeting/evaluate \
-H "Content-Type: application/json" \
-d '{
"answers": {
"field_company_size": "opt_3",
"field_topic": "opt_a",
"field_email": "alex@example.com"
}
}'JavaScript
const response = await fetch(
'https://app.proximity.io/api/public/routing/jane-doe/book-a-meeting/evaluate',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
answers: {
field_company_size: 'opt_3',
field_topic: 'opt_a',
field_email: 'alex@example.com',
},
}),
}
);
const result = await response.json();
console.log(`Action: ${result.action}`);Python
import requests
response = requests.post(
"https://app.proximity.io/api/public/routing/jane-doe/book-a-meeting/evaluate",
json={
"answers": {
"field_company_size": "opt_3",
"field_topic": "opt_a",
"field_email": "alex@example.com",
}
},
)
result = response.json()
print(f"Action: {result['action']}")Last updated on