# Quotes

Payer-asset previews and guarded pricing.

## Preview payer-asset quotes

`POST /v1/quotes`

Indicative preview of what a payment would cost in each payer asset. An asset the rate provider cannot price is returned as an unavailable line rather than failing the request.

### Header parameters

- `Idempotency-Key` `string` _(required)_: Stable unique key for this logical write. Keep it unchanged when retrying.

### Request body (`application/json`)

- `amount` `object` _(required)_
  - `amount` `string` _(required)_
  - `asset` `string` _(required)_
- `assets` `string[]` _(required)_

### Responses

#### `200`: Guarded quote preview.

Body (`application/json`):

- `source` `object` _(required)_
  - `amount` `string` _(required)_: Exact minor units. Calculate with this value.
  - `asset` `string` _(required)_: ISO asset code, e.g. IDR, USD, USDC.
  - `formatted` `string` _(required)_: Machine decimal; ungrouped and dot-separated.
  - `display` `string` _(required)_: Localized display text. Never parse this value.
- `quotes` `object[]` _(required)_
  - `asset` `string` _(required)_
  - `amount` `object & object | null` _(required)_
  - `rate` `object | null` _(required)_
    - `scaledRate` `string`
    - `source` `string` _(required)_
  - `available` `boolean` _(required)_

#### `400`: Validation error.

Body (`application/json`):

- `error` `object` _(required)_
  - `code` `string` _(required)_
  - `message` `string` _(required)_
  - `retryable` `boolean` _(required)_
  - `details` `object`

### Example request

```bash
curl https://api.mayarin.xyz/v1/quotes \
  --request POST \
  --header 'Idempotency-Key: string' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": {
    "amount": "string",
    "asset": "IDR"
  },
  "assets": [
    "IDR"
  ]
}'
```

```ts
fetch('https://api.mayarin.xyz/v1/quotes', {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'string',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    amount: {
      amount: 'string',
      asset: 'IDR'
    },
    assets: ['IDR']
  })
})
```
