Create contract template
Create a new contract template (ABI, bytecode, metadata).
POST
/
api
/
v1
/
contract-templates
Create contract template
curl --request POST \
--url https://sandbox.oumla.com/api/v1/contract-templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-sdk-version: <x-sdk-version>' \
--data '
{
"name": "<string>",
"description": "<string>",
"bytecode": "<string>",
"abi": [
{
"inputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": true
}
],
"name": "<string>",
"outputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": true
}
],
"description": "<string>",
"anonymous": true
}
],
"longDescription": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"attributes": {
"useCases": [
"<string>"
],
"standards": [
"<string>"
]
}
}
'import requests
url = "https://sandbox.oumla.com/api/v1/contract-templates"
payload = {
"name": "<string>",
"description": "<string>",
"bytecode": "<string>",
"abi": [
{
"inputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": True
}
],
"name": "<string>",
"outputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": True
}
],
"description": "<string>",
"anonymous": True
}
],
"longDescription": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"attributes": {
"useCases": ["<string>"],
"standards": ["<string>"]
}
}
headers = {
"x-sdk-version": "<x-sdk-version>",
"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-sdk-version': '<x-sdk-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: '<string>',
bytecode: '<string>',
abi: [
{
inputs: [
{
name: '<string>',
type: '<string>',
value: {},
description: '<string>',
internalType: '<string>',
components: [
{
name: '<string>',
type: '<string>',
description: '<string>',
internalType: '<string>'
}
],
indexed: true
}
],
name: '<string>',
outputs: [
{
name: '<string>',
type: '<string>',
value: {},
description: '<string>',
internalType: '<string>',
components: [
{
name: '<string>',
type: '<string>',
description: '<string>',
internalType: '<string>'
}
],
indexed: true
}
],
description: '<string>',
anonymous: true
}
],
longDescription: '<string>',
sourceCode: '<string>',
type: '<string>',
attributes: {useCases: ['<string>'], standards: ['<string>']}
})
};
fetch('https://sandbox.oumla.com/api/v1/contract-templates', 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://sandbox.oumla.com/api/v1/contract-templates",
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>',
'description' => '<string>',
'bytecode' => '<string>',
'abi' => [
[
'inputs' => [
[
'name' => '<string>',
'type' => '<string>',
'value' => [
],
'description' => '<string>',
'internalType' => '<string>',
'components' => [
[
'name' => '<string>',
'type' => '<string>',
'description' => '<string>',
'internalType' => '<string>'
]
],
'indexed' => true
]
],
'name' => '<string>',
'outputs' => [
[
'name' => '<string>',
'type' => '<string>',
'value' => [
],
'description' => '<string>',
'internalType' => '<string>',
'components' => [
[
'name' => '<string>',
'type' => '<string>',
'description' => '<string>',
'internalType' => '<string>'
]
],
'indexed' => true
]
],
'description' => '<string>',
'anonymous' => true
]
],
'longDescription' => '<string>',
'sourceCode' => '<string>',
'type' => '<string>',
'attributes' => [
'useCases' => [
'<string>'
],
'standards' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-sdk-version: <x-sdk-version>"
],
]);
$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://sandbox.oumla.com/api/v1/contract-templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sdk-version", "<x-sdk-version>")
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://sandbox.oumla.com/api/v1/contract-templates")
.header("x-sdk-version", "<x-sdk-version>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.oumla.com/api/v1/contract-templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-sdk-version"] = '<x-sdk-version>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"contract": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"longDescription": "<string>",
"bytecode": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"docs": {}
}
}{
"code": "ERR_010",
"message": "The request could not be processed.",
"category": "VALIDATION",
"statusCode": 400,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_008",
"message": "You need to sign in to continue.",
"category": "AUTHORIZATION",
"statusCode": 401,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_009",
"message": "You don't have permission to do that.",
"category": "AUTHORIZATION",
"statusCode": 403,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_501",
"message": "Resource conflict",
"category": "CONFLICT",
"statusCode": 409,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_019",
"message": "Something went wrong on our side.",
"category": "SYSTEM",
"statusCode": 500,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}Authorizations
API key for authentication
Headers
SDK version header
Body
application/json
Response
Contract template created
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create contract template
curl --request POST \
--url https://sandbox.oumla.com/api/v1/contract-templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-sdk-version: <x-sdk-version>' \
--data '
{
"name": "<string>",
"description": "<string>",
"bytecode": "<string>",
"abi": [
{
"inputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": true
}
],
"name": "<string>",
"outputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": true
}
],
"description": "<string>",
"anonymous": true
}
],
"longDescription": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"attributes": {
"useCases": [
"<string>"
],
"standards": [
"<string>"
]
}
}
'import requests
url = "https://sandbox.oumla.com/api/v1/contract-templates"
payload = {
"name": "<string>",
"description": "<string>",
"bytecode": "<string>",
"abi": [
{
"inputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": True
}
],
"name": "<string>",
"outputs": [
{
"name": "<string>",
"type": "<string>",
"value": {},
"description": "<string>",
"internalType": "<string>",
"components": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>",
"internalType": "<string>"
}
],
"indexed": True
}
],
"description": "<string>",
"anonymous": True
}
],
"longDescription": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"attributes": {
"useCases": ["<string>"],
"standards": ["<string>"]
}
}
headers = {
"x-sdk-version": "<x-sdk-version>",
"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-sdk-version': '<x-sdk-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
description: '<string>',
bytecode: '<string>',
abi: [
{
inputs: [
{
name: '<string>',
type: '<string>',
value: {},
description: '<string>',
internalType: '<string>',
components: [
{
name: '<string>',
type: '<string>',
description: '<string>',
internalType: '<string>'
}
],
indexed: true
}
],
name: '<string>',
outputs: [
{
name: '<string>',
type: '<string>',
value: {},
description: '<string>',
internalType: '<string>',
components: [
{
name: '<string>',
type: '<string>',
description: '<string>',
internalType: '<string>'
}
],
indexed: true
}
],
description: '<string>',
anonymous: true
}
],
longDescription: '<string>',
sourceCode: '<string>',
type: '<string>',
attributes: {useCases: ['<string>'], standards: ['<string>']}
})
};
fetch('https://sandbox.oumla.com/api/v1/contract-templates', 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://sandbox.oumla.com/api/v1/contract-templates",
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>',
'description' => '<string>',
'bytecode' => '<string>',
'abi' => [
[
'inputs' => [
[
'name' => '<string>',
'type' => '<string>',
'value' => [
],
'description' => '<string>',
'internalType' => '<string>',
'components' => [
[
'name' => '<string>',
'type' => '<string>',
'description' => '<string>',
'internalType' => '<string>'
]
],
'indexed' => true
]
],
'name' => '<string>',
'outputs' => [
[
'name' => '<string>',
'type' => '<string>',
'value' => [
],
'description' => '<string>',
'internalType' => '<string>',
'components' => [
[
'name' => '<string>',
'type' => '<string>',
'description' => '<string>',
'internalType' => '<string>'
]
],
'indexed' => true
]
],
'description' => '<string>',
'anonymous' => true
]
],
'longDescription' => '<string>',
'sourceCode' => '<string>',
'type' => '<string>',
'attributes' => [
'useCases' => [
'<string>'
],
'standards' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-sdk-version: <x-sdk-version>"
],
]);
$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://sandbox.oumla.com/api/v1/contract-templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-sdk-version", "<x-sdk-version>")
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://sandbox.oumla.com/api/v1/contract-templates")
.header("x-sdk-version", "<x-sdk-version>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.oumla.com/api/v1/contract-templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-sdk-version"] = '<x-sdk-version>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"bytecode\": \"<string>\",\n \"abi\": [\n {\n \"inputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"name\": \"<string>\",\n \"outputs\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": {},\n \"description\": \"<string>\",\n \"internalType\": \"<string>\",\n \"components\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"description\": \"<string>\",\n \"internalType\": \"<string>\"\n }\n ],\n \"indexed\": true\n }\n ],\n \"description\": \"<string>\",\n \"anonymous\": true\n }\n ],\n \"longDescription\": \"<string>\",\n \"sourceCode\": \"<string>\",\n \"type\": \"<string>\",\n \"attributes\": {\n \"useCases\": [\n \"<string>\"\n ],\n \"standards\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"contract": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"longDescription": "<string>",
"bytecode": "<string>",
"sourceCode": "<string>",
"type": "<string>",
"docs": {}
}
}{
"code": "ERR_010",
"message": "The request could not be processed.",
"category": "VALIDATION",
"statusCode": 400,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_008",
"message": "You need to sign in to continue.",
"category": "AUTHORIZATION",
"statusCode": 401,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_009",
"message": "You don't have permission to do that.",
"category": "AUTHORIZATION",
"statusCode": 403,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_501",
"message": "Resource conflict",
"category": "CONFLICT",
"statusCode": 409,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}{
"code": "ERR_019",
"message": "Something went wrong on our side.",
"category": "SYSTEM",
"statusCode": 500,
"path": "/api/v1/example",
"timestamp": "2025-02-20T12:00:00.000Z",
"requestId": "req-example-id"
}