# Lead routes: assign, convert, disqualify

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

> The Lead Verbs assign, convert, disqualify as api.sb routes, with inputs, result, refusals and an example.

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

### Lead.assign
Assign gives a Lead one owner Worker, by round robin, territory or ICP fit, as the Startup’s routing Policy says. [Verb page](/business/nouns/lead/assign?interface=api).

```text
POST /{namespace}/leads/{lead}/assign
```

Path: `lead`. Body, as JSON: the other inputs. Emits [`Lead.assigned`](/business/events/Lead.assigned).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `lead` | [Lead](/business/nouns/lead) | Yes | The Lead to route. |
| `owner` | [Worker](/business/nouns/worker) | No | The Worker to own it; omitted, the routing Policy picks. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `lead` | [Lead](/business/nouns/lead) | Yes | The Lead, with its owner. |

**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/leads/lead_Kz1R9fhqzZ/assign \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "lead": {
    "$id": "https://api.sb/leaseline.app/leads/lead_Kz1R9fhqzZ",
    "$type": "Lead",
    "status": "new"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Lead.assign",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Lead.convert
Convert ends a qualified Lead’s pursuit as a Lead: it opens a Deal or routes the Lead to self-serve checkout. [Verb page](/business/nouns/lead/convert?interface=api).

```text
POST /{namespace}/leads/{lead}/convert
```

Path: `lead`. Body, as JSON: the other inputs. Emits [`Lead.converted`](/business/events/Lead.converted).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `lead` | [Lead](/business/nouns/lead) | Yes | The qualified Lead. |
| `offer` | [Offer](/business/nouns/offer) | Yes | The Offer the Deal pursues, or the checkout sells. |
| `route` | `string` | Yes | Where the Lead goes: `deal` for an assisted sale or `checkout` for self-serve. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | No | The opened Deal, when the route is `deal`. |
| `lead` | [Lead](/business/nouns/lead) | Yes | The Lead, now converted. |

**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/leads/lead_Kz1R9fhqzZ/convert \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"offer":"offer_2hzYe1ERo0","route":"Example route"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "deal": {
    "$id": "https://api.sb/leaseline.app/deals/deal_NgACZ6DcII",
    "$type": "Deal",
    "status": "Open"
  },
  "lead": {
    "$id": "https://api.sb/leaseline.app/leads/lead_Kz1R9fhqzZ",
    "$type": "Lead",
    "status": "converted"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Lead.convert",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Lead.disqualify
Disqualify ends a Lead’s pursuit because it fits no Offer, with the reason; its Contact record and Consent stay. [Verb page](/business/nouns/lead/disqualify?interface=api).

```text
POST /{namespace}/leads/{lead}/disqualify
```

Path: `lead`. Body, as JSON: the other inputs. Emits [`Lead.disqualified`](/business/events/Lead.disqualified).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `lead` | [Lead](/business/nouns/lead) | Yes | The Lead to disqualify. |
| `reason` | `string` | Yes | Why it fits no Offer. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `lead` | [Lead](/business/nouns/lead) | Yes | The Lead, now `disqualified`. |

**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/leads/lead_Kz1R9fhqzZ/disqualify \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason":"noFit"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "lead": {
    "$id": "https://api.sb/leaseline.app/leads/lead_Kz1R9fhqzZ",
    "$type": "Lead",
    "status": "disqualified"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Lead.disqualify",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```