Note: It generally takes between 6 and 30 seconds for a blob to be included. If you call this endpoint in synchronous mode, that's approximately how long you can expect to receive a response.
You may need to configure your default timeouts accordingly if you see your requests timing out, as some HTTP tools have a default timeout of 10 or 15 seconds.
Alternatively, you can use "asynchronous": true to get an immediate confirmation that Twinkle has received your request, and poll GET v0/blob/status for its inclusion status.
Body Parameters
namespace20 character hexadecimal stringREQUIRED
The namespace of the data blob you are posting. The namespace value must be exactly twenty characters of valid hexadecimal text. This corresponds to a V0 Celestia Namespace ID. Read more about namespace IDs at the Celestia Docs here.
Whether or not to post the data blob asynchronously. If true, the request will confirm the data blob is in the mempool of at least one celestia node, and it will be posted in the background. If false, the request will wait until the data blob is included into the next available block before returning. Defaults to 'false'. Note: an asynchronous request will only return the 'twinkleRequestId', as the blob's confirmation will not be finalized when we deliver a response. Use `GET /blob/status` to query a blob's inclusion status by `twinkleRequestId`.
// Cargo.toml dependencies:
// [dependencies]
// reqwest = { version = "0.12", features = ["json"] }
// serde_json = { version = "1.0" }
// tokio = { version = "1.46", features = ["macros", "rt-multi-thread"] }
use reqwest::{Client, header};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let url = "https://t.tech/v0/blob";
let api_key = "Your API Key"; // Replace with your actual token
let payload = json!({
"namespace": "6959808870f083763a20", "data": "63b2116a3635fbb4",
});
let res = client
.post(url)
.header(header::CONTENT_TYPE, "application/json")
.bearer_auth(api_key)
.json(&payload)
.send()
.await?;
let status = res.status();
let body = res.text().await?;
println!("Status: {}", status);
println!("Response: {}", body);
Ok(())
}