Submit an approval
curl --request POST \
--url https://api.myego.dev/api/approvals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "Ship the 2.0 release?",
"options": [
{
"id": "ship",
"label": "Ship it",
"note": "<string>"
}
],
"backgroundContext": "<string>",
"recommendation": "<string>"
}
'import requests
url = "https://api.myego.dev/api/approvals"
payload = {
"question": "Ship the 2.0 release?",
"options": [
{
"id": "ship",
"label": "Ship it",
"note": "<string>"
}
],
"backgroundContext": "<string>",
"recommendation": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'Ship the 2.0 release?',
options: [{id: 'ship', label: 'Ship it', note: '<string>'}],
backgroundContext: '<string>',
recommendation: '<string>'
})
};
fetch('https://api.myego.dev/api/approvals', 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.myego.dev/api/approvals",
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([
'question' => 'Ship the 2.0 release?',
'options' => [
[
'id' => 'ship',
'label' => 'Ship it',
'note' => '<string>'
]
],
'backgroundContext' => '<string>',
'recommendation' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.myego.dev/api/approvals"
payload := strings.NewReader("{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.myego.dev/api/approvals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myego.dev/api/approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "k1722abcd"
}{
"error": "Bad request"
}{
"error": "Unauthorized"
}{
"error": "Forbidden"
}Approvals
Submit an approval
Submit an approval for the owner to decide. Requires the approvals:write scope. The approval lands in the owner’s Approvals inbox in ego.
POST
/
api
/
approvals
Submit an approval
curl --request POST \
--url https://api.myego.dev/api/approvals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "Ship the 2.0 release?",
"options": [
{
"id": "ship",
"label": "Ship it",
"note": "<string>"
}
],
"backgroundContext": "<string>",
"recommendation": "<string>"
}
'import requests
url = "https://api.myego.dev/api/approvals"
payload = {
"question": "Ship the 2.0 release?",
"options": [
{
"id": "ship",
"label": "Ship it",
"note": "<string>"
}
],
"backgroundContext": "<string>",
"recommendation": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'Ship the 2.0 release?',
options: [{id: 'ship', label: 'Ship it', note: '<string>'}],
backgroundContext: '<string>',
recommendation: '<string>'
})
};
fetch('https://api.myego.dev/api/approvals', 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.myego.dev/api/approvals",
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([
'question' => 'Ship the 2.0 release?',
'options' => [
[
'id' => 'ship',
'label' => 'Ship it',
'note' => '<string>'
]
],
'backgroundContext' => '<string>',
'recommendation' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.myego.dev/api/approvals"
payload := strings.NewReader("{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.myego.dev/api/approvals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myego.dev/api/approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"Ship the 2.0 release?\",\n \"options\": [\n {\n \"id\": \"ship\",\n \"label\": \"Ship it\",\n \"note\": \"<string>\"\n }\n ],\n \"backgroundContext\": \"<string>\",\n \"recommendation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "k1722abcd"
}{
"error": "Bad request"
}{
"error": "Unauthorized"
}{
"error": "Forbidden"
}Authorizations
Pass your ego access token as a bearer token: Authorization: Bearer <token>. The token carries the scopes granted on the consent screen.
Body
application/json
The decision the owner must make.
Example:
"Ship the 2.0 release?"
The options the owner can choose from.
Show child attributes
Show child attributes
Optional context to help the owner decide.
Optional recommended option or course of action.
Response
The approval was created.
Identifier of the created approval.
Example:
"k1722abcd"
