> For the complete documentation index, see [llms.txt](https://dev.ada-anvil.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ada-anvil.io/guides/transaction/create-transaction-with-metadata-cip-20.md).

# Create Transaction with Metadata (CIP-20)

## Overview

Sometimes you want to attach a message, comment, or memo to a Cardano transaction—whether it's a receipt reference, a note for future auditing, or just user-friendly text. **CIP-20** standardizes how these messages appear on-chain by using **label 674** in transaction metadata. With the Anvil API, you can easily attach messages to your transactions with minimal configuration.

The Anvil API lets you supply a simple message or array of messages. Under the hood, Anvil auto-formats them for CIP-20 compliance:

* **Single string** → `["Your message"]`
* **Array of strings** → `["Line 1", "Line 2"]`
* **Long string** → Automatically split across multiple array entries if it exceeds **64 bytes**

For more information on **transactions**, please refer to the [Transaction Overview](https://github.com/Cardano-Forge/anvil-api/blob/main/docs/guides/transaction/transaction/README.md).

## Key Features

* Simple message attachment to transactions
* Automatic CIP-20 compliance formatting
* Support for single strings or arrays of strings
* Automatic handling of messages exceeding 64 bytes

## Requirements

* A Cardano wallet with sufficient ADA
* Valid API key for authentication

## Full Examples

### Using Bash and cURL

{% content-ref url="/pages/w6SsgSQBjROumM1l6E4g" %}
[Bash & cURL](/guides/transaction/create-transaction-with-metadata-cip-20/bash-and-curl.md)
{% endcontent-ref %}

### Using TS/JS Fetch

{% content-ref url="/pages/Rf3mUgGbN5yjRYdr18LE" %}
[Deno & Fetch](/guides/transaction/create-transaction-with-metadata-cip-20/node-and-fetch.md)
{% endcontent-ref %}

***

## **Specifications**

### API Endpoint

```
POST /transactions/build
```

### Request Structure

```json
{
  "changeAddress": "<sender_address>",
  "message": "Your message" // String or array of strings
}
```

### CIP-20 Formatting

The Anvil API automatically formats your messages for CIP-20 compliance:

* **Single string** → `["Your message"]`
* **Array of strings** → `["Line 1", "Line 2"]`
* **Long string** → Automatically split across multiple array entries if it exceeds **64 bytes**

## Best Practices

* Keep messages concise and relevant
* Consider privacy implications of on-chain messages
* Test transactions on testnet before moving to mainnet
* Remember that all on-chain metadata is publicly visible
* Keep your API key secure and never expose it in client-side code
