Agents

Create an agent

POST

Query parameters

environmentIdstringRequired
Environment ID

Request

This endpoint expects an object.
topics
list of enumsOptional
The topics the agent should listen for
compiler
enumOptional
The compiler of the agent
Allowed values: js
source
stringOptional
The source of the agent
slug
stringOptional
The slug of the agent

Response

This endpoint returns an object
data
objectOptional

Errors

POST
$curl -X POST "https://api.x.flatfile.com/v1/agents?environmentId=us_env_YOUR_ID" \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "topics": [
> "workbook:updated"
> ],
> "compiler": "js",
> "source": "module.exports = { routeEvent: async (...args) => { console.log(args) } }"
>}'
Response
1{
2 "data": {
3 "id": "us_ag_YOUR_ID",
4 "compiler": "js",
5 "slug": "default",
6 "source": "module.exports = { routeEvent: async (...args) => { console.log(args) } }",
7 "topics": [
8 "workbook:updated"
9 ]
10 }
11}