Using machines API to list machines asks for an app, but it's not documented how to do that

Hi there, I’m trying to list the machines for a v2 app using https://api.machines.dev/v1/apps/user-functions/machines as mentioned in the docs, but I get a response {“error”: “App not found”}.

I tried adding the app name (slug) after /apps in the URL but that just 404s. I don’t see anything in the docs for setting which app I want to list the machines for?

1 Like

You need to replace user-functions with the name of your app. This works for me:

lillian ~ % curl -H "Authorization: Bearer $(fly auth token)" https://api.machines.dev/v1/apps/devplayground/machines | jq
[
  {
    "id": "e784e2d6c59683",
    "name": "polished-flower-4320",
    "state": "started",
    "region": "yyz",
[...]
1 Like

Perfect, thanks! Just a heads up, the docs show user-functions in the url.
Edit: whoops, user-functions was the example fly app name in the docs, I missed that somehow! My mistake.

I also thought the docs were confusing – it’s easy to assume that “user-functions” is a fixed part of the URL rather than an example app name (compare with Netlify functions, where the URI is /.netlify/functions/... and the word “functions” is literal rather than a placeholder). Maybe change the example app name in the docs to something more obvious, e.g. my-app?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.