Near-surface humidity is not archived directly in ERA datasets, but the archive contains near-surface (2m from the surface) temperature (T), dew point temperature (Td), and surface pressure (sp) from which you can calculate specific and relative humidity at 2m.
Specific humidity can be calculated over water and ice using equations 7.4 and 7.5 from Part IV, Physical processes section (Chapter 7, section 7.2.1b) in the documentation of the IFS for CY41R2. Use the 2m dew point temperature and surface pressure (which is approximately equal to the pressure at 2m) in these equations. The constants in 7.4 are to be found in Chapter 12 (of Part IV: Physical processes) and the parameters in 7.5 should be set for saturation over water because the dew point temperature is being used.
Relative humidity should be calculated :
RH = 100 * es(Td)/es(T)
You can calculate the relative humidity with respect to saturation over water, ice or mixed phase by defining es(T) with respect to saturation over water, ice or mixed phase (water and ice). The usual practice is to define near-surface relative humidity with respect to saturation over water.
 Access to surface pressure varies by dataset. For example, for ERA-Interim surface pressure is available from the Web Interface and from the WebAPI, while for ERA-40 surface pressure is not available from the Web Interface, but only via the WebAPI.