Create a contract
curl --request POST \
--url https://admin.snagsolutions.io/api/contracts \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": 123,
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"websiteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"abi": null,
"iconUrl": "<string>"
}
'import requests
url = "https://admin.snagsolutions.io/api/contracts"
payload = {
"name": "<string>",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": 123,
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"websiteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"abi": None,
"iconUrl": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
address: '0x1234567890abcdef1234567890abcdef12345678',
chainId: 123,
organizationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
websiteId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
abi: null,
iconUrl: '<string>'
})
};
fetch('https://admin.snagsolutions.io/api/contracts', 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://admin.snagsolutions.io/api/contracts",
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([
'name' => '<string>',
'address' => '0x1234567890abcdef1234567890abcdef12345678',
'chainId' => 123,
'organizationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'websiteId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'abi' => null,
'iconUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://admin.snagsolutions.io/api/contracts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://admin.snagsolutions.io/api/contracts")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174003",
"name": "My Contract",
"address": "0xabc123...",
"chainId": 1,
"type": "ERC721",
"organizationId": "123e4567-e89b-12d3-a456-426614174002",
"abi": "[{ \"constant\": true, ... }]",
"iconUrl": "https://cdn.example.com/contract-icon.png"
}{
"message": "Request body is invalid"
}Contract
Create a contract
Create a contract
POST
/
api
/
contracts
Create a contract
curl --request POST \
--url https://admin.snagsolutions.io/api/contracts \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": 123,
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"websiteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"abi": null,
"iconUrl": "<string>"
}
'import requests
url = "https://admin.snagsolutions.io/api/contracts"
payload = {
"name": "<string>",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": 123,
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"websiteId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"abi": None,
"iconUrl": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
address: '0x1234567890abcdef1234567890abcdef12345678',
chainId: 123,
organizationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
websiteId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
abi: null,
iconUrl: '<string>'
})
};
fetch('https://admin.snagsolutions.io/api/contracts', 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://admin.snagsolutions.io/api/contracts",
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([
'name' => '<string>',
'address' => '0x1234567890abcdef1234567890abcdef12345678',
'chainId' => 123,
'organizationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'websiteId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'abi' => null,
'iconUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://admin.snagsolutions.io/api/contracts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://admin.snagsolutions.io/api/contracts")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"address\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"chainId\": 123,\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"websiteId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"abi\": null,\n \"iconUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174003",
"name": "My Contract",
"address": "0xabc123...",
"chainId": 1,
"type": "ERC721",
"organizationId": "123e4567-e89b-12d3-a456-426614174002",
"abi": "[{ \"constant\": true, ... }]",
"iconUrl": "https://cdn.example.com/contract-icon.png"
}{
"message": "Request body is invalid"
}Authorizations
Body
application/json
Body
Maximum string length:
40The address of the contract
Example:
"0x1234567890abcdef1234567890abcdef12345678"
Available options:
erc20, erc721, erc1155, custom Response
201
Schema for a contract
Unique identifier for the contract
Example:
"123e4567-e89b-12d3-a456-426614174003"
Name of the contract
Maximum string length:
40Example:
"My Contract"
Contract address matching the required format
Pattern:
^0x[a-fA-F0-9]{40}$Example:
"0xabc123..."
ID of the blockchain chain
Example:
1
Type of the contract
Available options:
erc20, erc721, erc1155, custom Example:
"ERC721"
Unique identifier for the organization
Example:
"123e4567-e89b-12d3-a456-426614174002"
Application Binary Interface of the contract
Example:
"[{ \"constant\": true, ... }]"
Optional icon image for the contract; used as the reward token icon
Example:
"https://cdn.example.com/contract-icon.png"
Was this page helpful?