# Create Custom Transaction

## Introduction

This guide demonstrates how to create a **custom transaction** that sends ADA and assets to multiple recipient addresses in a single transaction. This powerful feature allows you to efficiently distribute funds and tokens to several wallets at once, reducing transaction costs and improving throughput. Simply include **multiple outputs** in the payload to each recipient, and define what ADA and assets to send, and Anvil API will handle building the transaction for you.

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

* Send different amounts of ADA to multiple recipients
* Distribute different native assets to different addresses
* Customize each output independently
* Handle complex transactions in a single API call

## Requirements

* A Cardano wallet with sufficient ADA
* Native assets in your wallet (if sending assets)
* Recipient wallet addresses
* Valid API key for authentication

## Full Examples

### Using Bash and cURL

{% content-ref url="/pages/CYJa1JzvztabyqOES1AF" %}
[Bash & cURL](/guides/transaction/create-custom-transaction/bash-and-curl.md)
{% endcontent-ref %}

### Using TS/JS Fetch

{% content-ref url="/pages/LYTHGUePMPudmg8XfRpX" %}
[Deno & Fetch](/guides/transaction/create-custom-transaction/node-and-fetch.md)
{% endcontent-ref %}

***

## **Specifications**

### API Endpoint

```
POST /transactions/build
```

### Request Structure

```json
{
  "changeAddress": "<sender_address>",
  "outputs": [
    {
      "address": "<receiver_address_1>",
      "lovelace": <lovelace_amount>,
      "assets": [
        {
          "policyId": "<policy_id>",
          "assetName": "<asset_name>",
          "quantity": <lovelace_amount>
        }
      ]
    },
    {
      "address": "<receiver_address_2>",
      "lovelace": <lovelace_amount>,
      "assets": [
        {
          "policyId": "<policy_id>",
          "assetName": "<asset_name>",
          "quantity": <lovelace_amount>
        }
      ]
    }
    // Add as many outputs as needed
  ],
  // Optional bounds that determine when the transaction is valid. 
  // False can be used to disable a bound.
  // If transactions are submitted outside of the validity interval, they will be rejected.
  "validityInterval": {
    "start": <posix_timestamp_or_slot_number>, // Optional, default: current slot
    "end": <posix_timestamp_or_slot_number>    // Optional, default: current slot + 2 hours
  }
}
```

## Best Practices

* Always verify recipient addresses before submitting transactions
* Include sufficient ADA in each output (minimum 2 ADA if sending native assets)
* Test transactions on testnet before moving to mainnet
* Consider transaction fees when planning outputs
* Keep your API key secure and never expose it in client-side code


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ada-anvil.io/guides/transaction/create-custom-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
