---
title: "Create RFQ"
description: "Ask makers for private quotes on a stable funding perp (an RFQ), giving a size and optionally a side."
---

A taker solicits private quotes for one STABLE_PERP instrument by giving a size and, optionally, a direction (`rfq.side`; leave it out for a two-way request). The request is unsigned: creating an RFQ commits the taker to nothing.

End-to-end flow:

1. The taker submits an RFQ here. (In the Grvt UI, entering a size on the trade page is the RFQ.)
2. Grvt broadcasts the RFQ to qualified makers on the `v1.rfq` stream, with an anonymous id instead of the taker's account and without its side. Makers can add ECN orders bound to it (`metadata.rfq_id`).
3. The `v1.quote` stream sends the taker, for each side of the book, the average fill price for the RFQ size and how much of it can fill, as the book changes.
4. The taker accepts by signing an IOC limit order with [create_order](create_order.md) and `metadata.rfq_id` set (one leg; its side must match `rfq.side` when that is set). Or the taker walks away and lets the RFQ expire.

The created RFQ is returned in the response. A sub-account may hold at most one open RFQ per instrument. The RFQ lives until `rfq.expiry`; then Grvt expires it and cancels the makers' orders bound to it. The sub-account must be in multi-asset mode.

| | |
|---|---|
| SDK | `client.create_rfq(...)` |
| HTTP | `POST https://trades.<domain>/full/v1/create_rfq`, or `/lite/v1/create_rfq` for [lite names](../../guides/environments.md#encoding-full-or-lite) (the SDKs' default) |
| WebSocket | method `v1/create_rfq` on `wss://trades.<domain>/ws/full`, or `/ws/lite` for lite names |
| Auth | Session required ([Authentication](../../guides/authentication.md)) |
| Retries | Write: never retried automatically ([why](../../guides/errors-and-retries.md)) |
| Contract id | `rfq.create_rfq` (`RPCCreateRfqV1`) |

## Request

Body type `ApiCreateRfqRequest`. Fields the server fills are left out.

- `rfq` · lite `r` · object Rfq · required — The RFQ to create
- `rfq.sub_account_id` · lite `sa` · string (uint64) · required — The sub-account initiating the RFQ
- `rfq.expiry` · lite `e` · string (int64 unix ns) · required — When the RFQ expires, in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
- `rfq.instrument` · lite `i` · string (instrument name) · required — The instrument to trade. Must be kind = STABLE_PERP
- `rfq.size` · lite `s` · string · required — Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
- `rfq.side` · lite `s1` · enum RfqSide · optional — Optional — omitted = two-way request. The Grvt UI always fills it; API takers may withhold direction and accept two-way quotes
  Values: `UNSPECIFIED`, `BUY`, `SELL` ([details](../enums.md#rfqside)).

## Response

Body type `ApiCreateRfqResponse` (the same object is the JSON-RPC `result` over WebSocket).

- `rfq` · lite `r` · object Rfq · required — The created RFQ
- `rfq.rfq_id` · lite `ri` · string (uint128) · required — Set by the server. The exchange's 128-bit id for the RFQ.
- `rfq.sub_account_id` · lite `sa` · string (uint64) · required — The sub-account initiating the RFQ
- `rfq.expiry` · lite `e` · string (int64 unix ns) · required — When the RFQ expires, in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
- `rfq.instrument` · lite `i` · string (instrument name) · required — The instrument to trade. Must be kind = STABLE_PERP
- `rfq.size` · lite `s` · string · required — Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
- `rfq.side` · lite `s1` · enum RfqSide · optional — Optional — omitted = two-way request. The Grvt UI always fills it; API takers may withhold direction and accept two-way quotes
  Values: `UNSPECIFIED`, `BUY`, `SELL` ([details](../enums.md#rfqside)).

## Errors

Errors come back as `{"code", "message", "status"}` (lite `{"c", "m", "s"}`) with the HTTP status. Codes this call can return, as code, name (HTTP status) ([all error codes](../errors.md)):

`1000` Unauthorized (401) · `1001` Forbidden (403) · `1002` InternalServer (500) · `1003` InvalidRequest (400) · `1004` NotFound (404) · `1006` RateLimit (429, retryable) · `2061` InstrumentNotSupported (400) · `2065` InvalidContractGrainSize (400) · `2141` RfqSubAccountDoesNotMatchLoggedInUser (403) · `2142` RfqInstrumentNotStablePerp (400) · `2143` RfqSizeBelowMinimum (400) · `2144` RfqSizeAboveMaximum (400) · `2145` RfqInvalidExpiry (400) · `2146` RfqAlreadyExistsForAsset (400) · `2147` StablePerpRequiresMultiAssetMode (400) · `7726` SfpMarketClosed (400)

## Example

```python
import os
from decimal import Decimal

from grvt import Grvt, Timestamp, models as m

with Grvt(
    env=os.environ.get("GRVT_ENV", "testnet"),
    api_key=os.environ["GRVT_API_KEY"],
) as client:
    resp = client.create_rfq(
        rfq=m.RfqInput(
            sub_account_id=os.environ["GRVT_SUB_ACCOUNT_ID"],
            expiry=Timestamp(int("1697788800000000000")),
            instrument="AAPL_USDC_SFP",
            size=Decimal("10.5"),
        ),
    )
    print(resp)
```

Raw HTTP (set `GRVT_DOMAIN`, see [Environments](../../guides/environments.md); `GRVT_COOKIE` and `GRVT_ACCOUNT_ID` come from [login](../../guides/authentication.md)):

With full field names:

```sh
curl -sS "https://trades.$GRVT_DOMAIN/full/v1/create_rfq" \
  -H "Content-Type: application/json" \
  -H "Cookie: gravity=$GRVT_COOKIE" \
  -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
  --data @- <<EOF
{
  "rfq": {
    "sub_account_id": "$GRVT_SUB_ACCOUNT_ID",
    "expiry": "1697788800000000000",
    "instrument": "AAPL_USDC_SFP",
    "size": "10.5"
  }
}
EOF
```

With lite field names:

```sh
curl -sS "https://trades.$GRVT_DOMAIN/lite/v1/create_rfq" \
  -H "Content-Type: application/json" \
  -H "Cookie: gravity=$GRVT_COOKIE" \
  -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
  --data @- <<EOF
{
  "r": {
    "sa": "$GRVT_SUB_ACCOUNT_ID",
    "e": "1697788800000000000",
    "i": "AAPL_USDC_SFP",
    "s": "10.5"
  }
}
EOF
```
