> For the complete documentation index, see [llms.txt](https://docs.blinklabs.xyz/blink/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blinklabs.xyz/blink/solana/javelin/api-reference.md).

# API Reference

Javelin takes one JSON-RPC method, `sendTransaction`, in the same format as a Solana RPC node.

## Endpoint

```
POST https://<region>.javelin.blinklabs.xyz
```

Send each transaction to all regions at once for the best performance. See [Endpoints](https://docs.blinklabs.xyz/blink/solana/javelin.md#endpoints) for the list. The examples below use Frankfurt.

## sendTransaction

Sends a signed transaction. The transaction must tip one of our [tip accounts](https://docs.blinklabs.xyz/blink/solana/javelin.md#tip-accounts).

### Parameters

| # | Type   | Description                                                                                                                               |
| - | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | string | The signed transaction, encoded as base64 or base58.                                                                                      |
| 2 | object | Optional. `encoding`: `"base64"` or `"base58"`. Defaults to `"base58"`. Other options, such as `skipPreflight`, are accepted and ignored. |

{% hint style="info" %}
Use base64. Base58 is slower to decode and is limited to 1683 characters, so larger transactions must be sent as base64.
{% endhint %}

### Example request

```bash
curl https://fra.javelin.blinklabs.xyz \
  -H 'Content-Type: application/json' \
  -H 'X-Api-Key: <your-api-key>' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sendTransaction",
    "params": [
      "<base64 signed transaction>",
      { "encoding": "base64" }
    ]
  }'
```

### Example response

The result is the transaction's first signature, in base58.

```json
{
  "jsonrpc": "2.0",
  "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb",
  "id": 1
}
```

A success means Javelin accepted the transaction and is sending it. It does not mean it has landed. Check that with `getSignatureStatuses` on your own RPC node.

## API Keys

Every request needs an API key. Send it in the `X-Api-Key` header:

```bash
curl https://fra.javelin.blinklabs.xyz -H 'X-Api-Key: <your-api-key>' ...
```

If your client can only set a URL, use the `api-key` query parameter instead: `https://fra.javelin.blinklabs.xyz/?api-key=<your-api-key>`.

## MEV Protection

Send the header `X-Mev-Protect: true`, or add the query parameter `?mev-protect=true`, to keep your transaction away from validators that sandwich their users. See [MEV Protection](https://docs.blinklabs.xyz/blink/solana/javelin.md#mev-protection) for what it does.

```bash
curl https://fra.javelin.blinklabs.xyz -H 'X-Mev-Protect: true' ...
```

## Rate Limits

Each API key can send **10 requests a second** from each IP address (or IPv6 /64), with bursts of up to **20**, unless your key has a different limit. A request over the limit gets HTTP `429` and error code `-32429`. For higher limits, contact us at <contact@blinklabs.xyz>.

## Health Check

A `GET` or `HEAD` request with no body returns `200` and `ok`. Use it to keep your connection open between sends.

```bash
curl https://fra.javelin.blinklabs.xyz
ok
```

## CORS

Every response allows any origin, so you can call Javelin straight from a browser. `OPTIONS` preflight requests are answered.

## Errors

Errors use the standard JSON-RPC format. All of them return HTTP `200`, except rate limiting, which returns `429`.

```json
{
  "jsonrpc": "2.0",
  "error": { "code": -32602, "message": "invalid transaction: tip too low" },
  "id": 1
}
```

| Code     | Message                                                         | Meaning                                                                                                                            |
| -------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `-32700` | `Parse error`                                                   | The body is not valid JSON.                                                                                                        |
| `-32601` | `Method not found`                                              | The method is not `sendTransaction`.                                                                                               |
| `-32602` | `Invalid params`                                                | The parameters are missing or have the wrong shape.                                                                                |
| `-32602` | `Invalid api key: not a UUIDv4`                                 | The API key is not in the right format.                                                                                            |
| `-32602` | `invalid transaction: undecodable base58 or base64`             | The transaction does not decode with the given encoding.                                                                           |
| `-32602` | `invalid transaction: base58 over 1683 characters, send base64` | The transaction is too long for base58. Send it as base64.                                                                         |
| `-32602` | `invalid transaction: too short`                                | The decoded transaction is too short to be valid.                                                                                  |
| `-32602` | `invalid transaction: failed to sanitize`                       | The transaction is malformed.                                                                                                      |
| `-32602` | `invalid transaction: tip too low`                              | The transaction tips our [tip accounts](https://docs.blinklabs.xyz/blink/solana/javelin.md#tip-accounts) less than 5,000 lamports. |
| `-32003` | `Transaction signature verification failure`                    | A signature does not match its signer.                                                                                             |
| `-32429` | `Too many requests from this IP`                                | Over the [rate limit](#rate-limits). Slow down.                                                                                    |
| `-32005` | `Node is unhealthy`                                             | This node cannot send transactions right now. Retry.                                                                               |

The `id` in an error is `null` when the request failed before its body was read: a rate limit or a bad API key.
