curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"documents": [
{
"artifactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages"
payload = {
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"documents": [{ "artifactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }]
}
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({
externalId: '<string>',
threadRef: '<string>',
from: '<string>',
receivedAt: '2023-11-07T05:31:56Z',
text: '<string>',
documents: [{artifactId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}]
})
};
fetch('https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages', 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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages",
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([
'externalId' => '<string>',
'threadRef' => '<string>',
'from' => '<string>',
'receivedAt' => '2023-11-07T05:31:56Z',
'text' => '<string>',
'documents' => [
[
'artifactId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages"
payload := strings.NewReader("{\n \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages")
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 \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "<string>",
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"documents": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"part": "<string>"
}
],
"rejected": [
{
"part": "<string>",
"name": "<string>",
"code": "<string>"
}
]
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "<string>",
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"documents": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"part": "<string>"
}
],
"rejected": [
{
"part": "<string>",
"name": "<string>",
"code": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Add a message to an underwriting submission
Adds one inbound message from the broker (an email today; SMS or chat in the same shape) and the documents it carries to a submission. Does not start an extraction.
Send the message either as its file or as fields. For an email, upload its .eml first with the upload pair and name it in raw: the body becomes an Email.txt document (part message) and each attachment a document (part attachment:<n>, from 1). from, receivedAt and text may then be left out; when given they must agree with the file (its From address, its Date and its body), and documents must be left out. Without raw, text becomes the message document, and documents are files already uploaded to this submission (artifactId) or small text given inline (name ending in .txt or .md, text up to 64 KiB), each part document:<n>. A raw file that does not parse for its channel, a disagreement with it, or a document that is not this submission’s is 422 invalid_message. An attachment the file store refuses is listed in rejected and the rest are kept.
externalId (an email’s Message-ID) makes the request safe to retry: the same externalId with the same body adds nothing and answers 200 with the same message; another body is 409 idempotency_conflict. Each document’s id derives from the submission, the externalId and the part, so a retry finds the same documents.
Needs edit access to the submission (403 for a reader, 404 when it cannot be read). Only where the workspace has underwriting turned on (403 feature_not_enabled).
Alpha: this operation may change or be removed without notice.
curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"documents": [
{
"artifactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages"
payload = {
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"documents": [{ "artifactId": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }]
}
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({
externalId: '<string>',
threadRef: '<string>',
from: '<string>',
receivedAt: '2023-11-07T05:31:56Z',
text: '<string>',
documents: [{artifactId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}]
})
};
fetch('https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages', 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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages",
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([
'externalId' => '<string>',
'threadRef' => '<string>',
'from' => '<string>',
'receivedAt' => '2023-11-07T05:31:56Z',
'text' => '<string>',
'documents' => [
[
'artifactId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages"
payload := strings.NewReader("{\n \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\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.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/{submissionId}/messages")
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 \"externalId\": \"<string>\",\n \"threadRef\": \"<string>\",\n \"from\": \"<string>\",\n \"receivedAt\": \"2023-11-07T05:31:56Z\",\n \"text\": \"<string>\",\n \"documents\": [\n {\n \"artifactId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "<string>",
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"documents": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"part": "<string>"
}
],
"rejected": [
{
"part": "<string>",
"name": "<string>",
"code": "<string>"
}
]
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "<string>",
"externalId": "<string>",
"threadRef": "<string>",
"from": "<string>",
"receivedAt": "2023-11-07T05:31:56Z",
"documents": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"part": "<string>"
}
],
"rejected": [
{
"part": "<string>",
"name": "<string>",
"code": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Authorizations
Body
The message’s text.
1 - 200000Response
A retry with the same externalId and body: the message as first added.