Connect the world's APIs to Web3 with Chainlink Functions. Get started

Median Task

Accepts multiple numerical inputs and returns the median of them.


  • values: an array of values from which to select a median.
  • allowedFaults (optional): the maximum number of input tasks that can error without the Median task erroring. If not specified, this value defaults to N - 1, where N is the number of inputs.


The median of the values in the values array.


my_median_task [type="median"
                values=<[ $(fetch1), $(fetch2), $(fetch3) ]>

Given the inputs 2, 5, and 20, the task will return 5.

Stay updated on the latest Chainlink news