# /v1/transactions/batch

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch

Submits a batch of transactions to the Aptos network. Each transaction in the batch includes full transaction details, such as sender, sequence number, gas settings, and a payload.
If any transaction in the batch fails, the response will include the corresponding failure details.
Note: The API credit cost for this endpoint is 10.


Reference: https://www.alchemy.com/docs/chains/aptos/aptos-api-endpoints/aptos-api-endpoints/v-1-transactions-batch

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
    "sequence_number": "0",
    "max_gas_amount": "1000",
    "gas_unit_price": "1",
    "expiration_timestamp_secs": "1713380000",
    "payload": {
      "type": "entry_function_payload",
      "function": "0x1::aptos_coin::transfer",
      "type_arguments": [
        "0x1::aptos_coin::AptosCoin"
      ],
      "arguments": [
        "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
        "100000"
      ]
    },
    "signature": {
      "type": "ed25519_signature",
      "public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
      "signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
    }
  }
]
'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify([
    {
      sender: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1',
      sequence_number: '0',
      max_gas_amount: '1000',
      gas_unit_price: '1',
      expiration_timestamp_secs: '1713380000',
      payload: {
        type: 'entry_function_payload',
        function: '0x1::aptos_coin::transfer',
        type_arguments: ['0x1::aptos_coin::AptosCoin'],
        arguments: ['0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1', '100000']
      },
      signature: {
        type: 'ed25519_signature',
        public_key: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1',
        signature: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1'
      }
    }
  ])
};

fetch('https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch"

payload = [
    {
        "sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
        "sequence_number": "0",
        "max_gas_amount": "1000",
        "gas_unit_price": "1",
        "expiration_timestamp_secs": "1713380000",
        "payload": {
            "type": "entry_function_payload",
            "function": "0x1::aptos_coin::transfer",
            "type_arguments": ["0x1::aptos_coin::AptosCoin"],
            "arguments": ["0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1", "100000"]
        },
        "signature": {
            "type": "ed25519_signature",
            "public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1",
            "signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1"
        }
    }
]
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch"

	payload := strings.NewReader("[\n  {\n    \"sender\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n    \"sequence_number\": \"0\",\n    \"max_gas_amount\": \"1000\",\n    \"gas_unit_price\": \"1\",\n    \"expiration_timestamp_secs\": \"1713380000\",\n    \"payload\": {\n      \"type\": \"entry_function_payload\",\n      \"function\": \"0x1::aptos_coin::transfer\",\n      \"type_arguments\": [\n        \"0x1::aptos_coin::AptosCoin\"\n      ],\n      \"arguments\": [\n        \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n        \"100000\"\n      ]\n    },\n    \"signature\": {\n      \"type\": \"ed25519_signature\",\n      \"public_key\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n      \"signature\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\"\n    }\n  }\n]")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"sender\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n    \"sequence_number\": \"0\",\n    \"max_gas_amount\": \"1000\",\n    \"gas_unit_price\": \"1\",\n    \"expiration_timestamp_secs\": \"1713380000\",\n    \"payload\": {\n      \"type\": \"entry_function_payload\",\n      \"function\": \"0x1::aptos_coin::transfer\",\n      \"type_arguments\": [\n        \"0x1::aptos_coin::AptosCoin\"\n      ],\n      \"arguments\": [\n        \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n        \"100000\"\n      ]\n    },\n    \"signature\": {\n      \"type\": \"ed25519_signature\",\n      \"public_key\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n      \"signature\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\"\n    }\n  }\n]")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://aptos-mainnet.g.alchemy.com/v2/docs-demo/v1/transactions/batch");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("[\n  {\n    \"sender\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n    \"sequence_number\": \"0\",\n    \"max_gas_amount\": \"1000\",\n    \"gas_unit_price\": \"1\",\n    \"expiration_timestamp_secs\": \"1713380000\",\n    \"payload\": {\n      \"type\": \"entry_function_payload\",\n      \"function\": \"0x1::aptos_coin::transfer\",\n      \"type_arguments\": [\n        \"0x1::aptos_coin::AptosCoin\"\n      ],\n      \"arguments\": [\n        \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n        \"100000\"\n      ]\n    },\n    \"signature\": {\n      \"type\": \"ed25519_signature\",\n      \"public_key\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\",\n      \"signature\": \"0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1\"\n    }\n  }\n]", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /v1/transactions/batch
method: POST
operation:
  summary: /v1/transactions/batch
  description: |
    Submits a batch of transactions to the Aptos network. Each transaction in the batch includes full transaction details, such as sender, sequence number, gas settings, and a payload.
    If any transaction in the batch fails, the response will include the corresponding failure details.
    Note: The API credit cost for this endpoint is 10.
  tags:
    - Aptos API Endpoints
  security:
    - apiKey: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: array
          items:
            type: object
            required:
              - sender
              - sequence_number
              - max_gas_amount
              - gas_unit_price
              - expiration_timestamp_secs
              - payload
              - signature
            properties:
              sender:
                type: string
              sequence_number:
                type: string
              max_gas_amount:
                type: string
              gas_unit_price:
                type: string
              expiration_timestamp_secs:
                type: string
              payload:
                type: object
                properties:
                  type:
                    type: string
                  function:
                    type: string
                  type_arguments:
                    type: array
                    items:
                      type: string
                  arguments:
                    type: array
                    items:
                      oneOf:
                        - type: string
                        - type: 'null'
              signature:
                type: object
                properties:
                  type:
                    type: string
                  public_key:
                    type: string
                  signature:
                    type: string
        examples:
          response:
            summary: Sample batch request
            value:
              - sender: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1'
                sequence_number: '0'
                max_gas_amount: '1000'
                gas_unit_price: '1'
                expiration_timestamp_secs: '1713380000'
                payload:
                  type: entry_function_payload
                  function: 0x1::aptos_coin::transfer
                  type_arguments:
                    - 0x1::aptos_coin::AptosCoin
                  arguments:
                    - '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1'
                    - '100000'
                signature:
                  type: ed25519_signature
                  public_key: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1'
                  signature: '0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1'
  responses:
    '200':
      description: Array of failed transactions, if any.
      content:
        application/json:
          schema:
            type: object
            properties:
              transaction_failures:
                type: array
                items:
                  type: object
                  properties:
                    error:
                      type: object
                      properties:
                        message:
                          type: string
                        error_code:
                          type: string
                        vm_error_code:
                          type: string
                    transaction_index:
                      type: integer
          examples:
            response:
              summary: Sample batch failure response
              value:
                transaction_failures:
                  - error:
                      message: account not found
                      error_code: account_not_found
                      vm_error_code: '1001'
                    transaction_index: 0
```
