# Replace the QA rubric

`PUT https://api.morevoice.ai/v1/qa/rubric`

Replaces the organisation's rubric. Weights are relative, on one 0–100 scale (only the ratios count). Calls scored from now on use it; existing scorecards keep the rubric they were scored with.

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `qa_update_rubric`.

## Parameters

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |

## Request body

Required, `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | `object[]` | yes | The items, in order; keys must be unique and at least one item needs a weight above 0. |
| `name` | `string` | no | Default: "Default QA rubric". |
| `pass_threshold` | `number` | no | Default 70. |

Example:

```json
{
  "items": [
    {
      "key": "discovery",
      "label": "Discovery",
      "weight": 60
    },
    {
      "key": "closing",
      "label": "Next step",
      "type": "boolean",
      "weight": 40
    }
  ],
  "pass_threshold": 75
}
```

## Responses

### 200 OK

OK Returns `QaRubric`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"qa_rubric"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `pass_threshold` | `number` | A call passes at this score (0–100) or above, with no critical item failed. |
| `items` | `object[]` | — |
| `builtin` | `boolean` | true: the built-in rubric (you have not saved your own). |

Example:

```json
{
  "builtin": false,
  "items": [
    {
      "critical": true,
      "description": "Says the call is recorded before any commitment.",
      "key": "disclosure",
      "label": "Disclosure",
      "type": "scale",
      "weight": 30
    },
    {
      "critical": false,
      "description": "Open questions before offering a solution.",
      "key": "discovery",
      "label": "Discovery",
      "type": "scale",
      "weight": 40
    },
    {
      "critical": false,
      "description": "Agrees a dated next step.",
      "key": "closing",
      "label": "Next step",
      "type": "boolean",
      "weight": 30
    }
  ],
  "livemode": true,
  "name": "Sales and service",
  "object": "qa_rubric",
  "pass_threshold": 70
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const qaRubric = await mv.qa.updateRubric({
	items: [
		{
			key: "discovery",
			label: "Discovery",
			weight: 60,
		},
		{
			key: "closing",
			label: "Next step",
			type: "boolean",
			weight: 40,
		},
	],
	pass_threshold: 75,
});
console.log(qaRubric);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

qa_rubric = client.qa.update_rubric({
    "items": [
        {
            "key": "discovery",
            "label": "Discovery",
            "weight": 60,
        },
        {
            "key": "closing",
            "label": "Next step",
            "type": "boolean",
            "weight": 40,
        },
    ],
    "pass_threshold": 75,
})
print(qa_rubric)
```

**cURL**

```sh
curl -X PUT https://api.morevoice.ai/v1/qa/rubric \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    {
      "key": "discovery",
      "label": "Discovery",
      "weight": 60
    },
    {
      "key": "closing",
      "label": "Next step",
      "type": "boolean",
      "weight": 40
    }
  ],
  "pass_threshold": 75
}'
```
