Quote, create, track
Get a quote, create the job, then poll it until the status reads dropoff_complete.
const base = "https://api.sandbox.serverobotics.com/v2/partners/YOUR_ID";
const headers = { "X-API-Key": process.env.SERVE_KEY,
"Content-Type": "application/json" };
const call = (path, body) => fetch(base + path, {
method: body ? "POST" : "GET", headers,
body: body && JSON.stringify(body),
}).then(r => r.json());
// 1. Quote: Market Ave & Birch St → Pier Ave & Fig St
const trip = {
pickup: { location: { lat: 37.4865, lng: -122.2090 } },
dropoff: { location: { lat: 37.4891, lng: -122.2041 } },
};
const quote = await call("/quotes", trip);
// 2. Create the job from the quote
const job = await call("/jobs", { ...trip, quote_id: quote.quote_id });
// 3. Track it to the curb
let status;
do {
await new Promise(r => setTimeout(r, 5000));
({ status } = await call(`/jobs/${job.delivery_id}`));
} while (status !== "dropoff_complete");






