List agents across the organization's spaces

Read-only agent index of every space of the organization where the caller holds agents:read or agents:run: one row per agent ACTIVE in at least one of those spaces, in the order of the single-space index (by id). space_ids names those spaces (map them to names with GET /api/spaces), the agent's home first when it is one of them, then in the order of GET /api/spaces. dependencies.skills is withheld unless one of them grants agents:read (agents:run alone is a summary read); running_runs / unread_count add up the agent's runs in every space read, each space counting every run there under runs:read-all, the caller's own runs otherwise. A caller who reads agents in no space gets an empty list. An unknown query parameter is rejected with 400. A space the caller holds no role in (a closed space not joined, a private space they are not a member of) contributes nothing, and a credential pinned to a space (a space API key, a space-bound MCP token) reaches that space only. No X-Space-Id: the organization is the path's. An end-user is refused with 403.

GET/api/orgs/{orgId}/agents

Authorization

better-auth.session_token<token>

Cookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.

In: cookie

Path Parameters

orgId*string

Organization ID.

curl -X GET "https://your-instance/api/orgs/string/agents"
{
  "object": "list",
  "hasMore": false,
  "data": [
    {
      "id": "@acme/email-sorter",
      "space_ids": [
        "spc_3e6f8a1b-2c4d-4e70-8f92-a1b3c5d7e9f0"
      ],
      "home_space_id": "spc_3e6f8a1b-2c4d-4e70-8f92-a1b3c5d7e9f0",
      "icon": "lucide:mail",
      "color": "blue",
      "display_name": "Email Sorter",
      "description": "Automatically sorts and labels incoming emails",
      "schema_version": "0.1",
      "author": "Acme Corp",
      "keywords": [
        "email",
        "automation"
      ],
      "source": "local",
      "scope": "@acme",
      "version": "1.2.0",
      "published": true,
      "type": "agent",
      "running_runs": 1,
      "unread_count": 2,
      "dependencies": {
        "skills": {},
        "integrations": {}
      },
      "integrations": []
    },
    {
      "id": "@appstrate/code-reviewer",
      "space_ids": [
        "spc_3e6f8a1b-2c4d-4e70-8f92-a1b3c5d7e9f0"
      ],
      "home_space_id": "spc_3e6f8a1b-2c4d-4e70-8f92-a1b3c5d7e9f0",
      "icon": null,
      "color": null,
      "display_name": "Code Reviewer",
      "description": "Reviews pull requests and suggests improvements",
      "schema_version": "0.1",
      "author": "Appstrate",
      "keywords": [
        "code",
        "review",
        "github"
      ],
      "source": "system",
      "scope": "@appstrate",
      "version": "2.0.0",
      "published": true,
      "type": "agent",
      "running_runs": 0,
      "unread_count": 0,
      "dependencies": {
        "skills": {
          "@appstrate/summarize": "^1.0.0"
        },
        "integrations": {
          "@appstrate/github": "^2.0.0"
        }
      },
      "integrations": [
        {
          "id": "@appstrate/github",
          "name": "GitHub",
          "icon": "logos:github-icon",
          "required": true,
          "authenticated": true
        }
      ]
    }
  ]
}

{
  "type": "https://docs.appstrate.dev/errors/validation-failed",
  "title": "Validation Failed",
  "status": 400,
  "detail": "name: Invalid input: expected string, received undefined (+2 more)",
  "code": "validation_failed",
  "request_id": "req_abc123",
  "errors": [
    {
      "field": "name",
      "code": "required",
      "message": "Invalid input: expected string, received undefined"
    },
    {
      "field": "email",
      "code": "invalid_format",
      "message": "Invalid email address"
    },
    {
      "field": "age",
      "code": "invalid_type",
      "message": "Invalid input: expected number, received string"
    }
  ]
}

{
  "type": "https://docs.appstrate.dev/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid or missing session",
  "code": "unauthorized",
  "request_id": "req_abc123"
}
{
  "type": "https://docs.appstrate.dev/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Insufficient permissions",
  "code": "forbidden",
  "request_id": "req_abc123"
}