# API: Prioritization

| Method | Path | What it does | Scope |
|---|---|---|---|
| POST | `/v1/accounts/:id/intro-draft` | Draft an intro request for the teammate with the strongest path (nothing is sent) | `accounts:write` |
| POST | `/v1/accounts/:id/intro-request` | Ask a teammate for the intro (an internal message with the blurb; they send it themselves) (web app only) | `accounts:write` |
| GET | `/v1/accounts/:id/priority` | An account's priority score, tier and why | `accounts:read` |
| GET | `/v1/accounts/:id/priority/history` | How an account's priority and tier moved, and why | `accounts:read` |
| GET | `/v1/accounts/:id/warm-paths` | Teammates with a real two-way relationship at the account, with the evidence | `accounts:read` |
| GET | `/v1/network` | Your network as a lead source: accounts the team knows people at | `accounts:read` |
| GET | `/v1/priority/model` | The confirmed own-history model (null: rule-based), its recent versions and the settings | `accounts:read` |
| POST | `/v1/priority/model/:id/confirm` | Confirm a trained version: it starts ranking accounts (owners, from the app) (web app only) | `settings:write` |
| POST | `/v1/priority/model/train` | Train a new version on your closed-won and closed-lost deals, in the background (owner; it waits for a person to confirm it) | `settings:write` |
| POST | `/v1/priority/refresh` | Recompute priority fields now (owner; up to 500 accounts, most recently changed first) | `settings:write` |
| PUT | `/v1/priority/settings` | Set the score weights and tier cutoffs (owner) | `settings:write` |
| POST | `/v1/search/compile` | Turn a description into removable facets (nothing is run) | `records:write` |
| POST | `/v1/search/run` | Run facets (edited or not) over the CRM | `search:read` |
| POST | `/v1/search/save` | Save matches as a dynamic list (the facets) or a static list (these records) | `records:write` |
| GET | `/v1/signal-analytics` | Which signals turn into meetings, deals and revenue (with lift over accounts without signals) | `accounts:read` |
| GET | `/v1/worklist` | Your ranked work list for today: each item's reason and suggested action | `accounts:read` |
| POST | `/v1/worklist/:id/:action` | Mark a work-list item done, snooze it (days, default 1) or dismiss it | `accounts:write` |
| POST | `/v1/worklist/:id/draft` | A ready draft for a work-list item, from its why-now evidence and research facts (nothing is sent) | `accounts:write` |

## Examples

### POST /v1/accounts/$ID/intro-draft

Draft an intro request for the teammate with the strongest path (nothing is sent)

```bash
curl -s -X POST "https://api.closefinch.com/v1/accounts/$ID/intro-draft" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/accounts/${id}/intro-draft`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/accounts/$ID/priority

An account's priority score, tier and why

```bash
curl -s "https://api.closefinch.com/v1/accounts/$ID/priority" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/accounts/${id}/priority`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/accounts/$ID/priority/history

How an account's priority and tier moved, and why

```bash
curl -s "https://api.closefinch.com/v1/accounts/$ID/priority/history" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/accounts/${id}/priority/history`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/accounts/$ID/warm-paths

Teammates with a real two-way relationship at the account, with the evidence

```bash
curl -s "https://api.closefinch.com/v1/accounts/$ID/warm-paths" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/accounts/${id}/warm-paths`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/network

Your network as a lead source: accounts the team knows people at

```bash
curl -s "https://api.closefinch.com/v1/network" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/network`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/priority/model

The confirmed own-history model (null: rule-based), its recent versions and the settings

```bash
curl -s "https://api.closefinch.com/v1/priority/model" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/priority/model`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/priority/model/train

Train a new version on your closed-won and closed-lost deals, in the background (owner; it waits for a person to confirm it)

```bash
curl -s -X POST "https://api.closefinch.com/v1/priority/model/train" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/priority/model/train`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/priority/refresh

Recompute priority fields now (owner; up to 500 accounts, most recently changed first)

```bash
curl -s -X POST "https://api.closefinch.com/v1/priority/refresh" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/priority/refresh`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### PUT /v1/priority/settings

Set the score weights and tier cutoffs (owner)

```bash
curl -s -X PUT "https://api.closefinch.com/v1/priority/settings" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/priority/settings`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/search/compile

Turn a description into removable facets (nothing is run)

```bash
curl -s -X POST "https://api.closefinch.com/v1/search/compile" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/search/compile`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/search/run

Run facets (edited or not) over the CRM

```bash
curl -s -X POST "https://api.closefinch.com/v1/search/run" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/search/run`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/search/save

Save matches as a dynamic list (the facets) or a static list (these records)

```bash
curl -s -X POST "https://api.closefinch.com/v1/search/save" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/search/save`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/signal-analytics

Which signals turn into meetings, deals and revenue (with lift over accounts without signals)

```bash
curl -s "https://api.closefinch.com/v1/signal-analytics" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/signal-analytics`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/worklist

Your ranked work list for today: each item's reason and suggested action

```bash
curl -s "https://api.closefinch.com/v1/worklist" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/worklist`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/worklist/$ID/$ACTION

Mark a work-list item done, snooze it (days, default 1) or dismiss it

```bash
curl -s -X POST "https://api.closefinch.com/v1/worklist/$ID/$ACTION" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/worklist/${id}/${action}`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/worklist/$ID/draft

A ready draft for a work-list item, from its why-now evidence and research facts (nothing is sent)

```bash
curl -s -X POST "https://api.closefinch.com/v1/worklist/$ID/draft" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/worklist/${id}/draft`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

Request and response schemas: [https://www.closefinch.com/openapi.json](https://www.closefinch.com/openapi.json). All resources: [API reference](https://www.closefinch.com/docs/api).
