upsertJourneyPlan
Requires permission visits:journey-plan:manage.
Replaces a sales rep's route for one day. Stops are matched by customer: kept stops are re-ordered, new stops are added as planned visits, and removed stops are deleted. A stop that already has a check-in cannot be removed, and the whole change is refused. The rep must belong to the organization. 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 UpsertJourneyPlan($input: UpsertJourneyPlanInput!) {
upsertJourneyPlan(input: $input) {
id
salesRepName
createdAt
notes
planDate
salesRepId
visits {
id
partnerName
status
createdAt
completedAt
hasUnreadMessage
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation UpsertJourneyPlan($input: UpsertJourneyPlanInput!) {\n upsertJourneyPlan(input: $input) {\n id\n salesRepName\n createdAt\n notes\n planDate\n salesRepId\n visits {\n id\n partnerName\n status\n createdAt\n completedAt\n hasUnreadMessage\n }\n }\n}",
"variables": {
"input": {
"planDate": "2025-01-15T00:00:00Z",
"salesRepId": "string",
"visits": [
{
"partnerId": "string",
"sequence": 0
}
]
}
}
}
EOF
Variables:
{
"input": {
"planDate": "2025-01-15T00:00:00Z",
"salesRepId": "string",
"visits": [
{
"partnerId": "string",
"sequence": 0
}
]
}
}
Response:
{
"data": {
"upsertJourneyPlan": {
"id": "id",
"salesRepName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"notes": "string",
"planDate": "2025-01-15T00:00:00Z",
"salesRepId": "string",
"visits": [
{
"id": "id",
"partnerName": "string",
"status": "CANCELLED",
"createdAt": "2025-01-15T00:00:00Z",
"completedAt": "2025-01-15T00:00:00Z",
"hasUnreadMessage": true
}
]
}
}
}
upsertJourneyPlan(
input: UpsertJourneyPlanInput!
): JourneyPlan!
Arguments
upsertJourneyPlan.input ● UpsertJourneyPlanInput! non-null input
The rep, the day, optional notes and the list of stops.
Type
JourneyPlan object
A rep's plan for one day: the stops they will visit.