Compare sleep and light schedules for a flight. PHASE returns the options that fit around the traveler's commitments and identifies the ones that overlap.
The sample returns two available options and two exclusions. Both excluded options use the 18:00–20:00 light window, which overlaps the 18:30–19:30 appointment (New York time).
Each excluded option has reason: INTERSECTS_LOCKED_BLOCK and conflict_refs: ["synthetic-evening-commitment"]. Match that ID to the appointment in hard_constraints.locked_blocks.
The local planner compares two wake times against the same airport transfer.
The alarm report
Ian McShane told Bevel that an alarm set for 7 am Pacific rang at 7 am Eastern after his phone switched time zones. He had expected it to ring at 10 am Eastern. Read Ian's report and Bevel's reply
Compare the two sleep records
In this fictional New York trip, the traveler has an airport transfer until 3 pm. The app sets a seven-hour sleep goal. The first record ends at 10 am. The corrected record ends at 7 am.
RecordSleep durationAvailable windows (New York time)
Initial7 hours11 pm to 7 am the next day
Corrected4 hours3–3:30 pm optional rest, plus the same overnight window
The app requested a 30-minute rest window. Download both requests and responses. The plan_update.previous_decision_id field links the second decision to the first.
A question for the sleep team
When a traveler corrects their wake time, which parts of the day's guidance does the app recalculate? Which plans does the traveler still adjust by hand?
Try a related case in the public API
The wake-time example above uses recorded output from the local planner. The public API compares hypothetical schedules. Run the schedule conflict example to see which options drop out when the traveler adds an appointment.
Developer guides
Morning plans after a return flight
Compare what fits after landing when the traveler logs seven hours of sleep on the flight, or only two.
This fictional trip fixes the airport transfer until 15:00 and the next morning’s work commitment, including preparation and travel, from 07:00 to 10:00. The traveler’s target sleep window is 23:00–08:00. All times shown in the table are destination local time (UTC in this example).
Compare the two results
In-flight sleep recorded
Optional rest on arrival day
Overnight sleep window
7 hours
No candidate returned
23:00–07:00
2 hours
15:00–15:30
23:00–07:00
The morning commitment caps both overnight windows at 07:00. With two hours of recorded sleep, the planner finds room for a 30-minute optional rest after the transfer. The seven-hour goal and the rest duration are caller inputs for this example.
Requests and responses
These responses were generated by the local POST /v0/phase/return-sleep-decisions evaluator. The example compares calendar availability under the supplied inputs.
If the car nap ends at 16:50 instead of 15:30, can bedtime still start at 18:10?
On the return flight to Denver, Ceddie planned a short car nap followed by bed at 18:10. Frank also described how a late drive could push bedtime back. This example uses that target with two fictional nap end times, a sample awake-time range and a fictional family commitment. Read Frank’s trip report.
Run the three requests
Download the runnable Python example (.zip). Unzip it, open a terminal in the folder containing demo.py, and run it with Python 3.9 or newer. It sends three requests to a local server and prints the results. It runs offline without an API key.
python3 demo.py
Compare the bedtime starts
Nap ended
Caregiver busy
Bedtime start
Shift from 18:10
15:30
—
18:10
0 min
16:50
—
19:20
+70 min
16:50
19:10–19:40
19:40
+90 min
All times are local to Denver. Only nap_end_at changes between the first two requests. With the sample rule of 150–210 minutes awake, a nap ending at 15:30 allows a bedtime start from 18:00 to 19:00. A nap ending at 16:50 moves the window to 19:20–20:20. In the third request, the caregiver can start at 19:40 when the commitment ends.
Try a different nap
Open late-nap.json and change nap_end_at from 2026-10-23T16:50:00-06:00 to 2026-10-23T16:00:00-06:00. Keep the other fields fixed and run the command below. The earliest start becomes 18:30, 20 minutes after the target.
python3 demo.py late-nap.json
To compare your app’s own policy, replace min_awake_minutes and max_awake_minutes. To call the endpoint from your app, see the bedtime options API reference.
Knowledge Base
Find options that overlap an appointment
Keep the flight and in-flight sleep duration fixed. Add one evening appointment.
Add an evening appointment
The sample flight from Los Angeles to New York allows a three-hour sleep period early or late in the flight. For each placement, PHASE tests a 6–8 pm light exposure window and a dim-light alternative.
conflict_refs identifies the commitment in the request. Use that ID to display the appointment's name in your app.
API Reference
API reference
Compare sleep and light schedules in the hosted preview, or evaluate bedtime starts on your own machine.
Choose an endpoint
Sleep and light options compares hypothetical travel schedules on the hosted API with a preview key.
Bedtime options evaluates an observed nap against your app’s timing rules. Download and run the local API without a key.
Hosted preview base URL
https://phase.bd360.co
Authentication
POST /v0/phase/preview-keys accepts an empty JSON object and returns a key. Save the key from this response. It expires after 24 hours. Get a key and send a request
Each key allows 6 simulations per minute and 30 per UTC day. The daily limit is also 30 per IP and 200 across the service. Each IP can request up to 3 keys per UTC day.
The browser example gets a temporary key when you run it. The key stays in page memory.
Can I submit an observed wake time?
The public API accepts hypothetical sleep schedules and fixed commitments. For an observed wake-time correction, the Bevel example includes both local planner requests and their responses.
API Reference
Compare sleep and light options
Edit the sample itinerary and run it against the public endpoint.
POST/v0/phase/sleep-light-options
Request body
metadata.mode must be SIMULATION. trip contains the flights and their IANA time zones. candidate_policy sets the sleep durations and placements to compare. hard_constraints.locked_blocks lists fixed commitments. Use synthetic data.
Sample request
Loading the sample request…
Response body
options lists the available options. excluded_options lists the exclusions and their reasons. assumptions and unverified_inputs describe the assumptions and missing information. PHASE returns options in model order.
Find the available bedtime start closest to your app’s target, given the end of the last nap, a range of minutes awake and any fixed commitments.
Call the local endpoint
POST /v0/phase/bedtime-options runs on localhost. Download the Python example, unzip it, and run python3 demo.py --serve from the extracted folder. Leave that terminal open. Send this request from a second terminal. No API key is required.
Supply all six fields. Use dated timestamps with a UTC offset or Z, aligned to whole minutes.
timezone
IANA time zone for displaying the result, such as America/Denver or UTC.
nap_end_at
The recorded end of the last nap.
bedtime_target_at
The time your app would like bedtime to start.
min_awake_minutes max_awake_minutes
Minimum and maximum elapsed minutes from nap end to bedtime start. Supply whole numbers from 0 through 2880, with the minimum at or below the maximum. Your app sets these bounds.
fixed_commitments
Use [] when the calendar is clear. Otherwise, send one object per commitment with a unique id, start_at and end_at. A commitment blocks bedtime starts from its start minute up to but excluding its end minute.
Read the response
The response below shows selected fields under bedtime_options. This request allows starts from 20:30 through 21:30. The target of 22:00 is later than that window, so the selected start moves 30 minutes earlier.
Each window includes both endpoints. If two available starts are equally close to the target, the earlier one wins. A positive shift means later and a negative shift means earlier. excluded_commitment_refs lists the IDs of commitments that overlap the permitted start range.
If commitments cover every allowed minute, the API returns HTTP 200 with empty feasible_start_windows, a null selection and shift, and NO_FEASIBLE_BEDTIME in reason_codes. Invalid fields return HTTP 400.