Dismiss Lexi Task
curl --request POST \
--url https://api.example.com/v1/lexi/tasks/:id/dismiss \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.example.com/v1/lexi/tasks/:id/dismiss"
payload = { "reason": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.example.com/v1/lexi/tasks/:id/dismiss', 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.example.com/v1/lexi/tasks/:id/dismiss",
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>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/lexi/tasks/:id/dismiss"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/lexi/tasks/:id/dismiss")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/lexi/tasks/:id/dismiss")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"task_id": "<string>",
"status": "<string>"
}
}Lexi AI
Dismiss Lexi Task
Dismiss a pending task (cancel without executing)
POST
/
v1
/
lexi
/
tasks
/
:id
/
dismiss
Dismiss Lexi Task
curl --request POST \
--url https://api.example.com/v1/lexi/tasks/:id/dismiss \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.example.com/v1/lexi/tasks/:id/dismiss"
payload = { "reason": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.example.com/v1/lexi/tasks/:id/dismiss', 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.example.com/v1/lexi/tasks/:id/dismiss",
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>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/lexi/tasks/:id/dismiss"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/lexi/tasks/:id/dismiss")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/lexi/tasks/:id/dismiss")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"task_id": "<string>",
"status": "<string>"
}
}Request
Path Parameters
string
required
Task UUID
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Body Parameters
string
Optional reason for dismissing the task (used for analytics)
Response
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/lexi/tasks/task-uuid/dismiss \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"reason": "Not relevant right now"
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
TASK_ID = "task-uuid"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"reason": "Not relevant right now"
}
response = requests.post(
f"{BASE_URL}/v1/lexi/tasks/{TASK_ID}/dismiss",
headers=headers,
json=data
)
result = response.json()["data"]
print(f"Task dismissed: {result['status']}")
const TASK_ID = 'task-uuid';
const response = await fetch(
`https://data.leadlex.com/functions/v1/api-gateway/v1/lexi/tasks/${TASK_ID}/dismiss`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
reason: 'Not relevant right now'
})
}
);
const { data } = await response.json();
console.log(`Task dismissed: ${data.status}`);
Example Response
{
"data": {
"task_id": "task-uuid",
"status": "dismissed"
}
}
When to Dismiss Tasks
Use dismiss when:- The task is no longer relevant
- You want to do it manually instead
- The task parameters are incorrect
- You’re testing and want to clean up pending tasks
Dismissed tasks cannot be re-approved. If you change your mind, ask Lexi to create a new task.
Dismiss Reasons (Analytics)
Common reasons tracked for analytics:| Reason | Use Case |
|---|---|
not_relevant | Task no longer needed |
manual_execution | Will do it manually |
incorrect_params | Wrong search criteria |
duplicate | Task already exists |
testing | Test/development task |
Example: Review and Dismiss Pattern
# Get all pending tasks
response = requests.get(
f"{BASE_URL}/v1/lexi/tasks",
headers=headers,
params={"status": "pending"}
)
tasks = response.json()["data"]["tasks"]
for task in tasks:
print(f"\nTask: {task['description']}")
print(f"Type: {task['type']}")
print(f"Created: {task['created_at']}")
# Prompt user for action
action = input("Approve (a), Dismiss (d), or Skip (s)? ")
if action == 'a':
requests.post(
f"{BASE_URL}/v1/lexi/tasks/{task['id']}/approve",
headers=headers
)
print("✓ Approved")
elif action == 'd':
reason = input("Reason for dismissing? ")
requests.post(
f"{BASE_URL}/v1/lexi/tasks/{task['id']}/dismiss",
headers=headers,
json={"reason": reason}
)
print("✓ Dismissed")
Bulk Dismiss
Dismiss multiple tasks at once:def dismiss_all_pending_tasks():
"""Dismiss all pending tasks (e.g., for cleanup)"""
response = requests.get(
f"{BASE_URL}/v1/lexi/tasks",
headers=headers,
params={"status": "pending"}
)
tasks = response.json()["data"]["tasks"]
for task in tasks:
requests.post(
f"{BASE_URL}/v1/lexi/tasks/{task['id']}/dismiss",
headers=headers,
json={"reason": "bulk_cleanup"}
)
print(f"Dismissed: {task['description']}")
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Task is not in pending status |
| 401 | invalid_key | Invalid API key |
| 403 | insufficient_permissions | Missing lexi permission |
| 404 | not_found | Task not found |
| 429 | rate_limited | Rate limit exceeded |
Example Error (Already Dismissed)
{
"error": {
"code": "validation_error",
"message": "Task has already been dismissed"
}
}