Skip to main content
GET
/
api
/
v1
/
contracts
/
{contractIdOrAddress}
Get contract by id
curl --request GET \
  --url https://api.example.com/api/v1/contracts/{contractIdOrAddress}
import requests

url = "https://api.example.com/api/v1/contracts/{contractIdOrAddress}"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://api.example.com/api/v1/contracts/{contractIdOrAddress}', 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.example.com/api/v1/contracts/{contractIdOrAddress}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.example.com/api/v1/contracts/{contractIdOrAddress}"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/contracts/{contractIdOrAddress}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/contracts/{contractIdOrAddress}")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "admin_key": {
    "_type": "ProtobufEncoded",
    "key": "15706b229b3ba33d4a5a41ff54ce1cfe0a3d308672a33ff382f81583e02bd743"
  },
  "auto_renew_account": "0.0.2",
  "auto_renew_period": 7776000,
  "contract_id": "0.0.2",
  "created_timestamp": "1586567700.453054000",
  "deleted": false,
  "evm_address": "0000000000000000000000000000000000001f41",
  "expiration_timestamp": "1586567700.453054000",
  "file_id": "0.0.2",
  "max_automatic_token_associations": 123,
  "memo": "contract memo",
  "nonce": 1,
  "obtainer_id": "0.0.2",
  "permanent_removal": true,
  "proxy_account_id": "0.0.2",
  "timestamp": {
    "from": "1586567700.453054000",
    "to": "1586567700.453054000"
  },
  "bytecode": "0x01021a1fdc9b",
  "runtime_bytecode": "0x0302fa1ad39c"
}
{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}
{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}

Path Parameters

contractIdOrAddress
string
required

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$

Query Parameters

timestamp
string[]

The consensus timestamp as a Unix timestamp in seconds.nanoseconds format with an optional comparison operator. See unixtimestamp.com for a simple way to convert a date to the 'seconds' part of the Unix time.

Pattern: ^((eq|gt|gte|lt|lte|ne):)?\d{1,10}(\.\d{1,9})?$

Response

OK

admin_key
object | null

The public key which controls access to various network entities.

auto_renew_account
string | null

Network entity ID in the format of shard.realm.num

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
Example:

"0.0.2"

auto_renew_period
integer<int64> | null
Example:

7776000

contract_id
string | null

Network entity ID in the format of shard.realm.num

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
Example:

"0.0.2"

created_timestamp
string | null

A Unix timestamp in seconds.nanoseconds format

Pattern: ^\d{1,10}(\.\d{1,9})?$
Example:

"1586567700.453054000"

deleted
boolean
Example:

false

evm_address
file

A network entity encoded as an EVM address in hex.

Required string length: 40 - 42
Pattern: ^(0x)?[A-Fa-f0-9]{40}$
expiration_timestamp
string | null

A Unix timestamp in seconds.nanoseconds format

Pattern: ^\d{1,10}(\.\d{1,9})?$
Example:

"1586567700.453054000"

file_id
string | null

Network entity ID in the format of shard.realm.num

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
Example:

"0.0.2"

max_automatic_token_associations
integer<int32> | null
memo
string
Example:

"contract memo"

nonce
integer<int64> | null

The nonce of the contract

Example:

1

obtainer_id
string | null

Network entity ID in the format of shard.realm.num

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
Example:

"0.0.2"

permanent_removal
boolean | null
proxy_account_id
string | null

Network entity ID in the format of shard.realm.num

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
Example:

"0.0.2"

timestamp
object

A timestamp range an entity is valid for

bytecode
file | null

The contract bytecode in hex during deployment

runtime_bytecode
file | null

The contract bytecode in hex after deployment