curl --request PUT \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"eventOpenCloseHistory": [
{
"action": "open",
"effectiveOnDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
},
"effectiveAt": "2020-01-15T09:30:00-05:00",
"actionTakenDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2020-06-01",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2020-06-03",
"timezone": "America/New_York"
}
},
{
"action": "reopen",
"effectiveOnDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2021-08-20",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-08-22",
"timezone": "America/New_York"
}
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history"
payload = { "eventOpenCloseHistory": [
{
"action": "open",
"effectiveOnDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
},
"effectiveAt": "2020-01-15T09:30:00-05:00",
"actionTakenDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2020-06-01",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2020-06-03",
"timezone": "America/New_York"
}
},
{
"action": "reopen",
"effectiveOnDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2021-08-20",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-08-22",
"timezone": "America/New_York"
}
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventOpenCloseHistory: [
{
action: 'open',
effectiveOnDate: {date: '2020-01-15', timezone: 'America/New_York'},
effectiveAt: '2020-01-15T09:30:00-05:00',
actionTakenDate: {date: '2020-01-15', timezone: 'America/New_York'}
},
{
action: 'close',
effectiveOnDate: {date: '2020-06-01', timezone: 'America/New_York'},
actionTakenDate: {date: '2020-06-03', timezone: 'America/New_York'}
},
{
action: 'reopen',
effectiveOnDate: {date: '2021-02-10', timezone: 'America/New_York'},
actionTakenDate: {date: '2021-02-10', timezone: 'America/New_York'}
},
{
action: 'close',
effectiveOnDate: {date: '2021-08-20', timezone: 'America/New_York'},
actionTakenDate: {date: '2021-08-22', timezone: 'America/New_York'}
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history', 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://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'eventOpenCloseHistory' => [
[
'action' => 'open',
'effectiveOnDate' => [
'date' => '2020-01-15',
'timezone' => 'America/New_York'
],
'effectiveAt' => '2020-01-15T09:30:00-05:00',
'actionTakenDate' => [
'date' => '2020-01-15',
'timezone' => 'America/New_York'
]
],
[
'action' => 'close',
'effectiveOnDate' => [
'date' => '2020-06-01',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2020-06-03',
'timezone' => 'America/New_York'
]
],
[
'action' => 'reopen',
'effectiveOnDate' => [
'date' => '2021-02-10',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2021-02-10',
'timezone' => 'America/New_York'
]
],
[
'action' => 'close',
'effectiveOnDate' => [
'date' => '2021-08-20',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2021-08-22',
'timezone' => 'America/New_York'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history"
payload := strings.NewReader("{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"eventId": "550e8400-e29b-41d4-a716-446655440020",
"eventStatus": "closed"
}Replace Event Open/Close History
Replaces a claim’s or incident’s whole open, close and re-open history,
then sets its status and Closed Date from the last entry. Use it to load
the history of claims migrated from another system or to fix a history
entered wrong. For a close or re-open happening now, use Close Event
(closeEvent) or Re-open Event (reopenEvent).
Replaces an event’s whole open/close-history log with the one you send,
then derives the event’s status from it, in one atomic call: the stored log
is discarded wholesale, eventStatus and Closed Date are set from the
new log’s final entry (close → closed with that entry’s
effectiveOnDate; open/reopen → open with no close date).
This is the path for historical imports and history corrections. An
already-closed historical claim is created open and then closed by this
call (or resolved at create time by supplying eventOpenCloseHistory, or
openedOn and closedDate); a log that was loaded wrong — openedOn
included — is fixed by sending the corrected one. A create or a generic PATCH that
sends eventOpenCloseHistory applies the same rules. For
day-to-day lifecycle changes use
Close Event and
Re-open Event, which append
to the log instead of replacing it.
Every entry sub-field is yours to supply — including actionTakenDate,
the date the action was taken. A historical log carries the true dates;
nothing is server-stamped here.
Each entry may carry its exact moment, effectiveAt: a timestamp with
an offset or Z on the day of its effectiveOnDate, read in that date’s
timezone, stored in UTC to the second. Send effectiveTimeKnown: false
beside it when the time only stands in for one nobody knows. An entry sent
without effectiveAt takes the current time when its effectiveOnDate is
today in its timezone, and otherwise the start of that day, marked
effectiveTimeKnown: false.
The log must be well-formed. It must be non-empty, its first entry’s
action must be open, actions must strictly alternate close/reopen
after that (a claim cannot close twice in a row, or re-open while open),
and no entry may be earlier than the one listed before it, compared by
exact time once every entry is timed. A tie is allowed, and an entry whose
time nobody gave counts as the start of its day. An entry sent without
effectiveAt on the day of a later, timed entry before it is asked for its
time. A malformed log returns 400.
Restricted field. If your company’s configuration gives
eventOpenCloseHistory a writePermission, this call also requires that
field write group (event.field-<value>), exactly as a generic event
update naming the field would. A key without it receives 403 with error
code field-write-permission-required. Close Event and Re-open Event are
not affected: they append one server-built entry rather than letting you
author the log.
Required permission: event.edit
curl --request PUT \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"eventOpenCloseHistory": [
{
"action": "open",
"effectiveOnDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
},
"effectiveAt": "2020-01-15T09:30:00-05:00",
"actionTakenDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2020-06-01",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2020-06-03",
"timezone": "America/New_York"
}
},
{
"action": "reopen",
"effectiveOnDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2021-08-20",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-08-22",
"timezone": "America/New_York"
}
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history"
payload = { "eventOpenCloseHistory": [
{
"action": "open",
"effectiveOnDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
},
"effectiveAt": "2020-01-15T09:30:00-05:00",
"actionTakenDate": {
"date": "2020-01-15",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2020-06-01",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2020-06-03",
"timezone": "America/New_York"
}
},
{
"action": "reopen",
"effectiveOnDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-02-10",
"timezone": "America/New_York"
}
},
{
"action": "close",
"effectiveOnDate": {
"date": "2021-08-20",
"timezone": "America/New_York"
},
"actionTakenDate": {
"date": "2021-08-22",
"timezone": "America/New_York"
}
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventOpenCloseHistory: [
{
action: 'open',
effectiveOnDate: {date: '2020-01-15', timezone: 'America/New_York'},
effectiveAt: '2020-01-15T09:30:00-05:00',
actionTakenDate: {date: '2020-01-15', timezone: 'America/New_York'}
},
{
action: 'close',
effectiveOnDate: {date: '2020-06-01', timezone: 'America/New_York'},
actionTakenDate: {date: '2020-06-03', timezone: 'America/New_York'}
},
{
action: 'reopen',
effectiveOnDate: {date: '2021-02-10', timezone: 'America/New_York'},
actionTakenDate: {date: '2021-02-10', timezone: 'America/New_York'}
},
{
action: 'close',
effectiveOnDate: {date: '2021-08-20', timezone: 'America/New_York'},
actionTakenDate: {date: '2021-08-22', timezone: 'America/New_York'}
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history', 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://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'eventOpenCloseHistory' => [
[
'action' => 'open',
'effectiveOnDate' => [
'date' => '2020-01-15',
'timezone' => 'America/New_York'
],
'effectiveAt' => '2020-01-15T09:30:00-05:00',
'actionTakenDate' => [
'date' => '2020-01-15',
'timezone' => 'America/New_York'
]
],
[
'action' => 'close',
'effectiveOnDate' => [
'date' => '2020-06-01',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2020-06-03',
'timezone' => 'America/New_York'
]
],
[
'action' => 'reopen',
'effectiveOnDate' => [
'date' => '2021-02-10',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2021-02-10',
'timezone' => 'America/New_York'
]
],
[
'action' => 'close',
'effectiveOnDate' => [
'date' => '2021-08-20',
'timezone' => 'America/New_York'
],
'actionTakenDate' => [
'date' => '2021-08-22',
'timezone' => 'America/New_York'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history"
payload := strings.NewReader("{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/events/{eventId}/open-close-history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventOpenCloseHistory\": [\n {\n \"action\": \"open\",\n \"effectiveOnDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n },\n \"effectiveAt\": \"2020-01-15T09:30:00-05:00\",\n \"actionTakenDate\": {\n \"date\": \"2020-01-15\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2020-06-01\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2020-06-03\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"reopen\",\n \"effectiveOnDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-02-10\",\n \"timezone\": \"America/New_York\"\n }\n },\n {\n \"action\": \"close\",\n \"effectiveOnDate\": {\n \"date\": \"2021-08-20\",\n \"timezone\": \"America/New_York\"\n },\n \"actionTakenDate\": {\n \"date\": \"2021-08-22\",\n \"timezone\": \"America/New_York\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"eventId": "550e8400-e29b-41d4-a716-446655440020",
"eventStatus": "closed"
}