# Broadcast a Solana Swap

> Coming soon, upon request — this feature is turned on for your tenant by the Aurea team. [Contact us](https://www.aureahub.com/contact)

A client-side wallet's Solana swap, step 2 — the wallet's signature of the message Execute Solana Swap handed out, checked and sent.

## Overview

- **Client-side Solana swaps are on request** [Coming soon, upon request](https://docs.aureahub.com/docs/feature-availability.md). Until your tenant has them, [Execute Solana Swap](https://docs.aureahub.com/docs/swap-execute-solana.md) refuses client-side wallets, and this route answers `400` `Non-custodial Solana swaps are not yet supported`.
- When Execute Solana Swap answers `requiresClientSigning: true`, sign the bytes of `messageToSign` (base64-decode it) with the wallet's ed25519 key, and send the 64-byte signature in base58 with `transactionId` and `preparedTxId`. You do not send a transaction: Aurea checks the signature against the wallet over exactly the message it handed out, puts it in the transaction it prepared, and sends that.
- The answer comes once the network has confirmed it: `status` `confirmed`, or `failed` when the transaction failed on chain, with the Solana signature as `txHash`.
- **Within `expiresAt`** — 90 seconds after Execute Solana Swap: the swap router's transaction carries a recent blockhash —, and **once**: a prepared swap is used by its first broadcast, whatever happens next. Then quote and execute again.
- For the user who executed the swap, with their access token. Takes an `Idempotency-Key`. At most 10 requests per 10 seconds.
- **Institutional tenants only:** this route needs an `Idempotency-Key`, and the tenant's policy decides again before the transaction is sent. It never holds anything: a rule asking for an approval refuses with `403` `POLICY_APPROVAL_REQUIRED`, unless the operation was approved for that rule ([Approvals](https://docs.aureahub.com/docs/guide-approvals.md), [Policy Sets](https://docs.aureahub.com/docs/guide-policy-sets.md)).

## Endpoint

### `POST /v1/swap/broadcast-solana`

Authentication: bearer token required.

Checks a client-side wallet's signature of a prepared Solana swap and sends it.

**Headers**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | no | Optional — required for a tenant on the institutional security profile (`400` `IDEMPOTENCY_KEY_REQUIRED` without it). Up to 255 letters, digits, - or _. The same key with the same request answers with the first answer (`idempotency-replayed: true`) instead of running it again; see [Idempotency](https://docs.aureahub.com/docs/idempotency.md) |

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `transactionId` | string (uuid) | yes | `transactionId` from Execute Solana Swap. |
| `preparedTxId` | string (uuid) | yes | `preparedTxId` from Execute Solana Swap. |
| `signature` | string | yes | The wallet's ed25519 signature of `messageToSign`'s bytes, base58 (pattern `^[1-9A-HJ-NP-Za-km-z]{64,90}$`). |

**Responses**

`200` Confirmed

```json
{
  "transactionId": "4b7e1d93-2c5a-4f08-9e6b-8a3d1c7f5e20",
  "txHash": "3vZ8gQm1K5rWbYp9Lr4TfC6hJd2sNx7aE1uHqVt8oPkXy5MzRw4cBn9LjG2fDs6TaQ7eYh3KpUv1Xr8WmZ5o",
  "status": "confirmed"
}
```

`400` Wrong signer

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "The signature is not the wallet's over the prepared swap"
}
```

`400` Expired

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "QUOTE_EXPIRED: The prepared swap has expired. Please request a new quote."
}
```

`422` Node Refused

```json
{
  "statusCode": 422,
  "error": "BlockchainError",
  "message": "Transaction simulation failed: Error processing Instruction 3: custom program error: 0x1771",
  "code": "RPC_ERROR",
  "retryable": false,
  "details": { "code": "RPC_ERROR", "retryable": false }
}
```

The node's message above is an example: it is whatever the Solana node answered.

## Errors

- `400` — `Request validation failed`; `Non-custodial Solana swaps are not yet supported` (your tenant does not offer client-side Solana swaps); `This prepared swap was broadcast already`; `QUOTE_EXPIRED: The prepared swap has expired. Please request a new quote.`; `The signature is not the wallet's over the prepared swap` (another key's, or not 64 bytes) — nothing is sent, and the right signature still goes through within `expiresAt`; `The prepared swap was changed`.
- `404` `Prepared swap not found` — not yours, or not this `transactionId`'s (`details.code` `PREPARED_SWAP_NOT_FOUND` where your tenant has [stable error codes](https://docs.aureahub.com/docs/errors.md)).
- `423` — your tenant, the user or the wallet is frozen (`TENANT_FROZEN`, `USER_FROZEN`, `ACCOUNT_FROZEN`, `WALLET_FROZEN`: [Freezes & Quarantines](https://docs.aureahub.com/docs/guide-freezes.md)); nothing is sent.
- `422` `RPC_ERROR` — **the Solana node refused the transaction** (its preflight simulation failed, a blockhash too old…): the node's reason in `message`, `retryable` `false`, and nothing was sent. The prepared swap is used: quote and execute again.

---

Web version: https://docs.aureahub.com/#swap-broadcast-solana
