Skip to main content
Documentation

Scheduling

scheduling.suggest_slots

Rank the best slot for a job across bays, installers and margin
Read-onlyExpensive budget

REST

Shipping
POST /api/v1/scheduling/suggest_slots

MCP tool

Live
scheduling.suggest_slots

Exposed on: REST API · Shop MCP server · Claude connector · Dash (in-app copilot) · Zapier. Part of the Scheduling domain.

Operating contract

Runs the shop's own scheduling agent over one job and returns the best places to put it, best first. Each suggestion names a bay, an installer, a start and an end, and carries the projected economics of booking it there — revenue, material cost, labour cost and margin.

THIS PROPOSES; IT DOES NOT BOOK. Take the start off the suggestion you want and pass it to jobs.schedule. There is deliberately no apply capability: two ways to put a car in a bay is how one of them stops sending the customer their confirmation.

reasons is why the agent liked a slot and warnings is what to check before taking it — a thin margin, a cure hold running past closing, a drive it is tight for. Read the warnings out; they are the half a shop owner would have spotted themselves.

confidence is 0-100 and it is about the DATA, not the slot: a low number usually means the job has no priced services or the shop has no pay terms on file, so the margin figures are guesses. Do not quote a margin from a low-confidence suggestion.

MARGIN AND COST ARE STAFF-ONLY. They are the shop's own economics — never repeat them to a customer, and never put them in a message.

blocked_reason set with an empty list is a real answer and the useful one: it says WHY nothing fits — no priced services on the job, no capable bay, nobody certified available — and each of those has a different fix.

TRUNCATION: at most limit suggestions come back and omitted says how many further ranked slots were found. When it is not 0, the extras are lower-ranked rather than hidden; raise limit only if the top ones are all unsuitable.

Who may call it

Permission
shop.manageThe caller must hold shop.manage at the ACT level. A read-only dashboard grant on the same section is refused.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
expensiveCounted against the expensive budget — a model call, a document render or a fan-out scan.

Partial answers

omitted is how many matching records are not in the response, and 0 is a real answer meaning you have all of them. There is no cursor here — narrow the filter instead.

Do not summarise from a truncated response

When `omitted` is not 0 the ranker found more slots than were returned. They are lower-ranked, not hidden — raise `limit` only if none of the top ones will do.

Input

FieldTypeDescription
job_idrequiredstringuuid

The job to place, as returned by jobs.list or calendar.unscheduled.

limitinteger1–20

How many ranked slots to return, 1-20. Defaults to 6.

Default: 6

Output

FieldTypeDescription
job_idstring

blocked_reasonstring | null

best_marginnumber | null

itemsobject[]

items[].ranknumber

items[].station_idstring

items[].station_namestring

items[].staff_profile_idstring | null

items[].staff_namestring | null

items[].startstring

items[].endstring

items[].duration_minutesnumber

items[].cure_minutesnumber

items[].days_outnumber

items[].revenuenumber

items[].material_costnumber

items[].labor_costnumber

items[].marginnumber

items[].margin_pctnumber

items[].confidencenumber

items[].reasonsstring[]

items[].warningsstring[]

omittednumber

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/scheduling/suggest_slots \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id":"9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20","limit":6}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/scheduling/suggest_slots", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "job_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
    "limit": 6
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/scheduling/suggest_slots",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "job_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
    "limit": 6
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "scheduling.suggest_slots",
    "arguments": {
      "job_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
      "limit": 6
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
403forbiddenThis login does not hold shop.manage.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many expensive calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.