# predict AWS opportunity quality score

`POST https://api.suger.cloud/org/{orgId}/cosell/referral/predict-quality-score`

Predict the AWS opportunity quality score (0-100) for a not-yet-submitted AWS co-sell opportunity draft. Runs a deterministic gate (placeholder/empty/product-pitch business problem) that caps the score at 0, then an LLM rubric that returns the predicted score, band, per-dimension breakdown, and prioritized fixes. Use it to show sellers how to improve a referral before submitting. It creates and modifies no referral and writes nothing to the CRM. It does invoke a language model and record AI usage for the organization, so run it when the seller asks how to improve a draft; it is not needed after every edit.

Scope: AWS only. There is no equivalent score for AZURE or GCP opportunities.

How this differs from ValidateReferral: ValidateReferral checks whether the required fields are present and well-formed, and reports same-titled open opportunities. This operation judges how good the narrative content is and returns per-dimension guidance on improving it. Run both before creating an AWS referral.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgId` | path | string | yes | Organization ID |

## Request Body

Required.

Content-Type: `application/json` · Schema: `structs.PredictQualityScoreRequest`

**`structs.PredictQualityScoreRequest`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `opportunity` | object | no | Opportunity is the ACE opportunity draft (AceOpportunityV2 shape). |

## Responses

### 200 — Predicted quality score

Content-Type: `application/json` · Schema: `structs.PredictQualityScoreResponse`

**`structs.PredictQualityScoreResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bucket` | string | no | Bucket is the predicted band: LOWEST, LOW, MEDIUM, HIGH, HIGHEST. |
| `dimensions` | array<structs.QualityScoreDimension> | no | Dimensions is the per-rubric-dimension breakdown. |
| `fixes` | array<structs.QualityScoreFix> | no | Fixes are prioritized suggestions, each tagged with the points it adds. |
| `gate` | array<structs.QualityScoreGateIssue> | no | Gate lists deterministic issues; non-empty means Score is 0. |
| `score` | integer | no | Score is the predicted AWS opportunity quality score, 0-100. |
| `verdict` | string | no | Verdict is a one-line human summary. |

**`structs.QualityScoreDimension`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `earned` | integer | no |  |
| `name` | string | no |  |
| `weight` | integer | no |  |

**`structs.QualityScoreFix`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string | no | Field is the ACE opportunity field path the fix applies to (e.g. Project.CustomerBusinessProblem, LifeCycle.NextSteps), so the UI can offer to apply a draft or jump to the field. Empty when unknown. |
| `fieldLabel` | string | no | FieldLabel is the form display name of Field (e.g. "Customer business problem"), for showing to sellers instead of the JSON path. |
| `points` | integer | no |  |
| `suggestion` | string | no |  |

**`structs.QualityScoreGateIssue`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string | no |  |
| `message` | string | no |  |

### 400 — Bad request error

Content-Type: `application/json` · Schema: `ErrorResponse`

**`ErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | ErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 500 — Internal server error

Content-Type: `application/json` · Schema: `ErrorResponse`

**`ErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | ErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

---

Interactive API reference: https://doc.suger.io/api/
