Trigger API
The phone trigger is two HTTP calls. The iPhone Shortcut is one way to send them, but anything that can send an HTTP POST with a header works the same way: another automation app, a script or a hardware button.
A call reaches every uLockin tab that has your secret. Get the secret from Settings → Phone trigger in uLockin.
Authentication
Section titled “Authentication”Send the secret in a header on every call:
Authorization: Bearer <secret>The secret is 43 characters: letters, digits, - and _. It is never sent in the URL, so it stays out of request logs.
Start a session
Section titled “Start a session”POST https://ulockin.com/api/trigger/start?work=40&break=15| Parameter | Required | Value |
|---|---|---|
work |
No | Work length in whole minutes, 1 to 240. Without it, the preset’s work length is used. |
break |
No | Length of the break after it, in whole minutes, 1 to 240. Without it, the preset’s break is used. |
curl -X POST "https://ulockin.com/api/trigger/start?work=40&break=15" -H "Authorization: Bearer $ULOCKIN_SECRET"Stop a session
Section titled “Stop a session”POST https://ulockin.com/api/trigger/stopStop takes no parameters.
curl -X POST "https://ulockin.com/api/trigger/stop" -H "Authorization: Bearer $ULOCKIN_SECRET"What start and stop do to a running timer is described under How taps behave.
Replies
Section titled “Replies”Every reply is one plain-text sentence (text/plain), so a tool can show it as is.
| Status | Reply | Meaning |
|---|---|---|
| 200 | Start sent to 1 uLockin tab. |
Delivered. The number is how many tabs are connected. Stop replies Stop sent to …. |
| 200 | Start held: no uLockin tab is connected. It applies from the tap time when one connects. |
No tab is open. The call is held. |
| 400 | work must be whole minutes from 1 to 240. |
A bad work or break value. |
| 401 | Missing or malformed secret. Send it as "Authorization: Bearer <secret>". |
No header, or the secret isn’t 43 valid characters. |
| 404 | No uLockin has connected with this secret. Open uLockin, add it in Settings > Phone trigger, then try again. |
No browser has ever used this secret. |
| 404 | Not found. |
The path isn’t a trigger call. |
| 405 | Use POST. |
Another method was used. |
| 410 | This secret was replaced. Copy the new one from uLockin's Settings. |
The secret was regenerated. |
Held calls
Section titled “Held calls”- With no tab connected, a call is held for up to 8 hours. At most 50 calls are held per secret.
- A tab that connects later applies held calls in order, each from the time it was sent.
- Each call is applied once per tab, so a reconnect never starts a session twice.
- Calls are held only for a secret that a uLockin tab has connected with at least once.