> ## Documentation Index
> Fetch the complete documentation index at: https://docs.starkfi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Broadcast yield operations

> Optional relay for signed yield transactions when you do not want to operate a private Solana RPC.

After building and signing a deposit, withdraw, or rebalance operation, you can submit the signed wire through StarkFi — or broadcast it yourself with your own RPC.

<Info>
  **This endpoint is optional for Yield Aggregator.** If you already have a Solana RPC (public or private), sign the transaction and call `sendTransaction` directly on your infrastructure.

  Use StarkFi yield broadcast when you prefer a managed relay without running private RPC infrastructure.
</Info>

<Warning>
  **StarkPay is different.** On-chain StarkPay payments **must** use [`POST /payment/execute/on-chain`](/broadcast-transactions). Do not substitute yield broadcast for StarkPay flows.
</Warning>

## Endpoint

```http theme={null}
POST /yield/broadcast
```

## Request body

| Parameter    | Type                | Required | Description                                                                                                                                                                  |
| ------------ | ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chain_name` | string              | ✅        | Network where the transaction was built (e.g. `solana`).                                                                                                                     |
| `op_signed`  | string \| string\[] | ✅        | Base64 **signed** Solana transaction wire. One string for a single tx. An array of up to **two** strings when rebalance returned separate withdraw and deposit transactions. |

No `operation`, `position_id`, or position references are required — position tracking was removed from the yield flow.

### Example — single transaction

```shellscript theme={null}
curl --request POST \
  --url https://api.starkfi.io/yield/broadcast \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api_key>' \
  --data '{
    "chain_name": "solana",
    "op_signed": "<base64_signed_transaction>"
  }'
```

### Example — rebalance with two transactions

```json theme={null}
{
  "chain_name": "solana",
  "op_signed": [
    "<base64_signed_withdraw_tx>",
    "<base64_signed_deposit_tx>"
  ]
}
```

## Success response

```json theme={null}
{
  "statusCode": 200,
  "success": true,
  "status": "broadcast_operation_yield_strategy_ok",
  "message": "Yield operation broadcasted successfully",
  "data": {
    "status": 1,
    "transactionHash": "5VERv8NMvzbJME..."
  }
}
```

| Field             | Description                                      |
| ----------------- | ------------------------------------------------ |
| `status`          | Confirmation status (`1` = successful on Solana) |
| `transactionHash` | On-chain signature when available                |

## Errors

| HTTP  | Status                           | When                                                                           |
| ----- | -------------------------------- | ------------------------------------------------------------------------------ |
| `400` | `invalid_parameters`             | Validation failed (missing `chain_name` or `op_signed`)                        |
| `400` | `signed_transaction_missing`     | No usable signed payload                                                       |
| `409` | `solana_blockhash_expired`       | Blockhash expired — rebuild the unsigned operation and sign again              |
| `504` | `broadcast_confirmation_timeout` | Submitted but not confirmed in time — check the signature on a Solana explorer |
| `502` | `broadcast_*` / `confirm_*`      | Relay or confirmation failed (see `details`)                                   |
| `500` | `server_error`                   | Unhandled server error                                                         |

## Self-broadcast alternative

If you skip this endpoint, deserialize the unsigned wire from the build step, sign it, and submit via your Solana connection:

```typescript theme={null}
import { Connection, Transaction } from "@solana/web3.js";

const connection = new Connection("https://your-rpc.example.com");
const signedBytes = Buffer.from(signedBase64, "base64");
const signature = await connection.sendRawTransaction(signedBytes);
await connection.confirmTransaction(signature, "confirmed");
```

Rebuild the operation if the blockhash expires before submission.
