> For the complete documentation index, see [llms.txt](https://node1.gitbook.io/node1-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://node1.gitbook.io/node1-docs/solana/fast-landing/batch-api.md).

# Batch API

Send up to 4 signed transactions in one request. They are delivered as a bundle: executed in the order given, all in the same block, all-or-nothing. If any of them fails, none of them land. Use it for multi-step trades that must not be split.

* Endpoint: `POST /v2/batch` on any region host (`https://fra.node1.me/v2/batch`)
* Header: `api-key: $APIKEY`
* Body: raw bytes, format below. No JSON, no base64.
* 1 to 4 transactions, each a fully signed serialized transaction (the same bytes you would base64-encode for `sendTransaction`), 1232 bytes max each (4096 for v1 transactions).
* Tip: the sum of transfers to the Node1 tip accounts across the whole batch must reach your plan's minimum tip. The tip can sit in any one of the transactions.
* Rate limit: a batch counts as 1 against your TPS.

## Body format

```
offset      size        field
0           1           count            number of transactions, 1..4
1           2 * count   lengths          length of each transaction, u16 little-endian, in order
1+2*count   sum(len)    transactions     the serialized transactions, concatenated in order

The body must be exactly 1 + 2*count + sum(lengths) bytes.
```

## Response

HTTP 200, JSON with the signatures in the same order as the request:

```json
{"jsonrpc":"2.0","id":1,"result":["<sig of tx 0>","<sig of tx 1>"]}
```

Anything else is an error. The HTTP status is the code, the body is a plain-text message:

```
401   Invalid Api-Key / Not Found api-key
429   Exceed Rate Limit: N per second
605   Batch Decode Error: ...           bad body layout, or a transaction that cannot be decoded
606   Tip Instruction Not Found         no transfer to a Node1 tip account in the batch
607   Please add a minimum tip of N lamports (batch total)
```

## Example: curl

The body has already been written to a file.

```bash
curl -X POST "https://fra.node1.me/v2/batch" \
  -H "api-key: $APIKEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @batch.bin
```

## Example: Rust

This Rust snippet assumes that `api_key` and `txs` are supplied by your application. `txs` contains locally signed, serialized transactions; replace all example placeholders before running.

```rust
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
use reqwest::blocking::Client;

fn batch_body(txs: &[Vec<u8>]) -> Vec<u8> {
    let mut body = vec![txs.len() as u8];
    for tx in txs {
        body.extend_from_slice(&(tx.len() as u16).to_le_bytes());
    }
    for tx in txs {
        body.extend_from_slice(tx);
    }
    body
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // signed transactions, in execution order
    // let txs = vec![bincode::serialize(&tx1)?, bincode::serialize(&tx2)?];
    let resp = Client::new()
        .post("https://fra.node1.me/v2/batch")
        .header("api-key", api_key)
        .body(batch_body(&txs))
        .send()?;
    println!("{} {}", resp.status(), resp.text()?);
    // 200 {"jsonrpc":"2.0","id":1,"result":["5oBk...","3SFd..."]}
    Ok(())
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://node1.gitbook.io/node1-docs/solana/fast-landing/batch-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
