# Problem routes: notify, rank, suggest, vote

URL: /code/api/problem/verbs · Id: `page:code/api/problem/verbs`

> The Problem Verbs notify, rank, suggest, vote as api.sb routes, with inputs, result, refusals and an example.

Reference for [Problem](/business/nouns/problem), one group of [Problem routes](/code/api/problem).

### Problem.notify
Notify tells every Contact who voted on a Problem that a Version addressing it shipped, with a link to the change. [Verb page](/business/nouns/problem/notify?interface=api).

```text
POST /{namespace}/problems/{problem}/notify
```

Path: `problem`. Body, as JSON: the other inputs. Emits [`Problem.notified`](/business/events/Problem.notified).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `problem` | [Problem](/business/nouns/problem) | Yes | The Problem the Version addresses. |
| `version` | [Version](/business/nouns/version) | No | The Version that shipped. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `problem` | [Problem](/business/nouns/problem) | Yes | The Problem, marked addressed. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB/notify \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "problem": {
    "$id": "https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB",
    "$type": "Problem",
    "statement": "Tracks lease renewals for small property managers."
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Problem.notify",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Problem.rank
Rank orders Problems by revenue at stake, Evidence grade and effort, so the next Project addresses the top one. [Verb page](/business/nouns/problem/rank?interface=api).

```text
POST /{namespace}/problems/rank
```

Body, as JSON: the inputs. Emits [`Problem.ranked`](/business/events/Problem.ranked).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `icp` | [ICP](/business/nouns/icp) | No | The ICP whose Problems to rank; omitted, every ICP. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `problems` | list of [Problem](/business/nouns/problem) | Yes | Problems, highest first, each with its score. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/problems/rank \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"icp":"icp_EwhsJU4AOW"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "problems": [
    {
      "$id": "https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB",
      "$type": "Problem",
      "statement": "Tracks lease renewals for small property managers."
    }
  ],
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Problem.rank",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Problem.suggest
Suggest records a Customer’s ask for something the Product lacks as Evidence on a Problem, with the asker attached. [Verb page](/business/nouns/problem/suggest?interface=api).

```text
POST /{namespace}/problems/suggest
```

Body, as JSON: the inputs. Emits [`Problem.suggested`](/business/events/Problem.suggested).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | `text` | Yes | The ask, in the asker’s words. |
| `problem` | [Problem](/business/nouns/problem) | No | The Problem it bears on; an Agent maps it when the asker names none. |
| `via` | `string` | No | Where it was asked: an App, the Portal, or an Agent’s answer. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `evidence` | [Evidence](/business/nouns/evidence) | Yes | The Evidence, Opinion grade, with `askedBy` set. |
| `problem` | [Problem](/business/nouns/problem) | Yes | The Problem with the new Evidence attached. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/problems/suggest \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Example text"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "evidence": {
    "$id": "https://api.sb/leaseline.app/evidence/evidence_6xsa6iYImd",
    "$type": "Evidence",
    "grade": "Behavior"
  },
  "problem": {
    "$id": "https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB",
    "$type": "Problem",
    "statement": "Tracks lease renewals for small property managers."
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Problem.suggest",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Problem.vote
Vote records a Contact saying a Problem on the public board is theirs too, with their words kept as Evidence. [Verb page](/business/nouns/problem/vote?interface=api).

```text
POST /{namespace}/problems/{problem}/vote
```

Path: `problem`. Body, as JSON: the other inputs. Emits [`Problem.voted`](/business/events/Problem.voted).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `problem` | [Problem](/business/nouns/problem) | Yes | The Problem. |
| `contact` | [Contact](/business/nouns/contact) | Yes | Who votes. |
| `words` | `text` | No | What they said, in their own words. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `problem` | [Problem](/business/nouns/problem) | Yes | The Problem, with the vote counted. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB/vote \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contact":"contact_WsrosCQi6J"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "problem": {
    "$id": "https://api.sb/leaseline.app/problems/problem_UzvXXfKsJB",
    "$type": "Problem",
    "statement": "Tracks lease renewals for small property managers."
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Problem.vote",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```