How to Find the APIs a Desktop App Calls, and Test Them
To find the APIs a desktop app calls, first use its own developer tools or logs if it has them. Otherwise run it through a debugging proxy such as mitmproxy, trust the proxy certificate on a test machine to read HTTPS, use each feature once, then group the calls by method and path. Only inspect applications and systems you are allowed to test.
Part of the API Testing hub. Start with the pillar guides: What is API testing? Types, tools and how it works · API test automation: what it is and how to start.
To find the API calls a desktop app makes, you watch what it sends while you use it. That gives you a list of endpoints you can check against the documentation, and a starting point for API tests. This guide covers the main ways to capture the calls, how to clean up the result and how to write tests from it safely.
This article is about one application on your own machine. To build an inventory across a whole organisation, read how to discover shadow and zombie APIs.
In this guide
- Get permission first
- Choose a capture method
- Check for developer tools and logs
- Find local APIs by the ports they listen on
- Capture traffic with a debugging proxy
- Turn a HAR file into an endpoint list
- Write tests from what you captured
- When the capture shows nothing
- Using Shift-Left API
- Checklist
- Frequently asked questions
Get permission first
Intercepting traffic shows passwords, tokens and personal data. Do it only for applications your team owns, or where you have clear permission. A vendor's licence or terms may forbid inspecting its software, and your employer may forbid installing a proxy certificate. Ask before you start.
Three habits keep the work safe:
- Use a test machine or virtual machine, with test accounts and test data.
- Tell your security team. A proxy or a network scan can set off security tools.
- Plan how you will delete the capture when you are done.
Choose a capture method
Start with the least invasive method that can see the calls.
| Method | Sees | Needs | Best for |
|---|---|---|---|
| Developer tools | Requests from a web view or web app | The tools to be available | Web apps, and some apps built with web technology |
| Application logs | Whatever the app chooses to log | A debug or verbose setting | Your own software |
| Listening ports | Local programs that accept connections | Access to the machine | Finding an API that runs on your computer |
| Debugging proxy | HTTP and HTTPS from apps that use it | Proxy settings, and a trusted certificate for HTTPS | Most client applications that call a server |
| Process-level capture | Traffic from a chosen process | Usually higher system rights | Apps that ignore the system proxy |
Check for developer tools and logs
If the application is a web app, open your browser's developer tools, select the Network tab, and use the app. Filter to Fetch/XHR to hide images and scripts, then export the list as a HAR file. The Chrome DevTools network reference describes the tab.
Recent versions of Chrome export a sanitized HAR by default, which leaves out the Cookie, Set-Cookie and Authorization headers. That helps, but it does not make the file safe. Keys in URLs, tokens in bodies and personal data can still be in it.
Some desktop applications are built with web technology and include developer tools in debug builds. If the app is yours, ask the developers how to turn them on. Also look for a verbose or debug logging setting. A log line with the method, path and status is often enough to build a first list.
Find local APIs by the ports they listen on
Some desktop software runs a local server and talks to it. To see which programs are listening:
# Windows: listening TCP ports with the owning process
Get-NetTCPConnection -State Listen |
Select-Object LocalAddress, LocalPort,
@{n='Process'; e={(Get-Process -Id $_.OwningProcess).ProcessName}} |
Sort-Object LocalPort
# macOS and Linux
lsof -nP -iTCP -sTCP:LISTEN
An open port is not proof of an API. Databases and system services listen too. For a program you are allowed to probe, check common description paths such as /openapi.json or /swagger.json. If it publishes a description, you may not need to capture anything.
Capture traffic with a debugging proxy
A debugging proxy sits between the application and the server and records each request. Common tools include mitmproxy, Fiddler, Charles and Proxyman. The examples here use mitmproxy, which is open source.
Option 1: point the app or the system at the proxy. This saves the session as a HAR file when you stop it. HAR export is built in from mitmproxy 10.1.
mitmdump --set hardump=app.har
# then set the app's proxy (or the system proxy) to 127.0.0.1:8080
Option 2: capture one process. If the app ignores the proxy setting, mitmproxy's local capture mode can intercept a named process on Windows, macOS or Linux. On Linux it captures outbound connections only.
Generate API test cases from your spec (free)
Free, runs in your browser, no sign-up needed.
mitmdump --mode local:MyApp --set hardump=app.har
# replace MyApp with the process name
Reading HTTPS. Without a trusted certificate you will not see paths or bodies. mitmproxy explains how to install its certificate. A trusted interception certificate is powerful: anyone with its private key could read that machine's traffic. Install it only on the test machine, never share the key, and remove the certificate when you finish. Also restore any proxy setting you changed.
While you capture, work through a written list of features: sign in, list, search, create, edit, delete and sign out. Include one thing that should fail, such as invalid input. A capture only shows what you did, so a feature you skip is an endpoint you miss.
Turn a HAR file into an endpoint list
A raw capture repeats the same call with different IDs, and mixes in images and telemetry. This script groups calls by method, host, path shape and status. It prints query parameter names, never their values.
# har_inventory.py: list the distinct API calls in a HAR file (no values, only shapes)
import json, re, sys
from collections import Counter
from urllib.parse import parse_qsl, urlsplit
ID = re.compile(r"^(\d+|[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}|[0-9a-fA-F]{24,})$")
def template(path):
return "/".join("{id}" if ID.match(p) else p for p in path.split("/"))
def inventory(har, host_filter=""):
calls = Counter()
for entry in har["log"]["entries"]:
req, res = entry["request"], entry["response"]
url = urlsplit(req["url"])
mime = res.get("content", {}).get("mimeType", "")
if host_filter not in url.netloc or req["method"] == "OPTIONS":
continue
if not re.search(r"json|xml|grpc", mime) and req["method"] == "GET":
continue # skip pages, scripts, images and fonts
query = ",".join(sorted({k for k, _ in parse_qsl(url.query, keep_blank_values=True)}))
calls[(req["method"], url.netloc, template(url.path), query, res["status"])] += 1
return calls
if __name__ == "__main__":
with open(sys.argv[1], encoding="utf-8-sig") as f:
found = inventory(json.load(f), sys.argv[2] if len(sys.argv) > 2 else "")
for (method, host, path, query, status), n in sorted(found.items(), key=lambda i: (i[0][1], i[0][2])):
print(f"{n:4}x {method:6} {host}{path}" + (f" ?{query}" if query else "") + f" -> {status}")
Run it with the host you care about as a filter:
python har_inventory.py app.har api.example.test
1x POST api.example.test/orders -> 201
2x GET api.example.test/orders/{id} ?expand,token -> 200
1x GET api.example.test/users/{id} -> 200
We ran it on a small sample HAR to produce that output. Its limits:
- It recognises numeric IDs, UUIDs and long hexadecimal IDs. Other identifiers, such as user names or order codes in a path, stay as they are and may be personal data.
- It skips
GETrequests whose response type is not JSON, XML or gRPC, so check the raw capture if an endpoint is missing. - The host filter is a simple text match.
- It does not read WebSocket messages, and a single path such as
/graphqlcan hide many different operations.
Compare the list with your API description. A call that is not documented is worth a conversation: it may be a missing page in the docs, a private endpoint, or an old version still in use. Our guide to API dependency mapping helps with the next question, which calls depend on which.
Write tests from what you captured
A capture shows what did happen. It does not show what should happen. Replaying it as it is produces fragile tests that expect yesterday's IDs and carry real tokens.
Work in this order:
- Confirm the expected behaviour with the API description or a requirement.
- Use your own sign-in. Read tokens from the environment or a secret store, never from the capture.
- Create your own data and use the IDs from the responses.
- Check status and the fields that matter, not the whole body.
- Add the failure cases the capture did not show: no sign-in, another user's record, invalid input.
For example, a captured POST /orders followed by GET /orders/{id} becomes:
# test_orders.py: a test written from a captured call, with its own data and sign-in
import os
import requests
BASE = os.environ["API_BASE_URL"]
AUTH = {"Authorization": f"Bearer {os.environ['API_TOKEN']}"}
def test_create_then_read_order():
created = requests.post(f"{BASE}/orders", headers=AUTH, timeout=10,
json={"items": [{"sku": "A1", "qty": 1}]})
assert created.status_code == 201, created.text
order_id = created.json()["id"] # never reuse the captured ID
fetched = requests.get(f"{BASE}/orders/{order_id}", headers=AUTH, timeout=10)
assert fetched.status_code == 200
assert fetched.json()["items"][0]["sku"] == "A1"
def test_read_order_requires_sign_in():
assert requests.get(f"{BASE}/orders/1", timeout=10).status_code == 401
API Test Case Library
159 ready-made API test cases in five CSV packs: login, pagination, search and filter, auth (API key, JWT, OAuth 2.0) and errors. Copy, adapt, run.
We ran these two tests against a local stand-in API. The values /orders, A1 and the 401 expectation belong to this example, so replace them with your API's rules, and point the tests at a test environment. For more patterns, see how to write API test cases and API functional testing.
When the capture shows nothing
| What you see | Likely reason | What to try |
|---|---|---|
| No requests at all | The app ignores the system proxy | A per-app proxy setting, or process-level capture |
| Only host names, or TLS errors | The app does not trust the proxy certificate, or pins its own | Install the certificate on the test machine. For a pinned app you own, ask for a test build |
Calls to localhost are missing | Some clients do not send local calls through a proxy | The app's logs, its developer tools, or a reverse proxy in front of the local server |
| One endpoint, many behaviours | GraphQL, JSON-RPC or a WebSocket | Read the operation or method name inside each message |
| Binary bodies | gRPC or a custom format | Get the schema, such as the .proto files |
If a third-party app pins its certificate, stop there. Do not try to get around it unless you have explicit authorisation to do that kind of testing.
How to do this in Shift-Left API
In the desktop app, Scan for APIs lists the programs listening on your computer, after asking for your consent. It sets aside known system services, databases and queues, and sends a few plain requests to the other programs to work out which are APIs. It is part of the paid API Discovery add-on for Professional and Enterprise, and the Trial includes it. The Free edition does not have it, and a web browser cannot run the scan.
There are two ways to record calls:
- Capture its calls is for a web app the scan found that publishes no API description. It opens the app in a Studio window and lists the calls to that app's own address. By default it keeps names, counts and times, and never keeps query values, header values, cookies or messages. A capture stops after an hour.
- Watch every app on this computer records calls from applications that use your system proxy. It works on Windows and macOS only. It changes your own proxy setting while it runs and restores it afterwards. Reading HTTPS is off until you turn it on, which asks you to trust a certificate. Applications that ignore the proxy or reject the certificate stay unseen or encrypted.
You choose which calls go into the inventory. Captured traffic does not become tests by itself, and the scan will not find every API. The product documentation also notes that these features have not yet been run in the packaged desktop app on a wide range of machines, so expect rough edges. The steps and every limit are in Scan for APIs on this computer. To try it, start a trial.
API capture checklist
- You have permission to inspect this application and the systems it calls.
- You are on a test machine with test accounts and data.
- You tried developer tools, logs and published descriptions first.
- You used each feature, including one that should fail.
- You grouped calls by method and path, and checked them against the documentation.
- You looked for tokens and personal data before sharing any capture.
- Your tests use their own sign-in and data.
- You removed the certificate, restored the proxy and deleted the capture.
Frequently asked questions about capturing API calls
How can I see which API calls a desktop app makes?
Check for built-in developer tools or request logs first. If there are none, run the app through a debugging proxy on a test machine, use its features, and read the list of requests.
Why do I see only host names and no request details?
The traffic is encrypted. A proxy can read it only if the application trusts the proxy certificate. Some applications pin their certificate and stay unreadable.
Why does my proxy show nothing from the app?
The app may ignore the system proxy, call localhost, or use a protocol the proxy does not handle. Try a capture mode that works at the process level, or read the app's own logs.
Is a HAR file safe to share?
Not without checking it. A HAR file can hold tokens, cookies, keys in URLs and personal data in bodies, even after a tool has sanitized some headers. See what to keep out of a bug ticket, because the same checks apply.
Can Shift-Left API find the APIs on my computer?
Yes, in the desktop app with the API Discovery add-on, which the Trial includes. It scans after asking for consent and can record calls. It does not turn captured traffic into tests by itself.
Key takeaways
- Permission and a test machine come first.
- Try the gentle methods before you intercept traffic.
- Group by method and path to turn noise into an endpoint list.
- Do not replay captures as tests. Confirm the expected behaviour, then use your own data and sign-in.
- Clean up: certificate, proxy setting and capture files.
- New to the topic? Start with our lesson on HTTP status codes.
Ready to shift left with your API testing?
Import your OpenAPI spec and get a runnable test suite, in our cloud or on your own infrastructure.