curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {
"environment": "https://legacy.example.com",
"companyId": "legacy-company-42",
"fileId": "legacy-file-17"
},
"revision": {
"bucket": "legacy-company-files",
"object": "documents/loss-run.pdf",
"generation": "1720000000000000",
"byteSize": 102400,
"contentType": "application/pdf",
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg=="
},
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster",
"originalFilename": "loss-run.pdf"
},
"attachments": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"entityType": "company",
"entityId": null,
"category": "Loss Runs",
"sourceFolderId": null,
"folders": []
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile"
payload = {
"source": {
"environment": "https://legacy.example.com",
"companyId": "legacy-company-42",
"fileId": "legacy-file-17"
},
"revision": {
"bucket": "legacy-company-files",
"object": "documents/loss-run.pdf",
"generation": "1720000000000000",
"byteSize": 102400,
"contentType": "application/pdf",
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg=="
},
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster",
"originalFilename": "loss-run.pdf"
},
"attachments": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"entityType": "company",
"entityId": None,
"category": "Loss Runs",
"sourceFolderId": None,
"folders": []
}
]
}
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({
source: {
environment: 'https://legacy.example.com',
companyId: 'legacy-company-42',
fileId: 'legacy-file-17'
},
revision: {
bucket: 'legacy-company-files',
object: 'documents/loss-run.pdf',
generation: '1720000000000000',
byteSize: 102400,
contentType: 'application/pdf',
md5Hash: '1B2M2Y8AsgTpgAmY7PhCfg=='
},
versionId: '550e8400-e29b-41d4-a716-446655440021',
metadata: {
displayName: 'Loss run.pdf',
displayDate: '2020-01-02T03:04:05.000Z',
displayAuthor: 'Legacy adjuster',
originalFilename: 'loss-run.pdf'
},
attachments: [
{
sourceAttachmentId: 'primary:legacy-file-17',
entityType: 'company',
entityId: null,
category: 'Loss Runs',
sourceFolderId: null,
folders: []
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile', 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}/files/migrations/reconcile",
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([
'source' => [
'environment' => 'https://legacy.example.com',
'companyId' => 'legacy-company-42',
'fileId' => 'legacy-file-17'
],
'revision' => [
'bucket' => 'legacy-company-files',
'object' => 'documents/loss-run.pdf',
'generation' => '1720000000000000',
'byteSize' => 102400,
'contentType' => 'application/pdf',
'md5Hash' => '1B2M2Y8AsgTpgAmY7PhCfg=='
],
'versionId' => '550e8400-e29b-41d4-a716-446655440021',
'metadata' => [
'displayName' => 'Loss run.pdf',
'displayDate' => '2020-01-02T03:04:05.000Z',
'displayAuthor' => 'Legacy adjuster',
'originalFilename' => 'loss-run.pdf'
],
'attachments' => [
[
'sourceAttachmentId' => 'primary:legacy-file-17',
'entityType' => 'company',
'entityId' => null,
'category' => 'Loss Runs',
'sourceFolderId' => null,
'folders' => [
]
]
]
]),
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://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile"
payload := strings.NewReader("{\n \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\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://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile")
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 \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"fileId": "550e8400-e29b-41d4-a716-446655440020",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster"
},
"conflicts": [],
"placements": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"status": "imported",
"placementId": "550e8400-e29b-41d4-a716-446655440022",
"folderId": null,
"category": "Loss Runs",
"conflicts": []
}
]
}Reconcile File Migration Metadata
Last step of a migration document load. After Finalize File Migration (finalizeCompanyFileMigration), it attaches the file to its records, recreates its folders, and sets its document categories and display metadata. Read every placement result in the response, because one conflicted attachment does not stop the others.
Reconciles display metadata and eligible owner placements after integrity-checked finalization. The revision must still be active, even when several generations share the same version ID. Provision categories idempotently, reusing case-insensitive existing definitions and their spelling, color and order. Recreate folder ancestry by stable source-folder identity scoped to the destination owner. File and placement fields change only while they still equal their last imported value; matching desired values are adopted without another write. Operator edits, deleted targets and remapped associations produce explicit conflicts. Equal source associations for one owner coalesce into one placement; incompatible metadata conflicts. Inspect every placement result: one blocked or conflicted attachment does not prevent unrelated valid attachments from completing.
Available only while the destination company is in Sandbox mode. Forms are outside this contract.
Required permission: file.upload
Also requires file.view and file.edit and file.configure-categories.
curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {
"environment": "https://legacy.example.com",
"companyId": "legacy-company-42",
"fileId": "legacy-file-17"
},
"revision": {
"bucket": "legacy-company-files",
"object": "documents/loss-run.pdf",
"generation": "1720000000000000",
"byteSize": 102400,
"contentType": "application/pdf",
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg=="
},
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster",
"originalFilename": "loss-run.pdf"
},
"attachments": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"entityType": "company",
"entityId": null,
"category": "Loss Runs",
"sourceFolderId": null,
"folders": []
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile"
payload = {
"source": {
"environment": "https://legacy.example.com",
"companyId": "legacy-company-42",
"fileId": "legacy-file-17"
},
"revision": {
"bucket": "legacy-company-files",
"object": "documents/loss-run.pdf",
"generation": "1720000000000000",
"byteSize": 102400,
"contentType": "application/pdf",
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg=="
},
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster",
"originalFilename": "loss-run.pdf"
},
"attachments": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"entityType": "company",
"entityId": None,
"category": "Loss Runs",
"sourceFolderId": None,
"folders": []
}
]
}
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({
source: {
environment: 'https://legacy.example.com',
companyId: 'legacy-company-42',
fileId: 'legacy-file-17'
},
revision: {
bucket: 'legacy-company-files',
object: 'documents/loss-run.pdf',
generation: '1720000000000000',
byteSize: 102400,
contentType: 'application/pdf',
md5Hash: '1B2M2Y8AsgTpgAmY7PhCfg=='
},
versionId: '550e8400-e29b-41d4-a716-446655440021',
metadata: {
displayName: 'Loss run.pdf',
displayDate: '2020-01-02T03:04:05.000Z',
displayAuthor: 'Legacy adjuster',
originalFilename: 'loss-run.pdf'
},
attachments: [
{
sourceAttachmentId: 'primary:legacy-file-17',
entityType: 'company',
entityId: null,
category: 'Loss Runs',
sourceFolderId: null,
folders: []
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile', 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}/files/migrations/reconcile",
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([
'source' => [
'environment' => 'https://legacy.example.com',
'companyId' => 'legacy-company-42',
'fileId' => 'legacy-file-17'
],
'revision' => [
'bucket' => 'legacy-company-files',
'object' => 'documents/loss-run.pdf',
'generation' => '1720000000000000',
'byteSize' => 102400,
'contentType' => 'application/pdf',
'md5Hash' => '1B2M2Y8AsgTpgAmY7PhCfg=='
],
'versionId' => '550e8400-e29b-41d4-a716-446655440021',
'metadata' => [
'displayName' => 'Loss run.pdf',
'displayDate' => '2020-01-02T03:04:05.000Z',
'displayAuthor' => 'Legacy adjuster',
'originalFilename' => 'loss-run.pdf'
],
'attachments' => [
[
'sourceAttachmentId' => 'primary:legacy-file-17',
'entityType' => 'company',
'entityId' => null,
'category' => 'Loss Runs',
'sourceFolderId' => null,
'folders' => [
]
]
]
]),
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://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile"
payload := strings.NewReader("{\n \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\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://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/reconcile")
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 \"source\": {\n \"environment\": \"https://legacy.example.com\",\n \"companyId\": \"legacy-company-42\",\n \"fileId\": \"legacy-file-17\"\n },\n \"revision\": {\n \"bucket\": \"legacy-company-files\",\n \"object\": \"documents/loss-run.pdf\",\n \"generation\": \"1720000000000000\",\n \"byteSize\": 102400,\n \"contentType\": \"application/pdf\",\n \"md5Hash\": \"1B2M2Y8AsgTpgAmY7PhCfg==\"\n },\n \"versionId\": \"550e8400-e29b-41d4-a716-446655440021\",\n \"metadata\": {\n \"displayName\": \"Loss run.pdf\",\n \"displayDate\": \"2020-01-02T03:04:05.000Z\",\n \"displayAuthor\": \"Legacy adjuster\",\n \"originalFilename\": \"loss-run.pdf\"\n },\n \"attachments\": [\n {\n \"sourceAttachmentId\": \"primary:legacy-file-17\",\n \"entityType\": \"company\",\n \"entityId\": null,\n \"category\": \"Loss Runs\",\n \"sourceFolderId\": null,\n \"folders\": []\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"fileId": "550e8400-e29b-41d4-a716-446655440020",
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster"
},
"conflicts": [],
"placements": [
{
"sourceAttachmentId": "primary:legacy-file-17",
"status": "imported",
"placementId": "550e8400-e29b-41d4-a716-446655440022",
"folderId": null,
"category": "Loss Runs",
"conflicts": []
}
]
}Authorizations
User-principal OAuth 2.0 Bearer authentication. Send a user-scoped Auth0 access token (audience = the app API audience) as Authorization: Bearer <jwt>. The request resolves to the user's identity and is authorized by their Role on the {companyId} in the path — the same role-based permissions the web app enforces. This is the path the MCP connector uses to act on a user's behalf; endpoints that accept it list both BearerAuth and ApiKeyAuth.
