> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://reference.flatfile.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://reference.flatfile.com/_mcp/server.

# List agents

GET https://api.x.flatfile.com/v1/agents

Reference: https://reference.flatfile.com/api-reference/agents/list

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `environmentId` (string, required) — Environment ID
- `isSystem` (boolean, optional)
- `search` (string, optional)
- `pageSize` (integer, optional) — Number of logs to return in a page (default 20)
- `pageNumber` (integer, optional) — Based on pageSize, which page of records to return

## Response

### 200

- `data` (list of Agent, optional)
- `pagination` (Pagination, optional) — pagination info

## Types

### Agent

- `accountId` (string, required) — Account ID
- `createdAt` (datetime, required)
- `environmentId` (string, required) — Environment ID
- `id` (string, required) — Agent ID
- `updatedAt` (datetime, required)
- `commitInfo` (map from string to any, optional) — Commit information for the agent
- `compiler` (enum, optional) — The compiler of the agent
  - Allowed values: `js`
- `createdFrom` (string, optional) — The agent id of the template that was used to create this agent
- `isSystem` (boolean, optional) — Whether the agent is a system agent. This should be false for all agents created by users.
- `lastPropagatedAt` (datetime, optional) — The last time the agent template configuration was propagated to this agent
- `namespace` (string, optional) — The namespace this agent should be limited to. Right now, this is information only and not used to actually filter agents that run, so you must still specify the namespace filter in the agent code.
- `packageVersions` (map from string to string, optional) — Package versions information for the agent
- `slug` (string, optional) — The slug of the agent
- `source` (string, optional) — The source of the agent
- `sourceMap` (string, optional) — The source map of the agent
- `template` (enum, optional) — The template of the agent; Template options are required for templated agents.
  - Allowed values: `constraints`, `autobuild`, `autocast`, `webhook-egress`, `action-listener`, `automap`
- `templateOptions` (TemplateOptions, optional) — The options for a templated agent. Must be provided if `template` is provided.
- `topics` (list of enum, optional) — The topics the agent should listen for
  - Allowed values: `agent:created`, `agent:updated`, `agent:deleted`, `space:created`, `space:updated`, `space:deleted`, `space:archived`, `space:unarchived`, `space:expired`, `space:guestAdded`, `space:guestRemoved`, `document:created`, `document:updated`, `document:deleted`, `workbook:created`, `workbook:updated`, `workbook:deleted`, `workbook:expired`, `workbook:thawed`, `flag:created`, `flag:updated`, `flag:deleted`, `sheet:created`, `sheet:updated`, `sheet:deleted`, `sheet:counts-updated`, `sheet:calculation-updated`, `snapshot:created`, `records:created`, `records:updated`, `records:deleted`, `file:created`, `file:updated`, `file:deleted`, `file:expired`, `job:created`, `job:updated`, `job:deleted`, `job:completed`, `job:ready`, `job:scheduled`, `job:outcome-acknowledged`, `job:parts-completed`, `job:failed`, `program:created`, `program:updated`, `program:recomputing`, `program:recomputed`, `commit:created`, `commit:updated`, `commit:completed`, `layer:created`, `secret:created`, `secret:updated`, `secret:deleted`, `cron:5-minutes`, `cron:hourly`, `cron:daily`, `cron:weekly`, `environment:created`, `environment:updated`, `environment:deleted`, `environment:autobuild-created`, `action:created`, `action:updated`, `action:deleted`, `data-clip:created`, `data-clip:updated`, `data-clip:deleted`, `data-clip:collaborator-updated`, `data-clip:resolutions-created`, `data-clip:resolutions-updated`, `data-clip:resolutions-refreshed`, `canvas:created`, `canvas:updated`, `canvas:deleted`, `canvas-area:created`, `canvas-area:updated`, `canvas-area:deleted`, `thread:created`, `thread:updated`, `thread:deleted`
- `options` (map from string to any, optional, deprecated) — This field is deprecated and will be removed in the future. Use the `template` and `templateOptions` fields instead.

### Pagination

pagination info

- `currentPage` (integer, required) — current page of results
- `pageCount` (integer, required) — total number of pages of results
- `totalCount` (integer, required) — total available results

### TemplateOptions

The options for a templated agent.

- `template`: `constraints`
  - `namespace` (string, optional)
- `template`: `autobuild`
  - `autobuildId` (string, required)
  - `namespace` (string, optional)
- `template`: `autocast`
  - `sheetSlug` (string, required)
  - `fieldFilters` (list of string, optional)
  - `namespace` (string, optional)
  - `options` (map from string to any, optional)
- `template`: `webhook-egress`
  - `jobName` (string, required)
  - `url` (string, required)
  - `namespace` (string, optional)
- `template`: `action-listener`
  - `actionFunction` (string, required)
  - `jobName` (string, required)
  - `namespace` (string, optional)
- `template`: `automap`
  - `options` (AutomapOptions, required)
  - `namespace` (string, optional)

### AutomapOptions

- `accuracy` (string, required)
- `defaultTargetSheet` (string, required)
- `matchFilename` (string, required)

## Examples

**Response**

```json
{
  "data": [
    {
      "accountId": "us_acc_YOUR_ID",
      "createdAt": "2023-10-30T16:59:45.735Z",
      "environmentId": "us_env_YOUR_ID",
      "id": "us_ag_YOUR_ID",
      "updatedAt": "2023-10-30T16:59:45.735Z",
      "compiler": "js",
      "slug": "default",
      "source": "module.exports = { routeEvent: async (...args) => { console.log(args) } }",
      "topics": [
        "workbook:updated"
      ],
      "options": {
        "namespace": "space:blue"
      }
    }
  ],
  "pagination": {
    "currentPage": 3,
    "pageCount": 50,
    "totalCount": 100
  }
}
```

**SDK Code**

```python Example0
import requests

url = "https://api.x.flatfile.com/v1/agents"

querystring = {"environmentId":"us_env_YOUR_ID","pageSize":"20","pageNumber":"1"}

headers = {
    "X-Disable-Hooks": "true",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```typescript Example0
import { FlatfileClient } from "@flatfile/api";

const client = new FlatfileClient({ token: "YOUR_TOKEN" });
await client.agents.list({
    environmentId: "us_env_YOUR_ID",
    pageSize: 20,
    pageNumber: 1
});

```

```go Example0
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Disable-Hooks", "true")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example0
require 'uri'
require 'net/http'

url = URI("https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Disable-Hooks"] = 'true'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Example0
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1")
  .header("X-Disable-Hooks", "true")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Example0
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Disable-Hooks' => 'true',
  ],
]);

echo $response->getBody();
```

```csharp Example0
using RestSharp;

var client = new RestClient("https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Disable-Hooks", "true");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Example0
import Foundation

let headers = [
  "X-Disable-Hooks": "true",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID&pageSize=20&pageNumber=1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```