# HTTP

Send a signed transaction in one HTTP/1.1 request; the relay answers as soon as it accepts it.

## Authentication

Send your key in the `api-key` header of every request to a send route:

```http
api-key: <key>
```

- The key is the base58 secret key from your dashboard (TX Landing). It is also your [QUIC](/docs/tx-landing/quic/) client certificate's key.
- The header is the only place the relay reads the key. A key in the URL (`?api-key=`) is not read.
- A missing or unknown key answers `401` `{"error":"unauthorized"}`. A new key reaches each relay within about 60 seconds.
- The relay listens on port 80 without TLS, so the key travels unencrypted. HTTPS is not offered; QUIC is encrypted.

## Routes

| Route | Body | Key |
|---|---|---|
| `POST /v1/sendTransaction` | JSON-RPC `sendTransaction`, the transaction in base64 | yes |
| `POST /v1/sendRawTransaction` | The transaction: bytes with `Content-Type: application/octet-stream`, or base64 with `Content-Type: text/plain` | yes |
| `GET /ping` | None. Answers `200` `pong`. | no |

Paths are exact and case-sensitive: any other path, `/` included, answers `404`. HTTP/2 is not offered. `/v1/sendTransaction` takes `sendTransaction` only; any other JSON-RPC method answers `400` with code `-32601`.

The transaction must be signed and carry a [tip](/docs/tx-landing/endpoints/#tip-rule) of at least 0.001 SOL (1,000,000 lamports) (0.0005 SOL (500,000 lamports) on Pro and Scale). The examples use Frankfurt; any [endpoint](/docs/tx-landing/endpoints/) works.

## sendTransaction

**curl**

```sh
TX_BASE64='<your signed transaction, base64>'

curl http://fra.landing.soyas.xyz/v1/sendTransaction \
  -H "api-key: $SOYAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"sendTransaction","params":["'"$TX_BASE64"'"]}'
```

**Python**

```python
import base64
import requests

session = requests.Session()  # keeps the connection open between requests

# tx: the signed transaction's wire bytes (solders: bytes(tx)).
def send_transaction(api_key: str, tx: bytes) -> str:
    resp = session.post(
        "http://fra.landing.soyas.xyz/v1/sendTransaction",
        headers={"api-key": api_key},
        json={
            "jsonrpc": "2.0",
            "id": 1,
            "method": "sendTransaction",
            "params": [base64.b64encode(tx).decode()],
        },
    )
    if resp.status_code != 200:
        raise RuntimeError(f"{resp.status_code}: {resp.text}")
    return resp.json()["result"]
```

**Go**

```go
import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"fmt"
	"net/http"
)

// tx: the signed transaction's wire bytes (solana-go: tx.MarshalBinary()).
func sendTransaction(apiKey string, tx []byte) (string, error) {
	body, _ := json.Marshal(map[string]any{
		"jsonrpc": "2.0",
		"id":      1,
		"method":  "sendTransaction",
		"params":  []any{base64.StdEncoding.EncodeToString(tx)},
	})
	req, _ := http.NewRequest("POST", "http://fra.landing.soyas.xyz/v1/sendTransaction", bytes.NewReader(body))
	req.Header.Set("api-key", apiKey)
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	var out struct {
		Result string          `json:"result"`
		Error  json.RawMessage `json:"error"`
	}
	if json.NewDecoder(resp.Body).Decode(&out); out.Result == "" {
		return "", fmt.Errorf("%s: %s", resp.Status, out.Error)
	}
	return out.Result, nil
}
```

**Rust**

```rust
use base64::Engine as _;
use serde_json::{json, Value};
use solana_sdk::transaction::VersionedTransaction;

async fn send_transaction(
    http: &reqwest::Client,
    api_key: &str,
    tx: &VersionedTransaction,
) -> anyhow::Result<String> {
    let tx_base64 = base64::engine::general_purpose::STANDARD.encode(bincode::serialize(tx)?);
    let resp = http
        .post("http://fra.landing.soyas.xyz/v1/sendTransaction")
        .header("api-key", api_key)
        .json(&json!({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "sendTransaction",
            "params": [tx_base64],
        }))
        .send()
        .await?;
    let status = resp.status();
    let body: Value = resp.json().await.unwrap_or_default();
    match body["result"].as_str() {
        Some(signature) => Ok(signature.to_string()),
        None => anyhow::bail!("{status}: {body}"),
    }
}
```

- The transaction is base64 (standard alphabet, with padding); base58 is refused. Options (`skipPreflight`, `maxRetries`, ...) are ignored. `id` comes back unchanged.
- One transaction per request: a batch (a JSON array) is refused.

## sendRawTransaction

**curl**

```sh
# tx.bin: your signed transaction, serialized
curl http://fra.landing.soyas.xyz/v1/sendRawTransaction \
  -H "api-key: $SOYAS_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @tx.bin
```

**Python**

```python
import requests

session = requests.Session()  # keeps the connection open between requests

# tx: the signed transaction's wire bytes (solders: bytes(tx)).
def send_raw_transaction(api_key: str, tx: bytes) -> str:
    resp = session.post(
        "http://fra.landing.soyas.xyz/v1/sendRawTransaction",
        headers={"api-key": api_key, "Content-Type": "application/octet-stream"},
        data=tx,
    )
    if resp.status_code != 200:
        raise RuntimeError(f"{resp.status_code}: {resp.text}")
    return resp.json()["signature"]
```

**Go**

```go
import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

// tx: the signed transaction's wire bytes (solana-go: tx.MarshalBinary()).
func sendRawTransaction(apiKey string, tx []byte) (string, error) {
	req, _ := http.NewRequest("POST", "http://fra.landing.soyas.xyz/v1/sendRawTransaction", bytes.NewReader(tx))
	req.Header.Set("api-key", apiKey)
	req.Header.Set("Content-Type", "application/octet-stream")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	var out struct {
		Signature string `json:"signature"`
		Error     string `json:"error"`
	}
	if json.NewDecoder(resp.Body).Decode(&out); out.Signature == "" {
		return "", fmt.Errorf("%s: %s", resp.Status, out.Error)
	}
	return out.Signature, nil
}
```

**Rust**

```rust
use serde_json::Value;
use solana_sdk::transaction::VersionedTransaction;

async fn send_raw_transaction(
    http: &reqwest::Client,
    api_key: &str,
    tx: &VersionedTransaction,
) -> anyhow::Result<String> {
    let resp = http
        .post("http://fra.landing.soyas.xyz/v1/sendRawTransaction")
        .header("api-key", api_key)
        .header("Content-Type", "application/octet-stream")
        .body(bincode::serialize(tx)?)
        .send()
        .await?;
    let status = resp.status();
    let body: Value = resp.json().await.unwrap_or_default();
    match body["signature"].as_str() {
        Some(signature) => Ok(signature.to_string()),
        None => anyhow::bail!("{status}: {body}"),
    }
}
```

`Content-Type` is required. Parameters after `;` are ignored, and whitespace around a base64 body is trimmed.

## Response

`200`, `Content-Type: application/json`:

| Route | Body |
|---|---|
| `POST /v1/sendTransaction` | `{"jsonrpc":"2.0","id":1,"result":"<signature>"}` |
| `POST /v1/sendRawTransaction` | `{"signature":"<signature>"}` |

- The signature is the transaction's first signature, in base58, as it is in the bytes you sent.
- A signature means the relay accepted the transaction and passed it on for sending, not that it landed. Check it on chain.
- The relay does not verify signatures, check the blockhash or balance, or simulate.
- The relay does not deduplicate: the same transaction sent twice is forwarded twice and counts twice against your [rate limit](/docs/tx-landing/rate-limits/).

Every error status and body is on [Errors](/docs/tx-landing/errors/).

## Limits

| What | Limit |
|---|---|
| Request body | 16384 bytes |
| Transaction | 1232 bytes (legacy, v0), 4096 bytes (v1) |
| Request headers | 16 KiB, at most 64 headers |
| Request head, request body | 5 seconds each |
| Idle connection | closed after 60 seconds |

## Keep-alive

Open one persistent connection per endpoint and send every request on it.
Send `GET /ping` (no key, not rate-limited) within 5 seconds of connecting and then more often than every 60 seconds, or the relay closes the connection.
