generateRoutePlan
Requires permission visits:journey-plan:manage.
Generates a route plan for one sales rep over a cycle of days from a start date, grouping their customers by location and visit cadence. The caller needs authority over that rep. Requires permission to manage journey plans.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation GenerateRoutePlan($input: GenerateRoutePlanInput!) {
generateRoutePlan(input: $input) {
deferred {
id
name
customerTierName
customerTier
lastVisitedAt
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation GenerateRoutePlan($input: GenerateRoutePlanInput!) {\n generateRoutePlan(input: $input) {\n deferred {\n id\n name\n customerTierName\n customerTier\n lastVisitedAt\n }\n }\n}",
"variables": {
"input": {
"cycleLengthDays": 0,
"cycleStartDate": "2025-01-15T00:00:00Z",
"salesRepId": "string"
}
}
}
EOF
Variables:
{
"input": {
"cycleLengthDays": 0,
"cycleStartDate": "2025-01-15T00:00:00Z",
"salesRepId": "string"
}
}
Response:
{
"data": {
"generateRoutePlan": {
"deferred": [
{
"id": "id",
"name": "string",
"customerTierName": "string",
"customerTier": "string",
"lastVisitedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
generateRoutePlan(
input: GenerateRoutePlanInput!
): GenerateRoutePlanResult!
Arguments
generateRoutePlan.input ● GenerateRoutePlanInput! non-null input
The rep, the cycle length in days, the cycle start date and whether to include Sundays.
Type
GenerateRoutePlanResult object
The route plans created or updated, and the customers who did not fit.