Create a mail filter or automation
curl --request POST \
--url https://api.quiva.ai/m365/mail/filings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"space_id": "<string>",
"folder": "<string>",
"kind": "filter",
"name": "<string>",
"run_on_import": true,
"addresses": [
"<string>"
],
"domains": [
"<string>"
],
"subjects": [
"<string>"
],
"attachments": true,
"backfill_since": "<string>",
"backfill_expected": 123
}
'import requests
url = "https://api.quiva.ai/m365/mail/filings"
payload = {
"space_id": "<string>",
"folder": "<string>",
"kind": "filter",
"name": "<string>",
"run_on_import": True,
"addresses": ["<string>"],
"domains": ["<string>"],
"subjects": ["<string>"],
"attachments": True,
"backfill_since": "<string>",
"backfill_expected": 123
}
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({
space_id: '<string>',
folder: '<string>',
kind: 'filter',
name: '<string>',
run_on_import: true,
addresses: ['<string>'],
domains: ['<string>'],
subjects: ['<string>'],
attachments: true,
backfill_since: '<string>',
backfill_expected: 123
})
};
fetch('https://api.quiva.ai/m365/mail/filings', 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.quiva.ai/m365/mail/filings",
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([
'space_id' => '<string>',
'folder' => '<string>',
'kind' => 'filter',
'name' => '<string>',
'run_on_import' => true,
'addresses' => [
'<string>'
],
'domains' => [
'<string>'
],
'subjects' => [
'<string>'
],
'attachments' => true,
'backfill_since' => '<string>',
'backfill_expected' => 123
]),
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.quiva.ai/m365/mail/filings"
payload := strings.NewReader("{\n \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\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.quiva.ai/m365/mail/filings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/m365/mail/filings")
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 \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"kind": "filter",
"name": "<string>",
"space_id": "<string>",
"folder": "<string>",
"entity_type": "<string>",
"entity_folder": "<string>",
"addresses": [
"<string>"
],
"domains": [
"<string>"
],
"subjects": [
"<string>"
],
"attachments": true,
"then": {
"type": "agent",
"prompt": "<string>",
"flow_subject": "<string>",
"user_ids": [
"<string>"
]
},
"run_on_import": true,
"mailbox_user_id": "<string>",
"mailbox_display_name": "<string>",
"created_by": "<string>",
"state": "active",
"stopped": {
"reason": "<string>",
"at": "2023-11-07T05:31:56Z"
},
"backfill": {
"since": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"done_at": "2023-11-07T05:31:56Z",
"expected": 123,
"filed": 123,
"skipped": 123,
"seen": 123
},
"last_filed_at": "2023-11-07T05:31:56Z",
"filed_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Mail filing
Create a mail filter or automation
Links the caller’s mailbox to a folder. Matching mail is saved there as .eml files. For an automation (kind: automation) an action runs on each filed message. 409 when the caller already has a filter on this folder. 403 when the caller has no mailbox connected.
POST
/
m365
/
mail
/
filings
Create a mail filter or automation
curl --request POST \
--url https://api.quiva.ai/m365/mail/filings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"space_id": "<string>",
"folder": "<string>",
"kind": "filter",
"name": "<string>",
"run_on_import": true,
"addresses": [
"<string>"
],
"domains": [
"<string>"
],
"subjects": [
"<string>"
],
"attachments": true,
"backfill_since": "<string>",
"backfill_expected": 123
}
'import requests
url = "https://api.quiva.ai/m365/mail/filings"
payload = {
"space_id": "<string>",
"folder": "<string>",
"kind": "filter",
"name": "<string>",
"run_on_import": True,
"addresses": ["<string>"],
"domains": ["<string>"],
"subjects": ["<string>"],
"attachments": True,
"backfill_since": "<string>",
"backfill_expected": 123
}
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({
space_id: '<string>',
folder: '<string>',
kind: 'filter',
name: '<string>',
run_on_import: true,
addresses: ['<string>'],
domains: ['<string>'],
subjects: ['<string>'],
attachments: true,
backfill_since: '<string>',
backfill_expected: 123
})
};
fetch('https://api.quiva.ai/m365/mail/filings', 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.quiva.ai/m365/mail/filings",
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([
'space_id' => '<string>',
'folder' => '<string>',
'kind' => 'filter',
'name' => '<string>',
'run_on_import' => true,
'addresses' => [
'<string>'
],
'domains' => [
'<string>'
],
'subjects' => [
'<string>'
],
'attachments' => true,
'backfill_since' => '<string>',
'backfill_expected' => 123
]),
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.quiva.ai/m365/mail/filings"
payload := strings.NewReader("{\n \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\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.quiva.ai/m365/mail/filings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quiva.ai/m365/mail/filings")
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 \"space_id\": \"<string>\",\n \"folder\": \"<string>\",\n \"kind\": \"filter\",\n \"name\": \"<string>\",\n \"run_on_import\": true,\n \"addresses\": [\n \"<string>\"\n ],\n \"domains\": [\n \"<string>\"\n ],\n \"subjects\": [\n \"<string>\"\n ],\n \"attachments\": true,\n \"backfill_since\": \"<string>\",\n \"backfill_expected\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"kind": "filter",
"name": "<string>",
"space_id": "<string>",
"folder": "<string>",
"entity_type": "<string>",
"entity_folder": "<string>",
"addresses": [
"<string>"
],
"domains": [
"<string>"
],
"subjects": [
"<string>"
],
"attachments": true,
"then": {
"type": "agent",
"prompt": "<string>",
"flow_subject": "<string>",
"user_ids": [
"<string>"
]
},
"run_on_import": true,
"mailbox_user_id": "<string>",
"mailbox_display_name": "<string>",
"created_by": "<string>",
"state": "active",
"stopped": {
"reason": "<string>",
"at": "2023-11-07T05:31:56Z"
},
"backfill": {
"since": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"done_at": "2023-11-07T05:31:56Z",
"expected": 123,
"filed": 123,
"skipped": 123,
"seen": 123
},
"last_filed_at": "2023-11-07T05:31:56Z",
"filed_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
bearerAuthapiKeyAuth
Body
application/json
The caller must have a connected mailbox and the match must name at least one address, domain or subject word.
Response
Created
A mail filter or an automation. Matching messages from the owner's mailbox are saved into folder as .eml files, and an automation then runs its action on each.