POST v0/subscriptions
This endpoint creates a subscription to a particular address on a specified blockchain. When new transactions involving that address are included on the blockchain, a notification will be sent to the provided callback URL.
This subscription follows the webhook pattern. Your specified callback URL will be invoked with a POST request containing transaction details. The transaction details are sent in a JSON object, the shape of which varies depending on the blockchain being monitored.
address
— string
(required)The address to subscribe to.
callbackUrl
— string
(required)The webhook URL to which notifications will be sent when new transactions are detected for the subscribed address.
network
— string
(required)The network that we are monitoring the address on. (Celestia or Eden)
chainId
— string
(required)The specific chain for the blockchain in which we are monitoring. (Celestia “mainnet” or “mocha-4”, Eden “eden-1-testnet”)
string
"Successfully created a new subscription record"
curl \
-X POST 'https://t.tech/v0/subscriptions' \
-H 'Authorization: Bearer <YOUR API KEY>' \
-H 'Content-Type: application/json' \
-d '{"address": "REPLACE ME", "callbackUrl": "REPLACE ME", "network": "REPLACE ME", "chainId": "REPLACE ME"}'
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://t.tech/v0/subscriptions"
apiKey := "Your API Key" // Replace with your actual token
payload := map[string]interface{}{"address": "REPLACE ME", "callbackUrl": "REPLACE ME", "network": "REPLACE ME", "chainId": "REPLACE ME",
}
jsonPayload, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshalling JSON:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println("Status:", resp.Status)
fmt.Println("Response:", string(body))
}
// 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/subscriptions";
let api_key = "Your API Key"; // Replace with your actual token
let payload = json!({
"address": "REPLACE ME", "callbackUrl": "REPLACE ME", "network": "REPLACE ME", "chainId": "REPLACE ME",
});
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(())
}