---
title: Flatten
description: Resolve ABI imports into a single YAML file with thru abi flatten
source_url:
  html: https://thru.org/docs/cli-reference/abi-flatten/
  md: https://thru.org/docs/cli-reference/abi-flatten.md
---

# Flatten

Use `thru abi flatten` when you want one self-contained ABI YAML file for review, diffing, or downstream tooling.

## Use This When

- you want to remove the need for separate local include directories
- you need a single-file ABI artifact before another tooling step
- you want a reviewable snapshot of a multi-file ABI package

Choose another ABI command when:

- you want an on-chain publishing artifact that enforces network rules: [Prep for Publish](https://thru.org/docs/cli-reference/abi-prep-for-publish.md)
- you want a JSON dependency manifest instead of YAML: [Bundle](https://thru.org/docs/cli-reference/abi-bundle.md)

## Syntax

```bash
thru abi flatten \
  --file <FILE> \
  --output <FILE> \
  [--include-dir <DIR>...] \
  [--verbose]
```

## What It Does

- loads the root ABI file
- resolves imports using the supplied include directories
- writes one flattened YAML file to `--output`

## Minimal Pattern

```bash
thru abi flatten \
  --file ./program.abi.yaml \
  --include-dir ./abi \
  --output ./dist/program.flat.abi.yaml \
  --verbose
```

## Notes

- `flatten` is local-file oriented. It does not publish anything on-chain.
- `--verbose` is useful when you want to confirm which include directories were actually used.
- If the next step is publishing, move to [Prep for Publish](https://thru.org/docs/cli-reference/abi-prep-for-publish.md) instead of stopping at a flattened file.
