inject-operation - Tezos

Broadcasts a signed, forged operation to the network and returns its operation hash. This is how a transaction is submitted to Tezos.

Endpoint

httpPOST /injection/operation

Query Parameters

ParameterTypeDescription
chainstringTarget chain, default main
asyncstringInject asynchronously (true/false)

Example

bashexport TEZOS_REST=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

curl -X POST "${TEZOS_REST}injection/operation" \
  -H "Content-Type: application/json" \
  -d '"ce69c5713db...signedforgedhex..."'

example.js

javascriptconst axios = require('axios');

// The body is a JSON string: the signed operation bytes in hex, wrapped in quotes
const response = await axios.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/injection/operation',
    JSON.stringify('ce69c5713db...signedforgedhex...'),
    { headers: { 'Content-Type': 'application/json' } }
);

console.log(response.data);

example.py

pythonimport requests

# The body is a JSON string: the signed operation bytes in hex
response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/injection/operation',
    headers={'Content-Type': 'application/json'},
    json='ce69c5713db...signedforgedhex...'
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // The body is a JSON string: the signed operation bytes in hex
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/injection/operation")
        .header("Content-Type", "application/json")
        .json(&json!("ce69c5713db...signedforgedhex..."))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response);
    Ok(())
}

Response

json"oohash..."

Response Fields

FieldTypeDescription
(root)stringOperation hash of the injected operation

Use Cases

  • Transaction Submission: Broadcast a signed operation
  • Payment Rails: Send XTZ or call contracts programmatically

Error Handling

ErrorMessageDescription
400 / Bad requestBad requestA path or body parameter was invalid
404 / Not foundNot foundThe block, contract, or resource does not exist
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect