Give your legacy app an API from the inside
Most legacy software has no API. If you own the code, the shortest route to one is a few functions, registered by name.
By the Onscryn team · November 15, 2026 · 7 min read
Ask anyone who maintains old business software whether it has an API and the answer is usually a laugh. The data is in there, the rules are in there, and the only door is the interface a person uses. So automation ends up pretending to be a person, finding buttons and typing into boxes, and it works until the day someone moves a button.
What is fragile about it
Screen automation has to find a control, wait for the right screen to appear, click, and read the result back out of some text. Each of those steps is a guess about what the screen will look like. A new field, a slow database call or a dialog that appears behind the main window, and the guess is wrong.
It also cannot see data. It can click on the third row of a list, but it cannot ask for the order. That limit decides what you can build on top of it.
The shortcut from the inside
If you can change the app, you do not have to pretend. Give it a function that does the thing, register it under a name, and let automation call the name. Your code already knows how to fetch an order or approve an invoice, because the screens call that same code. An action is a second door onto the logic you already trust.
The shape is simple. A call arrives with a name and some JSON. Your handler does the work and answers with a success flag and some JSON. The surrounding system keeps the list of names and rejects the ones you never registered.
What you can build with a few of them
A handful goes a long way. Reading the day's orders, fetching one by id, listing what is unpaid, approving or shipping an order, and resetting to known data. With those, a schedule can build a morning report, a webhook can approve an order the moment an email says it is ready, and a workflow can loop over invoices that are overdue and chase each one.
Because these calls do not need a screen, they can run in a session with no browser attached. A schedule starts the session, calls the action, collects the result and ends it, and the run is recorded.
Rules that keep it reliable
- Reply exactly once to every call, including when it fails.
- Return JSON objects, not text for people to read.
- Do not open dialogs or wait for the user interface from inside a handler. Handlers run on a thread of their own.
- Keep reads free of side effects, and make writes safe to repeat.
- Add one action that resets the data, so tests start from the same place.
Do not wrap everything
The temptation is to expose every function. Resist it. Each action is something to keep working and to document. Wrap the three things people ask for most, let automation click through the screens that do not have an action yet, and add a new action when a screen proves it is worth one.