> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canary.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate a submission from broker documents

> Take a broker submission from its files or email to a premium, a quote and a bind with the public API.

Your system can take a broker's submission from documents to a bound quote without anyone opening
Effective. You create the submission and add the broker's files or email; an extraction reads
them. You accept what it proposes, read the premium, then quote, bind or decline. All of it uses
your API key.

## Before you start

* An [API key](https://docs.canary.effectiveai.app/getting-started/authentication.md) for a member who can create and edit
  underwriting submissions, in a workspace with underwriting turned on. Ask Effective to turn it
  on.
* A released program that calculates a premium. This guide uses the synthetic staffing program
  from [Turn guidelines into a program](https://docs.canary.effectiveai.app/guides/underwriting/write-guidelines.md),
  [uploaded and released](https://docs.canary.effectiveai.app/rsl/programs-on-effective.md#releases) as `example-staffing`.
* The key's member [holds the program's `uw` role](https://docs.canary.effectiveai.app/rsl/programs-on-effective#submission-logs).
  Values are written as that member, in that role.
* `curl`, `jq` and `uuidgen`.

The [submission operations](https://docs.canary.effectiveai.app/guides/underwriting/submissions.md) are alpha.

Check the program is ready for your key before you send submissions:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PROGRAM_ID=example-staffing

curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/programs/$PROGRAM_ID/readiness" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

`ready` is `true` when every condition in `conditions` holds. Each one that doesn't says what is
missing in `detail`, such as a program role your key's member doesn't hold. `acts` lists the
program's quote (`offer`), bind (`accept`) and decline (`refuse`) acts.

## Create the submission

Create the submission on the program. Every create needs a new `Idempotency-Key`, which becomes
the submission's `id`.

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
SUBMISSION_ID=$(curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data "$(jq -n --arg program "$PROGRAM_ID" \
    '{programId: $program, insuredName: "Example Staffing"}')" | jq -r '.id')
```

## Add the broker's documents

Brokers send a submission as files, or as an email with the files attached. Use the option that
matches what you received. Both end with the documents on the submission.

Save these two synthetic files for either option:

```text application.txt theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Named insured: Example Staffing
Operations: Temporary staffing
Years in operation: 4
Annual payroll: $2,500,000
Requested limit: $1,000,000
```

```text loss-runs.txt theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Loss runs, Example Staffing, 2021-2026
No claims reported in the past five years.
```

### Option 1: upload the files

Send the files in one request, as `file` parts of a multipart form:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/documents" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --form "file=@application.txt;type=text/plain" \
  --form "file=@loss-runs.txt;type=text/plain"
```

The response lists the new `documents`, any file the store `rejected`, and `extraction`: whether
the files started one.

```json theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
{
  "documents": [
    { "id": "…", "name": "application.txt", "mimeType": "text/plain" },
    { "id": "…", "name": "loss-runs.txt", "mimeType": "text/plain" }
  ],
  "rejected": [],
  "extraction": { "status": "started", "extractionId": "…" }
}
```

The response is abbreviated and illustrative. A retry with the same `Idempotency-Key` and the same
files adds nothing more. One request takes up to 20 files and 25 MiB. For a larger file, use the
[three-call upload](https://docs.canary.effectiveai.app/guides/underwriting/submissions.md#add-the-brokers-files).

### Option 2: add the broker's email

Save the broker's email as an `.eml` file. This synthetic one carries both files as attachments:

```text broker-email.eml theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
From: Broker <broker@example.com>
To: submissions@example.com
Subject: New submission - Example Staffing
Date: Tue, 01 Dec 2026 09:00:00 +0000
Message-ID: <example-staffing-1@mail.example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="part"

--part
Content-Type: text/plain; charset=utf-8

Please quote Example Staffing. Application and loss runs attached.

--part
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="application.txt"

Named insured: Example Staffing
Operations: Temporary staffing
Years in operation: 4
Annual payroll: $2,500,000
Requested limit: $1,000,000

--part
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="loss-runs.txt"

Loss runs, Example Staffing, 2021-2026
No claims reported in the past five years.

--part--
```

Upload the `.eml` as in option 1, with type `message/rfc822`, and keep its document's `id` as
`EML_ID`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
EML_ID=$(curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/documents" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --form "file=@broker-email.eml;type=message/rfc822" | jq -r '.documents[0].id')
```

Then add it to the submission as the broker's message, with its Message-ID as `externalId`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/messages" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --data "$(jq -n --arg eml "$EML_ID" \
    '{channel: "email", externalId: "<example-staffing-1@mail.example.com>", raw: {artifactId: $eml}}')"
```

The response lists the email's `documents`: the `.eml` itself, its body as `Email.txt`, and each
attachment as a document of its own. Sending the same `externalId` again answers the same
message.

Brokers can also email the program's intake address, which makes the submission and adds the
email by itself. See [Take in submissions by email](https://docs.canary.effectiveai.app/guides/underwriting/submissions.md#take-in-submissions-by-email).

## Read the extraction

Where the workspace starts an extraction when documents arrive, adding them started one. Read the
submission's `latestExtraction` for its `id`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
EXTRACTION_ID=$(curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" | jq -r '.latestExtraction.id // empty')
```

If it's empty, no extraction started. Start one after the last document is added. An empty
request reads every document on the submission:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
[ -n "$EXTRACTION_ID" ] || EXTRACTION_ID=$(curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/extractions" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{}' | jq -r '.id')
```

Starting one yourself is safe even when one started on arrival: if an extraction is running,
yours waits behind it and reads the documents as they are when it starts. The extraction you
started always covers every document.

Read the extraction until its `status` is `completed`, `failed` or `cancelled`. While it's
`queued` or `running`, wait the seconds in its `Retry-After` header before reading again.

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/extractions/$EXTRACTION_ID" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

A completed extraction lists what it read in `documents` and what it proposes in
`result.proposals`, each with the place it read it:

```json theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
{
  "status": "completed",
  "result": {
    "proposals": [
      {
        "path": "policy.payroll",
        "value": 2500000,
        "from": {
          "document": "application",
          "region": "p1",
          "quote": "Annual payroll: $2,500,000"
        },
        "status": "valid"
      }
    ]
  }
}
```

The response is abbreviated and illustrative. For a failed extraction, read `failure.code` and
`failure.message`, then start a new one. To be told when an extraction ends instead of reading it,
subscribe a [webhook endpoint](https://docs.canary.effectiveai.app/guides/webhooks.md) to
`underwriting_submission.extraction.completed` and `underwriting_submission.extraction.failed`.

## Accept the proposals

Check the proposals against their quotes, then accept them. `{ "all": true }` accepts every valid
proposal that isn't in conflict; to accept some, name them in `paths`.

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/extractions/$EXTRACTION_ID/accept" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{ "all": true }'
```

The response lists the paths `accepted`, and those `skipped` with why. Each accepted value is
written to the submission with the quote it was read from.

## Set the underwriter's values

Set any input the documents don't answer. The staffing program reserves `policy.experience` for
the underwriter, so the extraction doesn't propose it, and it needs a reason in `because`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/values" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{
    "values": [
      { "path": "policy.experience", "value": "no_claims",
        "because": "Loss runs show no claims in five years." }
    ]
  }'
```

An input reserved for a role, sent without `because`, answers `422 log_refused` with
`REASON_REQUIRED`.

## Read the premium

Get the submission. `stage` says where it stands, and `rating` what the program computes:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

With every input answered, the staffing submission is `ready_to_quote`, with a premium of
\$5,000:

```json theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
{
  "stage": "ready_to_quote",
  "rating": { "status": "ready", "outcomes": { "premium": 5000 }, "seq": 9 },
  "questions": [],
  "quotes": [],
  "outstanding": []
}
```

The response is abbreviated and illustrative. While the stage is `needs_review` or `needs_info`,
`questions` lists each input the program still asks, the role that answers it, and what the
extraction proposed for it; `outstanding` lists what the extraction left open. `referred` means a
rule waits for a sign-off, and `ineligible` that the answers break a rule, with each one in
`declines`.

## Quote

When the stage is `ready_to_quote`, quote the submission. Send `rating.seq` as `basedOn`, so the
quote is refused if the values changed since you read the premium:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/quotes" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{ "basedOn": 9 }'
```

The response is the submission, now `quoted`, with the quote in `quotes`:

```json theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
{
  "stage": "quoted",
  "quotes": [{ "name": "q1", "outcomes": { "premium": 5000 }, "stands": true, "accepted": false }],
  "log": { "seq": 10 }
}
```

The response is abbreviated and illustrative. Quotes are named `q1`, `q2` and so on unless you
send a `name`. A quote `stands` while the values it was given on stay the same. The request uses
the program's offer act; where the program declares several, name one in `act`.

## Bind or decline

Bind a quote that stands, based on the latest `log.seq`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/bind" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{ "basedOn": 10, "quote": "q1" }'
```

The submission is then `bound`. To decline instead, send why in `because`:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions/$SUBMISSION_ID/decline" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: $(uuidgen | tr '[:upper:]' '[:lower:]')" \
  --data '{ "basedOn": 10, "because": "Outside appetite for staffing." }'
```

The submission is then `declined`. Both end its log. A `409 conflict` means a value changed after
the `basedOn` entry: read the submission again. A `422 log_refused` names why the program refused
the act, such as `NO_OFFER` for a quote that no longer stands, or `NOT_DECLINABLE` when the
program allows a decline only for a submission its rules found ineligible.

## Follow your submissions

List submissions at a stage, newest first, to find the ones that need you:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/underwriting/submissions?programId=$PROGRAM_ID&stage=needs_review,ready_to_quote" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

The stage filter is applied to each page, so a page can hold fewer than `limit` submissions and
still return a `nextCursor`. Keep reading until there is none.

To be told instead, subscribe a [webhook endpoint](https://docs.canary.effectiveai.app/guides/webhooks.md) to
`underwriting_submission.updated`. It is sent each time a value or a decision is written to a
submission. It carries the log's `status` and `seq`; read the submission at `subject.$uri` for its
`stage`.

## Who can act

Your API key accepts proposals, sets values, quotes, binds and declines as the member it belongs
to, in the program role that member holds. A member with no role of the program gets
`403 no_program_role`; a workspace administrator can act in any of its roles. See
[Rule on the proposals](https://docs.canary.effectiveai.app/guides/underwriting/submissions.md#rule-on-the-proposals).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.