Skip to main content
Version: v0.2b

Creating a Plan and importing Stops

Here we will be using the Plan Create and the Stops Batch Import endpoints to create a Plan for a day and import Stops into that Plan. Read their descriptions to see all the available options.

# First create a plan for a specific day. Here we create one named "Test" for
# the day 2023-05-31. Do not include the <> signs in the api key
curl https://api.getcircuit.com/public/v0.2b/plans \
-d '{"title": "Test", "starts": {"day":31, "month": 5, "year": 2023}}' \
-H 'Content-Type: application/json' \
-u <your-api-key>:

# This will return a response similar to the following:
# {
# "id": "plans/FQ95Ex714KYeojkeIm77",
# "title": "Test",
# "starts": {
# "day": 31,
# "month": 5,
# "year": 2023
# },
# "depot": null,
# "distributed": false,
# "writable": true,
# "optimization": "creating",
# "drivers": [],
# "routes": []
# }

# Now, with the returned ID, you can add stops to this plan (notice the plan id
# in the url):
curl https://api.getcircuit.com/public/v0.2b/plans/FQ95Ex714KYeojkeIm77/stops:import \
-d'[
{
"address": {
"addressLineOne": "Some address"
}
},
{
"address": {
"addressLineOne": "Some other address"
}
}
]' \
-H 'Content-Type: application/json' \
-u <your-api-key>:

# With proper addresses the above requests will return a response similar to the
# following:
# {
# "success": [
# "plans/FQ95Ex714KYeojkeIm77/stops/vgsTiQi85ueWRs1JnXx7",
# "plans/FQ95Ex714KYeojkeIm77/stops/q0HUM8SwBPt8n3pYZOeO"
# ],
# "failed": []
# }

# If you wish to retrieve more information about one of the create stops you can
# issue a GET request for it:
curl https://api.getcircuit.com/public/v0.2b/plans/FQ95Ex714KYeojkeIm77/stops/vgsTiQi85ueWRs1JnXx7 \
-u <your-api-key>: