Source: https://cli.nylas.com/docs/commands/agent-policy-create

# nylas agent policy create

Create an Agent Account policy.

Written by [Qasim Muhammad](https://cli.nylas.com/authors/qasim-muhammad) Staff SRE

Published February 13, 2026

Updated June 21, 2026

## What does nylas agent policy create do?

The nylas agent policy create command creates a policy object for Agent Accounts. Policies group rules that can block, archive, mark, or route messages before an AI agent or automation reads them. Use --name for a simple policy or --data-file when you need to supply the full JSON payload.

## Usage

```bash
nylas agent policy create --name NAME [--json]
```

## Flags

| Flag | Description |
| --- | --- |
| --json | Output as JSON |
| --no-color | Disable color output |
| --verbose(-v) | Enable verbose output |
| --config | Custom config file path |
| --help(-h) | Show help for the command |
| --limit | Limit results (most list commands) |
| --yes(-y) | Skip confirmations |
| --name | Policy name |
| --data | Inline JSON policy data |
| --data-file | Path to a JSON file containing policy data |

## Examples

The nylas agent policy create command creates a policy object for Agent Accounts.

### Create a policy

```bash
nylas agent policy create --name openclaw-email-policy --json
```

### Create from JSON

```bash
nylas agent policy create --data-file policy.json --json
```

## Example output

```text
✓ Policy created (policy_abc123)
  Name:  Strict Policy
  Rules: 1

Attach it with: nylas workspace update <workspace-id> --policy-id policy_abc123
```

## Troubleshooting

### Policy payload rejected

Validate JSON before passing --data or --data-file. Start with --name when you only need an empty policy container.

## Related commands

[nylas agent account deleteDelete an agent account](https://cli.nylas.com/docs/commands/agent-account-delete)

[nylas agent account getShow one agent account](https://cli.nylas.com/docs/commands/agent-account-get)

[nylas agent policy deleteDelete an unattached policy](https://cli.nylas.com/docs/commands/agent-policy-delete)

[nylas agent policy getShow one policy](https://cli.nylas.com/docs/commands/agent-policy-get)

[nylas agent policy listList policies](https://cli.nylas.com/docs/commands/agent-policy-list)

[nylas agent policy readRead one policy (alias of get)](https://cli.nylas.com/docs/commands/agent-policy-read)

## Recommended guides

[ai-catalog.json: Agent Discovery for Your SitePublish ai-catalog.json at /.well-known so AI agents can discover your MCP servers, APIs, and knowledge files. The draft Google-backed spec, schema, and a live example.](https://cli.nylas.com/guides/ai-catalog-json-agent-discovery)

[List Fastmail emails from the CLIList Fastmail emails from the CLI through Nylas IMAP access, using app passwords, inbox filters, JSON output, and Fastmail-specific auth troubleshooting.](https://cli.nylas.com/guides/list-fastmail-emails)

[Thunderbird vs Nylas: GUI vs CLI emailThunderbird is a desktop GUI email client with OAuth and calendar built in. Compare it to a scriptable, headless CLI for servers, cron jobs, and AI agents.](https://cli.nylas.com/guides/nylas-vs-thunderbird)

[Why Cloud Servers Block SMTP PortsAWS, GCP, and Azure block outbound SMTP port 25 while ports 587 and 465 stay open. Confirm the block and send email over an HTTPS API instead.](https://cli.nylas.com/guides/smtp-ports-blocked-on-cloud-servers)

[Send Email From a Docker ContainerCloud providers block SMTP port 25 from containers. Send email over an HTTPS API on port 443 with one command and no mail daemon at all.](https://cli.nylas.com/guides/send-email-from-docker-container)

[MailerSend vs Nylas: Email ComparedMailerSend sends transactional email from verified domains. Nylas reads and syncs user inboxes across 6 providers. Compare features, pricing, and use cases.](https://cli.nylas.com/guides/mailersend-vs-nylas)

Run `nylas agent policy create --help` for full help output.
