Updated Nov 23, 20267 min read

Build a First Notice of Loss Intake Backend for Insurance Claims

How to build FNOL intake: a claim record that separates what was reported from what was verified, a policy-in-force check on the date of loss, readable claim numbers, photo uploads straight to storage, and a triage queue, on Postgres.

Illustration for Build a First Notice of Loss Intake Backend for Insurance Claims

First notice of loss is the moment an insurer learns that something happened, from a policyholder, an agent, a repair shop or a telematics device. The intake system opens the claim file, and coverage checks, reserves and adjuster assignment all start from what was recorded there.

Intake pulls in two directions. The record is built from an account given in a stressful moment, so it is rarely complete, yet it has to be good enough that a handler does not call the claimant back for the policy number.

What does an FNOL backend capture?

Across lines of business the core set is stable: policy identification, the date, time and location of the loss, a description of what happened, the parties involved, an initial assessment of damage or injury, and supporting material such as photographs, per this overview of FNOL data. Each line adds its own fields, such as vehicle drivability for auto or habitability for property, and a design guide for intake workflows makes the point that required fields should be enforced by the workflow and not left to whoever takes the call.

Part of intakeWhat the backend does
Policy identificationLooks up the policy and checks it was in force on the loss date
Loss detailsStores type, date, place and description with line-specific fields
Reported vs verifiedKeeps the claimant's statements apart from facts the system checked
EvidenceAccepts photos and documents through signed upload URLs
Claim numberIssues a readable, unique number at creation
TriagePublishes the new claim to a queue for routing

How do you separate reported from verified facts?

Store what the claimant said as given, and add the system's own checks as separate columns. A claim opened for a policy that lapsed two days before the loss date should still exist, because the report has to be preserved, and the policy_in_force flag records what the check found so a handler can decide. Rejecting at intake turns a coverage question into a lost record, and the claimant calls again with a different story.

The same idea applies to every derived value: the policy lookup result, the matched address, any fraud score. Each is a verified or inferred value with its own column and timestamp, and none overwrites the statement it was computed from.

How do you generate claim numbers?

Use a database sequence and format it, so numbers are unique under concurrency without a lock in application code. Per the PostgreSQL documentation on identity columns and sequences, a sequence hands out values that are never reused, with gaps if a transaction rolls back, which is fine for a claim number that only needs to be unique and readable. Build the display number from the year and the padded sequence value, for example CLM-2026-004812, and keep the numeric ID as the internal key.

How does Encore run the intake service?

Encore is a backend framework with built-in infrastructure, so the claims database, the evidence bucket and the triage topic are declared in the intake service. Per the GCP infrastructure docs and the AWS infrastructure docs, the deploy provisions Postgres, Cloud Storage or S3 and Pub/Sub or SNS and SQS in your own account, with the data staying there.

Application code passes through Encore and infrastructure guardrails to resources provisioned in your own AWS or GCP account.
Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

The intake endpoint, a signed upload for photos and the triage subscription:

// claims/claims.ts import { api, APIError } from "encore.dev/api"; import { SQLDatabase } from "encore.dev/storage/sqldb"; import { Bucket } from "encore.dev/storage/objects"; import { Topic, Subscription } from "encore.dev/pubsub"; const db = new SQLDatabase("claims", { migrations: "./migrations" }); const evidence = new Bucket("claim-evidence", { versioned: false }); const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; interface ClaimOpened { claimId: number; claimNumber: string; lossType: string; } const opened = new Topic<ClaimOpened>("claim-opened", { deliveryGuarantee: "at-least-once" }); interface ReportLoss { submissionId: string; // a random UUID generated by the client, so a retry cannot open a second claim policyNumber: string; lossDate: string; // YYYY-MM-DD lossType: "collision" | "theft" | "water" | "fire" | "other"; location: string; description: string; reporterName: string; reporterPhone: string; } export const report = api( { expose: true, method: "POST", path: "/claims" }, async (req: ReportLoss): Promise<{ claimNumber: string; policyInForce: boolean }> => { // The client creates it with crypto.randomUUID(), and later requests use it as proof of the claim. if (!UUID.test(req.submissionId)) throw APIError.invalidArgument("submissionId must be a random UUID"); if (!/^\d{4}-\d{2}-\d{2}$/.test(req.lossDate)) throw APIError.invalidArgument("lossDate must be YYYY-MM-DD"); if (req.description.trim().length < 10) throw APIError.invalidArgument("describe what happened"); // A retry republishes, so a claim stored before a failed publish still reaches triage. const prior = await db.queryRow<{ id: number; claim_number: string; policy_in_force: boolean }>` SELECT id, claim_number, policy_in_force FROM claims WHERE submission_id = ${req.submissionId}`; if (prior) { await opened.publish({ claimId: prior.id, claimNumber: prior.claim_number, lossType: req.lossType }); return { claimNumber: prior.claim_number, policyInForce: prior.policy_in_force }; } // Verified fact, stored apart from what the claimant reported. const policy = await db.queryRow<{ ok: boolean }>` SELECT true AS ok FROM policies WHERE policy_number = ${req.policyNumber} AND effective_from <= ${req.lossDate}::date AND effective_to >= ${req.lossDate}::date`; const inForce = policy?.ok ?? false; const row = await db.queryRow<{ id: number; claim_number: string }>` INSERT INTO claims (submission_id, policy_number, loss_date, loss_type, location, description, reporter_name, reporter_phone, policy_in_force) VALUES (${req.submissionId}, ${req.policyNumber}, ${req.lossDate}::date, ${req.lossType}, ${req.location}, ${req.description}, ${req.reporterName}, ${req.reporterPhone}, ${inForce}) ON CONFLICT (submission_id) DO UPDATE SET submission_id = EXCLUDED.submission_id RETURNING id, claim_number`; await opened.publish({ claimId: row!.id, claimNumber: row!.claim_number, lossType: req.lossType }); return { claimNumber: row!.claim_number, policyInForce: inForce }; }, ); // Photos go straight to the bucket; only the key is stored on the claim. // The claim number alone is guessable, so the caller must also present the // submissionId, a random UUID that only the claimant's device knows. export const photoUploadUrl = api( { expose: true, method: "POST", path: "/claims/:claimNumber/photos" }, async (req: { claimNumber: string; submissionId: string; fileName: string }): Promise<{ url: string; key: string }> => { if (!/^[A-Za-z0-9._-]{1,80}$/.test(req.fileName)) throw APIError.invalidArgument("bad file name"); if (!UUID.test(req.submissionId)) throw APIError.invalidArgument("submissionId must be a random UUID"); const claim = await db.queryRow<{ id: number }>` SELECT id FROM claims WHERE claim_number = ${req.claimNumber} AND submission_id = ${req.submissionId}`; if (!claim) throw APIError.notFound("unknown claim"); const key = `${req.claimNumber}/${crypto.randomUUID()}-${req.fileName}`; await db.exec`INSERT INTO claim_documents (claim_id, object_key) VALUES (${claim.id}, ${key})`; const signed = await evidence.signedUploadUrl(key, { ttl: 900 }); return { url: signed.url, key }; }, ); // Routes each new claim to a queue; a redelivery finds the row already assigned. new Subscription(opened, "triage", { retryPolicy: { minBackoff: "10s", maxBackoff: "5m", maxRetries: 5 }, handler: async ({ claimId, lossType }) => { const queue = lossType === "collision" || lossType === "theft" ? "auto" : "property"; await db.exec`UPDATE claims SET queue = ${queue} WHERE id = ${claimId} AND queue IS NULL`; }, });
-- claims/migrations/1_init.up.sql CREATE TABLE policies ( policy_number TEXT PRIMARY KEY, insured_name TEXT NOT NULL, effective_from DATE NOT NULL, effective_to DATE NOT NULL ); CREATE SEQUENCE claim_number_seq; CREATE TABLE claims ( id BIGSERIAL PRIMARY KEY, claim_number TEXT NOT NULL UNIQUE DEFAULT ('CLM-' || to_char(now(), 'YYYY') || '-' || lpad(nextval('claim_number_seq')::text, 6, '0')), submission_id TEXT NOT NULL UNIQUE, policy_number TEXT NOT NULL, loss_date DATE NOT NULL, loss_type TEXT NOT NULL, location TEXT NOT NULL, description TEXT NOT NULL, reporter_name TEXT NOT NULL, reporter_phone TEXT NOT NULL, policy_in_force BOOLEAN NOT NULL, queue TEXT, created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE TABLE claim_documents ( id BIGSERIAL PRIMARY KEY, claim_id BIGINT NOT NULL REFERENCES claims (id), object_key TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ NOT NULL DEFAULT now() );

The claim is accepted whether or not the policy was in force, and policy_in_force carries the result for the handler. The submission_id makes a retried request return the original claim, and the triage handler only sets a queue that is still empty, so a redelivered message changes nothing. Per the object storage docs, the signed URL is limited to one key and expires after its time to live, which is 15 minutes here. Locally, encore run starts Postgres, Pub/Sub and a bucket for the same code, per the Pub/Sub docs.

To deploy, connect your AWS or GCP account as described in Connect your cloud account and push with git push encore. Claim data and photos stay in your own account, and access to them is governed by your own IAM and retention rules.

A coding agent asked to add a line-specific field such as vehicle drivability changes the migration and the endpoint in one pull request and runs it against a local database, with no console steps.

Best fit: Insurers and insurtech teams that want a claim intake service with verified facts kept apart from reported ones, deployed to their own cloud account.

What should you test before go-live?

Submit the same submissionId twice and confirm one claim exists. Report a loss dated before the policy's effective date and confirm the claim is created with policy_in_force false, then upload a photo with the signed URL and confirm the key appears on the claim.

Frequently asked questions

What is first notice of loss in insurance software?

First notice of loss, or FNOL, is the first report to an insurer that a loss may have occurred. The intake system records the policy number, the date, time and place of the loss, a description and any photos, opens a claim file and routes it for handling, without deciding coverage.

What should an FNOL API check at intake?

Check that the policy number exists and was in force on the date of loss, that required fields for the loss type are present, and that the same submission has not already opened a claim. Record the result of the check on the claim, but accept the report either way, since a claimant who is turned away at intake has not stopped having a loss.

How do I store photos and documents for a claim?

Have the client upload straight to object storage with a short-lived signed URL, and store only the object key and content type on the claim. Large files then never pass through the API, and the claim record stays small.

How do I deploy an FNOL backend to my own cloud without managing infrastructure code?

With Encore you declare the Postgres database, the storage bucket and the triage topic in the service, and deploying provisions them in your own AWS or GCP account. Locally, encore run starts the same resources.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders