Skip to main content
POST
/
orgs
/
{org_id}
/
contacts
/
{contact_id}
/
channels
/
{channel_id}
/
chats
/
{chat_id}
/
messages
/
{message_id}
/
approvals
/
{tool_call_id}
Decide Action Approval as a contact on a channel
curl --request POST \
  --url https://api.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "reason": "<string>",
  "background": true
}
'
import requests

url = "https://api.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}"

payload = {
"reason": "<string>",
"background": True
}
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({reason: '<string>', background: true})
};

fetch('https://api.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}', 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.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}",
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([
'reason' => '<string>',
'background' => true
]),
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.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}"

payload := strings.NewReader("{\n \"reason\": \"<string>\",\n \"background\": true\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.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\",\n \"background\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/approvals/{tool_call_id}")

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 \"reason\": \"<string>\",\n \"background\": true\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "model": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "messages": [
    {
      "role": "system",
      "parts": [
        {
          "type": "text",
          "text": "<string>",
          "audio": {
            "id": "<string>",
            "file_path": "<string>",
            "file_filename": "document.pdf",
            "file_size": 1024,
            "file_mimetype": "application/pdf",
            "file_url": "<string>",
            "created_at": "2023-11-07T05:31:56Z"
          },
          "start_timestamp": 123,
          "end_timestamp": 123
        }
      ]
    }
  ],
  "member": {
    "id": "<string>",
    "user": {
      "id": "<string>",
      "name": "<string>",
      "avatar": "<string>"
    },
    "session": {
      "id": "<string>"
    },
    "contact_channel": {
      "id": "<string>",
      "user_id": "<string>",
      "avatar": "<string>",
      "name": "<string>",
      "username": "<string>",
      "email": "jsmith@example.com",
      "phone": "<string>",
      "country": "<string>",
      "agent": "<string>",
      "ip": "<string>",
      "language": "<string>",
      "contact": {
        "id": "<string>",
        "name": "<string>",
        "blocked": true,
        "unsubscribed": true,
        "ai_replies": true,
        "is_admin": true
      },
      "link": "<string>"
    }
  },
  "error": "<string>",
  "broadcast_id": "<string>",
  "is_broadcast_message": true,
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "total_tokens": 123,
    "reasoning_tokens": 123,
    "input_tokens_cache_read": 123,
    "input_tokens_cache_write": 123,
    "turns": [
      {
        "input_tokens": 123,
        "output_tokens": 123,
        "total_tokens": 123,
        "reasoning_tokens": 123,
        "input_tokens_cache_read": 123,
        "input_tokens_cache_write": 123
      }
    ]
  },
  "delivered_at": "2023-11-07T05:31:56Z",
  "seen_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer token authentication using your API key

Path Parameters

org_id
string
required

Org ID

contact_id
string
required

Contact ID

channel_id
string
required

Channel ID

chat_id
string
required

Chat ID

message_id
string
required

The ID of the message with the pending approval.

tool_call_id
string
required

The ID of the tool call to decide on.

Body

Accept or reject a pending approval on an assistant action

decision
enum<string>
required

How a pending approval was resolved

Available options:
accepted,
rejected
reason
string

Optional explanation for the decision. When rejecting, this is surfaced back to the assistant.

Maximum string length: 512
background
boolean

When true, the decision is recorded immediately and the approved tool runs in the background — the response returns the "running" state. Defaults to false, which blocks until the tool finishes executing and returns the final message.

Response

200 - application/json

The chat message schema

id
string
required
role
enum<string>
required

The role of the message

Available options:
user,
assistant,
system,
tool,
event,
note
model
string
required

The model used for the message

status
enum<string>
required

The chat status

Available options:
RUNNING,
COMPLETED,
FAILED,
CANCELED
created_at
string<date-time> | null
required
updated_at
string<date-time> | null
required
messages
object[]

The message content

System message

member
object

The member of the chat

error
string

Error message if the message failed

broadcast_id
string

ID of the broadcast this message originates from

is_broadcast_message
boolean

Whether this message was sent via a broadcast template

usage
object

The usage information for the message

delivered_at
string<date-time> | null

When the message was delivered to the recipient

seen_at
string<date-time> | null

When the recipient saw the message