# Request a reverse quote

Preview the token escrow and shielded Zcash payment. The request uses placeholders for the authorization address and refund note. Have the wallet generate both for a swap you intend to fund.

```text title="Endpoint"
POST /maker/v1/reverse/quote
```

## Examples

**cURL**

This example requests a disposable quote. Use your wallet’s own values for a swap you intend to accept.

```bash title="cURL"
curl -sS "https://api-testnet.veylor.cash/maker/v1/reverse/quote" \
  -H 'Content-Type: application/json' \
  --data '{
  "units": 5000000,
  "user": "0x0000000000000000000000000000000000000001",
  "refundNote": "0x0000000000000000000000000000000000000000000000000000000000000001"
}'
```

**200 JSON**

```json title="HTTP 200"
{
  "terms": {
    "quoteId": "0xaa63ba2be3598f3997b2bc3830c58671d0d21a12e63c7d46472b2872a1d4e4b1",
    "maker": "0x2bac02b5032e9092493814c705f156b49e288922",
    "makerShare": "0x3271f5abbc13ec9178ebbd48a7294859dd5eb65e5e6e8e17c5a65a52d46764f81218c0fd2da89df2b55014fdb0e7853bdfef5c5e24aec0b8a1eb693515efb891",
    "makerProof": "0xffbe9bfa5a66920679ea0a281c0f4d8b7bc92a7a996edef2171e38b9705cd129a2b916389294114554b67aa980c8d9250818c946b97a57bdd30e0d8a8058a119",
    "chainId": 11155111,
    "contract": "0x62ce626c5a30528b8ee33145d491785082a6cf8a",
    "token": "0x64c4a5cb09fe0b706d4cf24dc0a45fff275d727c",
    "amount": "5000000",
    "depositZat": 647081,
    "expiresAt": 1795996378,
    "networkCost": "133969"
  },
  "user": "0x0000000000000000000000000000000000000001",
  "refundNote": "0x0000000000000000000000000000000000000000000000000000000000000001",
  "fundingDeadline": 1795996956,
  "readyDeadline": 1796003256,
  "refundAfter": 1796006856
}
```

**400 JSON**

```json title="HTTP 400"
{
  "code": "rejected",
  "error": "1 units is outside the quotable range, 5000000 to 50000000"
}
```

## Request body

`object` · [ReverseQuoteRequest](https://docs.veylor.cash/api-types/#reversequoterequest)

| Field | JSON type | Presence | Meaning |
| --- | --- | --- | --- |
| `units` | `integer` · [Uint32](https://docs.veylor.cash/api-types/#uint32) | Required | Number of maker denominations to escrow. Public testnet uses 1000000 units per tUSD and the same size limits as forward quotes. |
| `user` | `string` · [EthereumAddress](https://docs.veylor.cash/api-types/#ethereumaddress) | Required | Fresh Ethereum authorization address for this swap. |
| `refundNote` | `string` · [Hex32](https://docs.veylor.cash/api-types/#hex32) | Required | Hash committing to the RAILGUN note that will receive any token refund. |

## Responses

### HTTP 200

`object` · [ReverseQuote](https://docs.veylor.cash/api-types/#reversequote)

| Field | JSON type | Presence | Meaning |
| --- | --- | --- | --- |
| `terms` | `object` · [ForwardQuote](https://docs.veylor.cash/api-types/#forwardquote) | Required | Maker quote fields. Here amount is the token input and depositZat is the maker's gross Zcash deposit. |
| `user` | `string` · [EthereumAddress](https://docs.veylor.cash/api-types/#ethereumaddress) | Required | User's swap authorization address. |
| `refundNote` | `string` · [Hex32](https://docs.veylor.cash/api-types/#hex32) | Required | Shield-note commitment from the request. |
| `fundingDeadline` | `integer` · [UnixSeconds](https://docs.veylor.cash/api-types/#unixseconds) | Required | Last time allowed by the signed opening authorization, in Unix seconds. |
| `readyDeadline` | `integer` · [UnixSeconds](https://docs.veylor.cash/api-types/#unixseconds) | Required | The ready authorization must land before this time (t0). |
| `refundAfter` | `integer` · [UnixSeconds](https://docs.veylor.cash/api-types/#unixseconds) | Required | From this time (t1), the user may refund a ready reverse escrow. |

**Fields of terms**

| Field | JSON type | Presence | Meaning |
| --- | --- | --- | --- |
| `quoteId` | `string` · [Hex32](https://docs.veylor.cash/api-types/#hex32) | Required | Identifier used in the acceptance URL. |
| `maker` | `string` · [EthereumAddress](https://docs.veylor.cash/api-types/#ethereumaddress) | Required | Maker's Ethereum address. |
| `makerShare` | `string` · [Hex64](https://docs.veylor.cash/api-types/#hex64) | Required | Maker's public Pallas share, encoded as two 32-byte affine coordinates. |
| `makerProof` | `string` · [Hex64](https://docs.veylor.cash/api-types/#hex64) | Required | Proof that the maker knows its share. |
| `chainId` | `integer` · [Uint64](https://docs.veylor.cash/api-types/#uint64) | Required | EIP-155 chain ID of the settlement network. |
| `contract` | `string` · [EthereumAddress](https://docs.veylor.cash/api-types/#ethereumaddress) | Required | Ethereum address of the settlement contract. |
| `token` | `string` · [EthereumAddress](https://docs.veylor.cash/api-types/#ethereumaddress) | Required | Ethereum address of the escrow token. |
| `amount` | `string` · [DecimalUint128](https://docs.veylor.cash/api-types/#decimaluint128) | Required | Gross escrow value in token base units. |
| `depositZat` | `integer` · [Uint64](https://docs.veylor.cash/api-types/#uint64) | Required | Zcash amount payable to the joint account, in zatoshis (100,000,000 per coin). |
| `expiresAt` | `integer` · [UnixSeconds](https://docs.veylor.cash/api-types/#unixseconds) | Required | Quote expiry in Unix seconds. |
| `networkCost` | `string` · [DecimalUint128](https://docs.veylor.cash/api-types/#decimaluint128) | *Optional* | Maker's estimated network cost already included in the quote, in token base units. |
| `openFee` | `object` · [OpenFee](https://docs.veylor.cash/api-types/#openfee) | *Optional* | A forward maker may require this separate Zcash payment before acceptance. |

### Errors

| HTTP | Body | Meaning |
| --- | --- | --- |
| 400 | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | Malformed request or a quote the maker rejected. For an out-of-range size the maker reports its current inclusive bounds in units. Other rejections have different reasons. |
| 413 | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | The request exceeds the service’s body limit. |
| 415 | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | Use Content-Type: application/json. |
| 422 | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | The JSON fields or encoded values do not match the request type. |
| 503 | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | Temporarily unavailable, throttled, or waiting for a chain event. Respect Retry-After when present. `Retry-After` — Seconds to wait before retrying, when supplied. |
| Other | `object` · [ErrorResponse](https://docs.veylor.cash/api-types/#errorresponse) | Other service error. Read code and error. |

**ErrorResponse fields**

| Field | JSON type | Presence | Meaning |
| --- | --- | --- | --- |
| `code` | `string` · [ErrorCode](https://docs.veylor.cash/api-types/#errorcode) | Required | Machine-readable service error code. |
| `error` | `string` | Required | Human-readable detail. |
