curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh \
--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=="
},
"previousUploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED"
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh"
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=="
},
"previousUploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED"
}
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=='
},
previousUploadUrl: 'https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED'
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh', 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/refresh",
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=='
],
'previousUploadUrl' => 'https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED'
]),
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/refresh"
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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\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/refresh")
.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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh")
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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\n}"
response = http.request(request)
puts response.read_body{
"sourceId": "550e8400-e29b-41d4-a716-446655440019",
"fileId": "550e8400-e29b-41d4-a716-446655440020",
"currentVersionId": null,
"revision": {
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"storageKey": "companies/example/files/550e8400-e29b-41d4-a716-446655440020/550e8400-e29b-41d4-a716-446655440021",
"state": "pending",
"uploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED",
"byteSize": 102400,
"contentType": "application/pdf"
},
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster"
},
"conflicts": []
}Refresh File Migration Upload
Recover a migration upload whose resumable upload URL expired or was lost, instead of calling Prepare File Migration (prepareCompanyFileMigration) again. Use the version id it returns for the retried upload and for Finalize File Migration (finalizeCompanyFileMigration).
Recovers an expired or lost resumable upload session for the active source revision. Supply the previous capability as a compare-and-swap token; stale concurrent refresh calls reuse the replacement session. When matching completed bytes already exist, verifies their size, MIME and checksums and finalizes the known version instead of retransferring. If the stored pending bytes fail size, MIME or checksum validation, replaces that unverified attempt with a new version, storage key and session under the same logical file. Persist the returned version ID before retrying; the previous attempt cannot finalize. An existing valid current version remains usable until the replacement verifies. Keep upload capabilities out of logs and diagnostics.
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.
curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh \
--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=="
},
"previousUploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED"
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh"
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=="
},
"previousUploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED"
}
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=='
},
previousUploadUrl: 'https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED'
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh', 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/refresh",
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=='
],
'previousUploadUrl' => 'https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED'
]),
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/refresh"
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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\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/refresh")
.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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/files/migrations/refresh")
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 \"previousUploadUrl\": \"https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED\"\n}"
response = http.request(request)
puts response.read_body{
"sourceId": "550e8400-e29b-41d4-a716-446655440019",
"fileId": "550e8400-e29b-41d4-a716-446655440020",
"currentVersionId": null,
"revision": {
"versionId": "550e8400-e29b-41d4-a716-446655440021",
"storageKey": "companies/example/files/550e8400-e29b-41d4-a716-446655440020/550e8400-e29b-41d4-a716-446655440021",
"state": "pending",
"uploadUrl": "https://storage.googleapis.com/upload/storage/v1/b/files/o?uploadType=resumable&upload_id=REDACTED",
"byteSize": 102400,
"contentType": "application/pdf"
},
"metadata": {
"displayName": "Loss run.pdf",
"displayDate": "2020-01-02T03:04:05.000Z",
"displayAuthor": "Legacy adjuster"
},
"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.
Body
Response
Durable migration state
