Decode Opcodes and Bodies
Decode opcodes and message bodies. Opcodes can be in hex (with or without 0x prefix) or decimal format. Bodies should be in base64 or hex format. Use POST method for long parameters that may be truncated in GET requests.
POST
/
api
/
v3
/
decode
Decode Opcodes and Bodies
curl --request POST \
--url https://toncenter.com/api/v3/decode \
--header 'Content-Type: application/json' \
--data '
{
"bodies": [
"<string>"
],
"opcodes": [
"<string>"
]
}
'import requests
url = "https://toncenter.com/api/v3/decode"
payload = {
"bodies": ["<string>"],
"opcodes": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({bodies: ['<string>'], opcodes: ['<string>']})
};
fetch('https://toncenter.com/api/v3/decode', 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://toncenter.com/api/v3/decode",
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([
'bodies' => [
'<string>'
],
'opcodes' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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://toncenter.com/api/v3/decode"
payload := strings.NewReader("{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://toncenter.com/api/v3/decode")
.header("Content-Type", "application/json")
.body("{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toncenter.com/api/v3/decode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"bodies": [
{}
],
"opcodes": [
"<string>"
]
}{
"code": 123,
"error": "<string>"
}Was this page helpful?
Previous
Get DNS RecordsQuery DNS records by specified filters. Currently .ton and .t.me DNS are supported.
Next
⌘I
Decode Opcodes and Bodies
curl --request POST \
--url https://toncenter.com/api/v3/decode \
--header 'Content-Type: application/json' \
--data '
{
"bodies": [
"<string>"
],
"opcodes": [
"<string>"
]
}
'import requests
url = "https://toncenter.com/api/v3/decode"
payload = {
"bodies": ["<string>"],
"opcodes": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({bodies: ['<string>'], opcodes: ['<string>']})
};
fetch('https://toncenter.com/api/v3/decode', 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://toncenter.com/api/v3/decode",
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([
'bodies' => [
'<string>'
],
'opcodes' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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://toncenter.com/api/v3/decode"
payload := strings.NewReader("{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://toncenter.com/api/v3/decode")
.header("Content-Type", "application/json")
.body("{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toncenter.com/api/v3/decode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"bodies\": [\n \"<string>\"\n ],\n \"opcodes\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"bodies": [
{}
],
"opcodes": [
"<string>"
]
}{
"code": 123,
"error": "<string>"
}