# Create an underwriting rule set

Create a DRAFT rule set: a name, and optionally the deal stage and product it narrows to (both empty mean every deal). It judges nothing until it is published. Add rules with the rules route, then publish.

Access class: `workspace:admin`.

## Endpoint

`POST /v1/workspace/underwriting/rule-sets`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "appliesToProduct": "string",
    "appliesToStage": "string",
    "description": "string",
    "key": "string",
    "name": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "appliesToProduct": "string",
    "appliesToStage": "string",
    "createdAt": "string",
    "createdByAccountId": "",
    "description": "string",
    "hasUnpublishedChanges": true,
    "id": 1,
    "key": "string",
    "name": "string",
    "publishedAt": "string",
    "publishedByAccountId": "",
    "publishedVersion": 1,
    "rules": [
      {
        "active": "string",
        "condition": "string",
        "createdAt": "string",
        "id": "",
        "key": "string",
        "name": "string",
        "outcome": "string",
        "reasonTemplate": "string",
        "setId": "",
        "sortOrder": "string",
        "sourceText": "string",
        "updatedAt": "string",
        "weight": "string"
      }
    ],
    "seeded": true,
    "status": "string",
    "updatedAt": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
