# sendTransaction

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

POST https://solana-mainnet.g.alchemy.com/v2/{apiKey}

Submits a signed transaction to the cluster for processing.

Reference: https://www.alchemy.com/docs/chains/solana/solana-api-endpoints/send-transaction

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Transaction | string | Yes | Fully-signed Transaction, as encoded string. |
| Configuration | object | No | Optional configuration object. |

## Result

**Transaction signature** (string): The first signature in the transaction, used as the transaction ID.

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sendTransaction",
  "params": [
    "string",
    {
      "encoding": "base58",
      "skipPreflight": false,
      "preflightCommitment": "finalized",
      "maxRetries": 1,
      "minContextSlot": 1
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'sendTransaction',
    params: [
      'string',
      {
        encoding: 'base58',
        skipPreflight: false,
        preflightCommitment: 'finalized',
        maxRetries: 1,
        minContextSlot: 1
      }
    ]
  })
};

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

### Python

```python
import requests

url = "https://solana-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sendTransaction",
    "params": [
        "string",
        {
            "encoding": "base58",
            "skipPreflight": False,
            "preflightCommitment": "finalized",
            "maxRetries": 1,
            "minContextSlot": 1
        }
    ]
}
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://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sendTransaction\",\n  \"params\": [\n    \"string\",\n    {\n      \"encoding\": \"base58\",\n      \"skipPreflight\": false,\n      \"preflightCommitment\": \"finalized\",\n      \"maxRetries\": 1,\n      \"minContextSlot\": 1\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://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sendTransaction\",\n  \"params\": [\n    \"string\",\n    {\n      \"encoding\": \"base58\",\n      \"skipPreflight\": false,\n      \"preflightCommitment\": \"finalized\",\n      \"maxRetries\": 1,\n      \"minContextSlot\": 1\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sendTransaction\",\n  \"params\": [\n    \"string\",\n    {\n      \"encoding\": \"base58\",\n      \"skipPreflight\": false,\n      \"preflightCommitment\": \"finalized\",\n      \"maxRetries\": 1,\n      \"minContextSlot\": 1\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: sendTransaction
description: Submits a signed transaction to the cluster for processing.
params:
  - name: Transaction
    required: true
    description: Fully-signed Transaction, as encoded string.
    schema:
      type: string
  - name: Configuration
    required: false
    description: Optional configuration object.
    schema:
      title: SendTransaction Configuration
      type: object
      properties:
        encoding:
          type: string
          description: Encoding used for the transaction data.
          enum:
            - base58
            - base64
          default: base58
        skipPreflight:
          type: boolean
          description: Skip preflight transaction checks if `true`.
          default: false
        preflightCommitment:
          title: Commitment Level
          type: string
          description: Commitment level to use for preflight.
          enum:
            - processed
            - confirmed
            - finalized
          default: finalized
        maxRetries:
          type: integer
          description: Maximum retries for the RPC node to send the transaction.
        minContextSlot:
          title: Minimum Context Slot
          type: integer
          description: The minimum slot that the request can be evaluated at.
result:
  name: Transaction signature
  description: The first signature in the transaction, used as the transaction ID.
  schema:
    title: Send Transaction Result
    type: string
    description: The transaction signature as a base-58 encoded string.
```
