# Issue routes: estimate, reopen, resolve

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

> The Issue Verbs estimate, reopen, resolve as api.sb routes, with inputs, result, refusals and an example.

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

### Issue.estimate
Estimate records the effort an Issue needs, in days, so a week holds only what fits. [Verb page](/business/nouns/issue/estimate?interface=api).

```text
POST /{namespace}/issues/{issue}/estimate
```

Path: `issue`. Body, as JSON: the other inputs. Emits [`Issue.estimated`](/business/events/Issue.estimated).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The Issue to size. |
| `days` | `number` | Yes | The effort in working days. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The estimated Issue. |

**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/issues/issue_vWekeqrXCN/estimate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"days":1}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "issue": {
    "$id": "https://api.sb/leaseline.app/issues/issue_vWekeqrXCN",
    "$type": "Issue",
    "status": "pending",
    "mode": "try"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Issue.estimate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Issue.reopen
Reopen returns a resolved Issue to its owning Role when the fix does not hold. [Verb page](/business/nouns/issue/reopen?interface=api).

```text
POST /{namespace}/issues/{issue}/reopen
```

Path: `issue`. Body, as JSON: the other inputs. Emits [`Issue.reopened`](/business/events/Issue.reopened).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The resolved Issue. |
| `reason` | `text` | Yes | What still fails. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The reopened Issue. |

**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. |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |

**Example**

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "issue": {
    "$id": "https://api.sb/leaseline.app/issues/issue_vWekeqrXCN",
    "$type": "Issue",
    "status": "pending",
    "mode": "try"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Issue.reopen",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Issue.resolve
Resolve closes an Issue with its fix recorded and tells every Customer who reported it. [Verb page](/business/nouns/issue/resolve?interface=api).

```text
POST /{namespace}/issues/{issue}/resolve
```

Path: `issue`. Body, as JSON: the other inputs. Emits [`Issue.resolved`](/business/events/Issue.resolved).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The Issue to close. |
| `resolution` | `text` | Yes | What fixed it. |
| `change` | [Change](/business/nouns/change) | No | The Change whose full rollout fixed the Issue; its Version is recorded as the resolution. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `issue` | [Issue](/business/nouns/issue) | Yes | The resolved Issue. |

**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. |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |

**Example**

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "issue": {
    "$id": "https://api.sb/leaseline.app/issues/issue_vWekeqrXCN",
    "$type": "Issue",
    "status": "pending",
    "mode": "try"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Issue.resolve",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```