> ## Documentation Index
> Fetch the complete documentation index at: https://flatfileinc-docs-update-8de3b114-e6aa-4417-a753-2ecef733a0d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Flatfile Command Line Interface

<Snippet file="shared/dxpbanner.mdx" />

The Flatfile Command Line Interface (CLI) provides a set of tools to help you develop, deploy, and manage [Listeners](/learning-center/concepts/listeners) in your Flatfile environment.

<Note>
  Once listeners deployed are and hosted on Flatfile's secure cloud, they are called Agents.
</Note>

## Installation

The Flatfile CLI is available as an npm package and can be invoked with npx.

```
npx flatfile@latest <command>
```

## Authentication

To interact with the agents in your environment, you must authenticate with your Flatfile API key. You may do so in two ways:

1. Pass your credentials with your command via the the `--token` and `--env` flags
2. Making the `FLATFILE_API_KEY` and `FLATFILE_ENVIRONMENT_ID` variables available in your environment, via `.env` file in your project directory or other configurations

## Available Commands

| Command                                                                           | Description                                          |
| --------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [develop](/documentation/core-libraries/cli/develop)                              | Run your project as a local listener for development |
| [deploy](/documentation/core-libraries/cli/deploy)                                | Deploy your project as a Flatfile Agent              |
| [list](/documentation/core-libraries/cli/agent-management#listing-agents)         | List all deployed Agents in your environment         |
| [download](/documentation/core-libraries/cli/agent-management#downloading-agents) | Download an agent from your environment              |
| [delete](/documentation/core-libraries/cli/agent-management#delete-an-agent)      | Delete an Agent from your environment                |

## Development Workflow

A typical development workflow with the Flatfile CLI looks like this:

<Steps>
  <Step title="develop locally">
    Configure your listener in local development using the develop command.

    This command runs your listener locally.
    It will respond to events in your configured environment just as it would once deployed,
    but changes to your listener will be watched so you can test changes in real-time.
  </Step>

  <Step title="deploy to the flatfile cloud">
    When ready, use the deploy command to deploy your listener as an Agent.

    To facilitate easy management, name your listener via the `--slug/-s` flag.
  </Step>

  <Step title="managing agents">
    Use the list command to view deployed Agents and the delete command to remove them when needed.
  </Step>

  <Step title="download deployed agents">
    Use the download to retrieve the code of a deployed Agent for inspection or modification.
  </Step>
</Steps>

## Environment Isolation

It's recommended to use an isolated environment for development to avoid conflicts with deployed Agents. The CLI will warn you if you're working in an environment that already has deployed Agents.

## Next Steps

* Learn more about [Listeners](/learning-center/concepts/listeners)
* Understand [Events](/learning-center/concepts/events) in Flatfile
* Explore [Workbooks](/learning-center/architecture/workbooks) and [Spaces](/learning-center/architecture/spaces)
