# Deals API

> Deals in the Broker & Agent API: list the review queue; approve an item, or send it back.

Base URL: `https://workspace.brokerandagent.com/api/public/v1`. Every call needs an [API key or OAuth token](https://brokerandagent.com/developers/api/authentication).

- [List the review queue](#list-the-review-queue): `GET /compliance/queue`
- [Approve an item, or send it back](#approve-an-item-or-send-it-back): `POST /compliance/reviews/{id}`

## List the review queue

`GET /compliance/queue`

Checklist items agents sent to the office, oldest first, at the places the credential's person reviews (Owner, Admin, Office manager or Compliance there), and nothing from anywhere else. `queues` counts what waits in each. 403 for someone who reviews nowhere.

Scope: `crm.read`

**Parameters**

| Name | In | Type | |
|---|---|---|---|
| `queue` | query | string | One queue's id (from `queues`); every queue when absent. |

```bash
curl https://workspace.brokerandagent.com/api/public/v1/compliance/queue \
  -H "Authorization: Bearer bak_YOUR_KEY"
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | The queue. | { `queues`: array of [ReviewQueueEntry](https://brokerandagent.com/developers/api/reference/objects#reviewqueueentry), `items`: array of [ReviewItem](https://brokerandagent.com/developers/api/reference/objects#reviewitem) } |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

## Approve an item, or send it back

`POST /compliance/reviews/{id}`

Answers one item in the review queue: `approve`, or `return` with a `note` saying what to fix. The agent is told either way and the deal's activity records it. The first answer wins: one already answered is a 409 naming who answered; one at a place the person doesn't review is a 404.

Scope: `crm.write` · Role: transaction-coordinator or above

**Parameters**

| Name | In | Type | |
|---|---|---|---|
| `id` (required) | path | string |  |

**Body**

| Field | Type | |
|---|---|---|
| `decision` (required) | `approve`, `return` |  |
| `note` | string or null | Cut to 1000 characters. |

```bash
curl -X POST https://workspace.brokerandagent.com/api/public/v1/compliance/reviews/ID \
  -H "Authorization: Bearer bak_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"decision":"approve"}'
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | Answered. | { `review`: object } |
| `400` | The body isn't a JSON object (bad_json), or the Idempotency-Key is malformed (bad_idempotency_key). |  |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `404` | No such record, or one the credential's person can't see (not_found). |  |
| `409` | A request with this Idempotency-Key is still being handled (idempotency_in_progress, with Retry-After), or the call conflicts with the record's state (flow_off, in_progress). |  |
| `422` | A field is the wrong kind or breaks a rule, named in the message (validation); or the Idempotency-Key was used for a different request (idempotency_key_reused). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

---

Source: https://brokerandagent.com/developers/api/reference/deals
