> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.paradigm.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paradigm.co/_mcp/server.

# Quote Creation Workflow

## ⛔ Old “GRFQ” Workflow

#### Successful Quote Creation

1. API Request Returns 200 OK with `status: OPEN`
2. Event is sent to `quote` channel with `kind: NEW`
3. Event is sent to `quote_book` channel with `kind: ADDED`

#### Error Quote Creation

1. API Returns 400
2. No Websockets Messages

## ✅ New “OB” Workflow

#### Successful Quote Creation

1. API Request Returns 202 OK, including `action_id` field with `status: PENDING`
2. Event is sent to `quote` channel with `kind: NEW`
3. Event is sent to `quote_book` channel with `kind: ADDED`
4. Event is sent to `quote_status` channel with matching `action_id` and `success: true`

#### Error Quote Creation - API Validations Fail

1. API Returns 400

#### Error Quote Creation - Order Book Validations Fail

1. API Request Returns 202 OK, including `action_id` field with `status: PENDING`
2. Event is sent to `quote` channel with `kind: CANCELED` and `status: CLOSED`
3. Event is sent to `quote_status` channel, with matching `action_id`, and `success: false`

> **Info**
>
> No WebSocket message is sent with the details of the pending quote, these details are only returned in the API Response

## 💬 Sample Messages

* `[POST] /rfqs/{rfq_id}/quotes/` API Response, Pending Quote Creation

  ```jsx
  {
      "id": "q_2YpMiJJRxTl6N66lGF5LOPsTdJY",
      "rfq_id": 50126520,
      "action_id": "538da55e-2617-418b-a60f-0fae2413ebdb",
      "client_order_id": "a823e52e-9238-4ca2-ac78-13ff96cdd732",
      "description": "Call  30 Nov 23  35000",
      "maker": "PDGM",
      "price": "0.053",
      "side": "BUY",
      "type": "LIMIT",
      "product_codes": [
          "DO"
      ],
      "created": 1701218193752.5461,
      "status": "PENDING"
  }
  ```
* `quote` Channel, Successfully Created Quote

  ```jsx
  {
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
      "channel": "quote",
      "data": {
        "kind": "NEW",
        "quote": {
          "status": "OPEN",
          "side": "BUY",
          "maker": "JAMMN",
          "original_quantity": "25.3",
          "client_order_id": "d62f11b5-e7a7-42c4-b28f-bef368de2d22",
          "legacy_id": 72983001,
          "price": "0.053",
          "id": "q_2Ym0K4wTjVfLEkditbWH5tFQ9ZW",
          "legs": [
            {
              "side": "BUY",
              "price": "0.053"
            }
          ],
          "remaining_quantity": "25.3",
          "filled_quantity": "0",
          "rfq_id": 50126134,
          "product_codes": [
            "DO"
          ],
          "type": "LIMIT",
          "created": 1701115380798.1218,
          "last_activity": 1701115380856.506,
          "description": "Call  30 Nov 23  35000"
        }
      },
      "meta": {
        "seq_group": 605630333,
        "seq_num": 10
      }
    }
  }
  ```
* `quote_book` Channel, Successfully Created Quote

  ```jsx
  {
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
      "channel": "quote_book",
      "data": {
        "kind": "ADDED",
        "quote": {
          "status": "OPEN",
          "side": "BUY",
          "legacy_id": 72983001,
          "price": "0.053",
          "created": 1701115380798.1218,
          "last_activity": 1701115380856.506,
          "id": "q_2Ym0K4wTjVfLEkditbWH5tFQ9ZW",
          "legs": [
            {
              "side": "BUY",
              "price": "0.053"
            }
          ],
          "remaining_quantity": "25.3",
          "rfq_id": 50126134
        }
      },
      "meta": {
        "seq_group": 80552588,
        "seq_num": 3324
      }
    }
  }
  ```
* `quote_status` Channel, Successful API Request

  ```jsx
  {
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
      "channel": "quote_status",
      "data": {
        "action_id": "71561c1f-f43b-4fb0-abc5-d7dcfbc81b0c",
        "kind": "create",
        "success": true
      },
      "meta": {
        "seq_group": 4113064136,
        "seq_num": 3
      }
    }
  }
  ```
* `quote_status` Channel, Error API Request

  ```jsx
  {
    "jsonrpc": "2.0",
    "method": "subscription",
    "params": {
      "channel": "quote_status",
      "data": {
        "action_id": "71561c1f-f43b-4fb0-abc5-d7dcfbc81b0c",
        "kind": "create",
        "success": false,
        "error_code": 3303,
        "error_message": "Limit of 2 for BUY-side quote reached. Please cancel an active quote before submitting a new one."
      },
      "meta": {
        "seq_group": 4113064136,
        "seq_num": 3
      }
    }
  }
  ```