> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crypto.westminister.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve Active Pricing IDs + Commercial Preview (Authenticated)

> Resolves the active `pricing_profile_id` and `fx_rate_quote_id` for the provided flow context,
then returns a computed commercial preview. Intended for app clients before order creation.

**Liquidity context (optional `vendor_id` + `offer_id`):** In the API these fields are still named
`vendor_id` and `offer_id` for historical reasons. Conceptually they mean:
- **`vendor_id`** — **liquidity provider**: the user account that **published** the marketplace line.
- **`offer_id`** — **liquidity listing**: the specific **published terms** (asset, fiat pair, limits, status)
  your order will attach to for validation and lifecycle. It is **not** “where the customer gets USDT”:
  for off-ramp the customer already holds crypto in custody. The listing is the **conversion/routing anchor**,
  not the funding source of their balance.

When both IDs are sent, the liquidity listing must exist, belong to that liquidity provider, be **active**,
and its `asset` must match the request `asset`. Omit both for flows that do not use a listing (e.g. Some p2p/b2b previews).

**OTC bank deposits (B2B):** Use **`POST /pricing/resolve-otc`** with `otc_type: deposit` so pricing rows scoped with `otc_type` do not collide with generic `b2b` resolve.




## OpenAPI

````yaml /openapi.yaml post /api/v1/auth/pricing/resolve
openapi: 3.1.0
info:
  title: EmaalCoin API
  description: >
    EmaalCoin API reference. These APIs power cryptocurrency exchange between
    USDT and Fiat trading.


    - **On-Ramp**: Buy USDT with fiat (KES) via mobile money (STK Push for
    Kenya)

    - **Off-Ramp**: Sell USDT for KES with mobile money payout (Kenya)

    - **Ethereum, TRON, and Solana**: Multi-chain wallet support

    - **Merchant Offers**: Create and manage trading offers

    - **OTC Flows**: Bank and mobile money deposits/withdrawals for merchants

    - **Pricing engine**: FX quotes and fee profiles for quote-backed orders and
    transfers

    - **P2P/B2B transfers**: Internal and external stablecoin sends (USDT/USDC)
    with optional pricing snapshots

    - **Stablecoin swaps**: Treasury-backed two-leg USDT ↔ USDC conversion with
    BitGo confirmation, inventory reservation, and automatic refunds

    - **Multisig**: Collaborative and platform-managed multisig flows for
    high-value B2B
  version: 1.1.0
servers:
  - url: https://crypto.westminister.tech
    description: Production API (requires DNS for this hostname).
  - url: http://13.42.110.185:8080
    description: >-
      UAT on EC2 (direct). Use this base when building proof PDF URLs if the
      production hostname does not resolve.
security: []
tags:
  - name: Pricing
    description: >-
      Commercial pricing profiles and FX rate quotes (admin). Used with orders
      and transfers for auditable snapshots.
  - name: Transfers
    description: >-
      P2P and B2B stablecoin transfers (USDT/USDC). Optional fiat-equivalent
      pricing fields. B2B multisig behavior depends on wallet registration
      (synchronous completion vs proposal flow).
  - name: Stablecoin Swaps
    description: >-
      Treasury-backed USDT ↔ USDC conversions for BitGo provider-managed wallets
      on `tron`, `ethereum`, or `solana`. Collection confirms before treasury
      payout starts. Completion requires both legs and dual-asset balance
      synchronization.
  - name: Multisig
    description: >-
      Multisig wallet registration and TRON proposal/confirm flows
      (vendor/admin).
  - name: Escrow Wallets
    description: Escrow pool wallet metadata for off-ramp and operations.
  - name: Users
    description: >-
      User-related operations (registration, lookup, updates, counts, status
      changes)
  - name: Wallets-Users
    description: User wallet operations (create, manage, query balances)
  - name: Offers
    description: Offer operations (create, read, list, counts)
  - name: Orders
    description: Order operations (create, update, list, counts, stats)
  - name: Payment
    description: Payment initiation operations
  - name: Merchants
    description: >
      Merchant (vendor) onboarding and hierarchy operations.

      USE **GET /API/V1/AUTH/MERCHANTS** WITH **PAGE_ID** AND **PAGE_SIZE** TO
      PAGE MASTER VENDORS.

      USE **GET /API/V1/AUTH/MERCHANTS/{MERCHANT_ID}** FOR ONE MASTER VENDOR,
      **MERCHANT_WALLETS**, AND ALL **SUBVENDOR** ROWS WITH **WALLETS** (FULL
      TREE).
  - name: OTC Deposits
    description: >
      OTC fiat-to-crypto deposits (bank or mobile money). Rows live in
      **`otc_deposits`**. Merchants create drafts or one-shot deposits.
      **admin**, **otc_officer**, or **treasury** list all deposits.

      B2B bank flow uses draft, quote, submit, proof, assign, claim, settlement,
      and audit. **`credited_to_address`** is the merchant on-chain wallet
      treasury credits (resolved from the default wallet for
      **`requested_network`** on the master merchant ledger user or any
      **sub-vendor** under that merchant).

      **`GET /api/v1/auth/otc/deposits`** backfills missing
      **`credited_to_address`**/**`to_wallet_id`** when a wallet can be
      resolved. One-shot **`POST /api/v1/auth/otc/deposits`** persists the
      payout address when **`requested_network`** is sent.

      Bank proof PDFs upload via `POST .../proof` and are viewed at **`GET
      /otc-deposits-proof/{deposit_id}/{file}.pdf`** (relative
      **`proof_url`**/**`file_url`** plus API base URL).

      Merchants may edit tab-1 draft fields with **`PATCH
      /api/v1/auth/otc/deposits/{id}/draft`** while **`status`** is **`draft`**.
  - name: OTC Withdrawals
    description: >-
      OTC crypto-to-fiat withdrawals (bank or mobile money). Merchants create.
      Admin approves and executes.
  - name: OTC Config
    description: OTC display config (bank details, mobile money paybill) for merchant UI
  - name: Fiat Currencies
    description: >
      Shared platform **fiat_currencies** catalog. **GET
      /api/v1/auth/fiat-currencies** lists active rows for UI pickers. **GET
      /api/v1/auth/fiat-currencies/admin** lists all rows including inactive
      (admin). Admin manages rows with **GET
      /api/v1/auth/fiat-currencies/{id}**, **POST
      /api/v1/auth/fiat-currencies**, **PATCH
      /api/v1/auth/fiat-currencies/{id}**, and **DELETE
      /api/v1/auth/fiat-currencies/{id}**. Use for OTC, pricing, orders,
      remittance, and backoffice — not under **`/otc/...`**. Prefer **PATCH**
      with **`is_active: false`** over delete when a currency is referenced.
  - name: Countries
    description: >-
      Shared platform **countries** catalog. Public **GET /api/v1/countries**
      lists active rows for pickers. Auth **GET /api/v1/auth/countries** returns
      the same active catalog. Admin manages rows with **GET
      /api/v1/auth/countries/admin**, **GET /api/v1/auth/countries/{id}**,
      **POST /api/v1/auth/countries**, **PATCH /api/v1/auth/countries/{id}**,
      and **DELETE /api/v1/auth/countries/{id}**.
  - name: Files
    description: Authenticated file uploads for OTC receipts and proof artifacts.
paths:
  /api/v1/auth/pricing/resolve:
    post:
      tags:
        - Pricing
      summary: Resolve Active Pricing IDs + Commercial Preview (Authenticated)
      description: >
        Resolves the active `pricing_profile_id` and `fx_rate_quote_id` for the
        provided flow context,

        then returns a computed commercial preview. Intended for app clients
        before order creation.


        **Liquidity context (optional `vendor_id` + `offer_id`):** In the API
        these fields are still named

        `vendor_id` and `offer_id` for historical reasons. Conceptually they
        mean:

        - **`vendor_id`** — **liquidity provider**: the user account that
        **published** the marketplace line.

        - **`offer_id`** — **liquidity listing**: the specific **published
        terms** (asset, fiat pair, limits, status)
          your order will attach to for validation and lifecycle. It is **not** “where the customer gets USDT”:
          for off-ramp the customer already holds crypto in custody. The listing is the **conversion/routing anchor**,
          not the funding source of their balance.

        When both IDs are sent, the liquidity listing must exist, belong to that
        liquidity provider, be **active**,

        and its `asset` must match the request `asset`. Omit both for flows that
        do not use a listing (e.g. Some p2p/b2b previews).


        **OTC bank deposits (B2B):** Use **`POST /pricing/resolve-otc`** with
        `otc_type: deposit` so pricing rows scoped with `otc_type` do not
        collide with generic `b2b` resolve.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - flow_type
                - asset
                - fiat_currency
                - amount_in
                - amount_in_type
              properties:
                flow_type:
                  type: string
                  enum:
                    - onramp
                    - offramp
                    - p2p
                    - b2b
                    - b2b2c
                    - remittance
                network:
                  type: string
                  description: tron or ethereum
                asset:
                  type: string
                  example: USDT
                fiat_currency:
                  type: string
                  example: KES
                source_country:
                  type: string
                  description: >-
                    Required when flow_type=remittance. Prefer active ISO 3166-1
                    alpha-3 code from the countries catalog. Example KEN. Legacy
                    alpha-2 input is accepted and normalized to alpha-3
                destination_country:
                  type: string
                  description: >-
                    Required when flow_type=remittance. Prefer active ISO 3166-1
                    alpha-3 code from the countries catalog. Example UGA. Legacy
                    alpha-2 input is accepted and normalized to alpha-3
                amount_in:
                  type: string
                  description: Positive decimal string
                amount_in_type:
                  type: string
                  enum:
                    - fiat
                    - crypto
                vendor_id:
                  type: string
                  format: uuid
                  description: >-
                    Liquidity provider (publisher of the marketplace line). API
                    name retained as vendor_id.
                offer_id:
                  type: string
                  format: uuid
                  description: >-
                    Liquidity listing id — published USDT/fiat terms the preview
                    should align with. API name retained as offer_id.
                order_type:
                  type: string
                  enum:
                    - ON_RAMP_BUY
                    - OFF_RAMP_SELL
                    - ON_RAMP_SELL
                    - OFF_RAMP_BUY
      responses:
        '200':
          description: Resolved IDs and pricing preview
          content:
            application/json:
              schema:
                type: object
                properties:
                  pricing_profile_id:
                    type: string
                    format: uuid
                  fx_rate_quote_id:
                    type: string
                    format: uuid
                  flow_type:
                    type: string
                  network:
                    type: string
                  asset:
                    type: string
                  fiat_currency:
                    type: string
                  source_country:
                    type: string
                    description: Resolved ISO 3166-1 alpha-3 source country code
                  destination_country:
                    type: string
                    description: Resolved ISO 3166-1 alpha-3 destination country code
                  amount_in:
                    type: string
                  amount_in_type:
                    type: string
                    enum:
                      - fiat
                      - crypto
                  vendor_id:
                    type: string
                    format: uuid
                  offer_id:
                    type: string
                    format: uuid
                  order_type:
                    type: string
                  reference_fx_rate:
                    type: string
                  applied_fx_rate:
                    type: string
                  spread_bps:
                    type: integer
                  spread_amount:
                    type: string
                  fees:
                    type: object
                    properties:
                      fixed_fee:
                        type: string
                      fixed_fee_currency:
                        type: string
                      percentage_fee_bps:
                        type: integer
                      percentage_fee_amount:
                        type: string
                      total_fee_amount:
                        type: string
                      fee_currency:
                        type: string
                  amounts:
                    type: object
                    properties:
                      gross_fiat_amount:
                        type: string
                      net_fiat_amount:
                        type: string
                      gross_crypto_amount:
                        type: string
                      net_crypto_amount:
                        type: string
                  settlement_side:
                    type: string
                  rate_source:
                    type: string
                  quoted_at:
                    type: string
                    format: date-time
                  expires_at:
                    type: string
                    format: date-time
                    nullable: true
        '400':
          description: Validation error
        '401':
          description: Unauthorized
        '404':
          description: No active pricing profile or FX quote found
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: PASETO

````