Commit a proposal
curl --request POST \
--url https://infra.usegrade.com/api/email/sdk/v1/agent/commit \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Application-Id: <api-key>' \
--data '
{
"proposal_token": "<string>"
}
'import requests
url = "https://infra.usegrade.com/api/email/sdk/v1/agent/commit"
payload = { "proposal_token": "<string>" }
headers = {
"X-Application-Id": "<api-key>",
"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-Application-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({proposal_token: '<string>'})
};
fetch('https://infra.usegrade.com/api/email/sdk/v1/agent/commit', 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://infra.usegrade.com/api/email/sdk/v1/agent/commit",
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([
'proposal_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>",
"X-Application-Id: <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://infra.usegrade.com/api/email/sdk/v1/agent/commit"
payload := strings.NewReader("{\n \"proposal_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Application-Id", "<api-key>")
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://infra.usegrade.com/api/email/sdk/v1/agent/commit")
.header("X-Application-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proposal_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://infra.usegrade.com/api/email/sdk/v1/agent/commit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Application-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proposal_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"proposal_id": "<string>",
"action": "<string>",
"status": "saved",
"http_status": 123,
"rows": [
{
"key": "<string>",
"http_status": 123,
"status": "saved"
}
]
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}Grade AI
Commit a proposal
Saves what a person confirmed: send the proposal_token of the assistant’s action event, unchanged. Grade calls the SDK v1 routes the proposal stands for with your key, so each route applies its own scopes, rules and audit. A second commit of the same proposal answers the first receipt.
Commit a proposal
curl --request POST \
--url https://infra.usegrade.com/api/email/sdk/v1/agent/commit \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Application-Id: <api-key>' \
--data '
{
"proposal_token": "<string>"
}
'import requests
url = "https://infra.usegrade.com/api/email/sdk/v1/agent/commit"
payload = { "proposal_token": "<string>" }
headers = {
"X-Application-Id": "<api-key>",
"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-Application-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({proposal_token: '<string>'})
};
fetch('https://infra.usegrade.com/api/email/sdk/v1/agent/commit', 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://infra.usegrade.com/api/email/sdk/v1/agent/commit",
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([
'proposal_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>",
"X-Application-Id: <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://infra.usegrade.com/api/email/sdk/v1/agent/commit"
payload := strings.NewReader("{\n \"proposal_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Application-Id", "<api-key>")
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://infra.usegrade.com/api/email/sdk/v1/agent/commit")
.header("X-Application-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"proposal_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://infra.usegrade.com/api/email/sdk/v1/agent/commit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Application-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proposal_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"proposal_id": "<string>",
"action": "<string>",
"status": "saved",
"http_status": 123,
"rows": [
{
"key": "<string>",
"http_status": 123,
"status": "saved"
}
]
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}{
"success": false,
"code": "PROPOSAL_INVALID",
"message": "<string>"
}Beta. The assistant API and its reads over MCP are in beta. They are open to every
organization that pays out through Grade, and parts are not available yet, as each page says.
Sending the same token again never writes twice: a finished commit answers its first receipt. After
504 COMMIT_OUTCOME_UNKNOWN the first route may have written: check the outcome in Grade, and never
ask the assistant for a new proposal to recover it, since a new proposal is a new write. A proposal
can be committed for 24 hours after the assistant made it.Body
application/json
The proposal to commit.