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

# Sync Oracle Price

> Update the on-chain oracle price for a market

Pushes a new price to the on-chain oracle. If no price is provided in the request body, the API fetches the current market price automatically using the configured stock symbol. Requires the registered wallet signer to be authorized on the oracle contract.

<Warning>
  This is a write operation that submits a blockchain transaction. The registered wallet signer must be authorized on the oracle by its owner.
</Warning>

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Body Parameters

<ParamField body="price" type="number">
  Price in USD. If omitted, the API fetches it from the configured price feed.
</ParamField>

<ParamField body="txHash" type="string">
  Hash of the transaction you broadcast for this operation. Send it to confirm the transaction and record the result. Omit it to receive the calldata.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/lending-stocks/api/markets/{marketId}/sync-oracle" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{"price": 186.25}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "previousPrice": "185.500000",
      "newPrice": "186.25",
      "txHash": "0xabc...def"
    }
  }
  ```

  ```json Error - Signer Not Authorized theme={null}
  {
    "success": false,
    "error": {
      "code": "SIGNER_NOT_AUTHORIZED",
      "message": "Issuer wallet 0x123...456 is not authorized on oracle 0x8B2e...4a7c. The oracle owner must call setAuthorizedSigner."
    }
  }
  ```

  ```json Error - Price Deviation theme={null}
  {
    "success": false,
    "error": {
      "code": "PRICE_DEVIATION_TOO_LARGE",
      "message": "Price deviation exceeds circuit breaker. On-chain price: $185.50, new price: $250.00. Max allowed change: 50%."
    }
  }
  ```
</ResponseExample>
