curl --request POST \
--url https://api.predicate.io/v1/task \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"from": "0x38f6001e8ac11240f903CBa56aFF72A1425ae371",
"to": "0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080",
"data": "0x",
"msg_value": "0",
"chain_id": 1
}
'import requests
url = "https://api.predicate.io/v1/task"
payload = {
"from": "0x38f6001e8ac11240f903CBa56aFF72A1425ae371",
"to": "0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080",
"data": "0x",
"msg_value": "0",
"chain_id": 1
}
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({
from: '0x38f6001e8ac11240f903CBa56aFF72A1425ae371',
to: '0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080',
data: '0x',
msg_value: '0',
chain_id: 1
})
};
fetch('https://api.predicate.io/v1/task', 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.predicate.io/v1/task",
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([
'from' => '0x38f6001e8ac11240f903CBa56aFF72A1425ae371',
'to' => '0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080',
'data' => '0x',
'msg_value' => '0',
'chain_id' => 1
]),
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://api.predicate.io/v1/task"
payload := strings.NewReader("{\n \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\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://api.predicate.io/v1/task")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.predicate.io/v1/task")
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 \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"is_compliant": true,
"signers": [
"0xDAc74b6f9B3609E914c924eB87Adff87A30fcDf6"
],
"signature": [
"0x8e10271f744c41e134d0e4ec92931a93a25c249730c1677d5be723831d68d0c660bb3c3aa409ed06d20a07367b1707908c49ef1209f8c50328cb77d2b4cac3821c"
],
"expiry_block": 123,
"task_id": "e4732bbe-aa8f-44fb-8c09-c73bdc31eeae"
}{
"error": 400,
"message": "Missing required field: from"
}{
"error": 401,
"message": "Missing or invalid token"
}{
"error": 403,
"message": "Insufficient permissions"
}{
"error": 404,
"message": "Resource not found"
}{
"error": 408,
"message": "Request timeout"
}{
"error": 429,
"message": "Rate limit exceeded"
}{
"error": 500,
"message": "Internal server error"
}{
"error": 503,
"message": "Service unavailable"
}{
"error": 504,
"message": "Gateway timeout"
}Submit Task
Processes a transaction by verifying it against the application’s policy using Predicate’s operator network. Returns a structured response with validation results and compliance status.
curl --request POST \
--url https://api.predicate.io/v1/task \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"from": "0x38f6001e8ac11240f903CBa56aFF72A1425ae371",
"to": "0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080",
"data": "0x",
"msg_value": "0",
"chain_id": 1
}
'import requests
url = "https://api.predicate.io/v1/task"
payload = {
"from": "0x38f6001e8ac11240f903CBa56aFF72A1425ae371",
"to": "0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080",
"data": "0x",
"msg_value": "0",
"chain_id": 1
}
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({
from: '0x38f6001e8ac11240f903CBa56aFF72A1425ae371',
to: '0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080',
data: '0x',
msg_value: '0',
chain_id: 1
})
};
fetch('https://api.predicate.io/v1/task', 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.predicate.io/v1/task",
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([
'from' => '0x38f6001e8ac11240f903CBa56aFF72A1425ae371',
'to' => '0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080',
'data' => '0x',
'msg_value' => '0',
'chain_id' => 1
]),
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://api.predicate.io/v1/task"
payload := strings.NewReader("{\n \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\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://api.predicate.io/v1/task")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.predicate.io/v1/task")
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 \"from\": \"0x38f6001e8ac11240f903CBa56aFF72A1425ae371\",\n \"to\": \"0xe7f2cd31e61b05b7634fc532c59b78a5dfba8080\",\n \"data\": \"0x\",\n \"msg_value\": \"0\",\n \"chain_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"is_compliant": true,
"signers": [
"0xDAc74b6f9B3609E914c924eB87Adff87A30fcDf6"
],
"signature": [
"0x8e10271f744c41e134d0e4ec92931a93a25c249730c1677d5be723831d68d0c660bb3c3aa409ed06d20a07367b1707908c49ef1209f8c50328cb77d2b4cac3821c"
],
"expiry_block": 123,
"task_id": "e4732bbe-aa8f-44fb-8c09-c73bdc31eeae"
}{
"error": 400,
"message": "Missing required field: from"
}{
"error": 401,
"message": "Missing or invalid token"
}{
"error": 403,
"message": "Insufficient permissions"
}{
"error": 404,
"message": "Resource not found"
}{
"error": 408,
"message": "Request timeout"
}{
"error": 429,
"message": "Rate limit exceeded"
}{
"error": 500,
"message": "Internal server error"
}{
"error": 503,
"message": "Service unavailable"
}{
"error": 504,
"message": "Gateway timeout"
}Authorizations
Body
Address of the sender (must be a valid Ethereum address)
"0x1234567890123456789012345678901234567890"
Destination address (the target smart contract which enforces the policy)
"0x1234567890123456789012345678901234567890"
Hex-encoded calldata relevant for the contract function call e.g., amount to lend, recipient address, etc.
"0x"
Amount of ETH (in wei) to send with the transaction
"0"
Optional chain ID for the target blockchain. If not provided, defaults to ethereum mainnet (1)
1
Response
Successfully processed task
Indicates whether the transaction meets the policy requirements
true
The addresses that signed off on the users compliance status
A ECDSA Signature from the Predicate attestation server
Timestamp after which this response is no longer valid (prev block number)
Unique identifier for the task
"e4732bbe-aa8f-44fb-8c09-c73bdc31eeae"
Was this page helpful?
