Skip to main content
POST
/
broadcast
Broadcast UTXO transaction (ZEC)
curl --request POST \
  --url https://api.leokit.dev/broadcast \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "chain": "zcash",
  "tx_hex": "0500008085202f8901..."
}
'
import requests

url = "https://api.leokit.dev/broadcast"

payload = {
"chain": "zcash",
"tx_hex": "0500008085202f8901..."
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({chain: 'zcash', tx_hex: '0500008085202f8901...'})
};

fetch('https://api.leokit.dev/broadcast', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.leokit.dev/broadcast",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => 'zcash',
'tx_hex' => '0500008085202f8901...'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.leokit.dev/broadcast"

payload := strings.NewReader("{\n \"chain\": \"zcash\",\n \"tx_hex\": \"0500008085202f8901...\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Api-Key", "<api-key>")
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))

}
HttpResponse<String> response = Unirest.post("https://api.leokit.dev/broadcast")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"zcash\",\n \"tx_hex\": \"0500008085202f8901...\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.leokit.dev/broadcast")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"zcash\",\n \"tx_hex\": \"0500008085202f8901...\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "data": {
    "txid": "<string>"
  }
}
{
"message": "<string>",
"code": "<string>"
}

Overview

/leokit/broadcast is a server-side proxy for broadcasting signed UTXO transactions on chains where public APIs don’t allow CORS from a browser. Currently the only supported chain is Zcash (ZEC), where the most reliable public node (NowNodes) requires a server-side API key. Use this endpoint when your client-side ZEC swap flow needs to push a signed transaction without exposing your NowNodes key.

Endpoint

POST /leokit/broadcast

Request

Headers

HeaderValue
Content-Typeapplication/json
Api-KeyYour API key

Body

FieldTypeRequiredDescription
chainstringYesChain identifier. Currently only zcash
tx_hexstringYesHex-encoded signed transaction

Response

Success (200)

{
  "data": {
    "txid": "f4d6c2..."
  },
  "status": 200
}
FieldDescription
txidConfirmed transaction ID returned by the upstream node

Errors

StatusCodeDescription
400BAD_REQUESTMissing/invalid tx_hex, or chain not in the supported list
405METHOD_NOT_ALLOWEDNon-POST request
502BROADCAST_FAILEDUpstream node rejected the broadcast (returned in error body)
503SERVICE_UNAVAILABLEServer has no NowNodes API key configured
See the error codes catalog for the full list.

Example

curl -X POST https://api.leokit.dev/leokit/broadcast \
  -H "Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "zcash",
    "tx_hex": "0500008085202f8901..."
  }'

Notes

  • Successful broadcasts return immediately once the upstream node accepts the transaction. Use /leokit/status to track confirmation.
  • ZEC transparent (t-) transactions are forwarded to NowNodes’ BlockBook sendtx endpoint. Shielded (z-) transactions are not yet supported by this proxy.
  • This endpoint is a thin pass-through: the same txid you’d get by calling NowNodes directly.

Authorizations

Api-Key
string
header
required

Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4

Body

application/json
chain
enum<string>
required

Currently only zcash is supported.

Available options:
zcash
tx_hex
string
required

Hex-encoded signed transaction.

Response

Broadcast accepted.

status
integer
required
data
object
required