The rarest achievement (at the time of writing)
On 2015-05-20, the rarest achievement by percentage (with over 0 percentage completion) that is visible in the Steam community achievement lists was Escape in Counter-Strike Nexon: Zombies with 0.0001% of players achieving it.
Note that this information is probably obsolete by the time you read this.
Technique
Steam Web API v0002 provides an API for global achievement stats per game, i.e. percentage of players that have got a specific achievement.
For example, the achievement stats for Jamestown can be fetched from the URL http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/?gameid=94200 .
The list of Steam app id's is available from another API: http://api.steampowered.com/ISteamApps/GetAppList/v0001/
Given these it's pretty trivial to write code that fetches achievement percentages for all Steam games and gives a sorted list. However, this only gives the relative rarity of the achievements. To find the absolute rarity, this data should be combined with the amount of players for each game. I'm still looking for a way to find that data, but I'm afraid that might be something Valve considers confidential.
Example using bash
and jq
Note: this takes over a day and currently produces ~17k files that take 71MB.
First get the list of appids.
curl http://api.steampowered.com/ISteamApps/GetAppList/v0001/ > appids.json
Using this list, fetch the global achievement percentages for each appid.
mkdir game
for appid in $(jq '.applist.apps.app[].appid' appids.json); do
curl http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/\?gameid\=$appid > game/$appid.json
sleep 5
done
Then parse the files with jq
and list all achievements in a single file.
(for f in game/*.json; do
id=${f//[^0-9]/}
jq ".achievementpercentages.achievements[] | \"\(.percent) \(.name) ${id}\"" $f
done) > all.txt
Now that you have all the achievements in the same place, just sort and read using sort all.txt | less
or such. There's a lot of achievements that have zero percentage. On 2015-05-20, these are the entries I found such that 0 < p < 0.00012:
"0.00010054475569631904 98200"
"0.0001009478946798481 ACH_UNLOCK_WORLD_MAP 218680"
"0.00010108494461746886 DLC5 28050"
"0.00010108494461746886 DLC7 28050"
"0.0001046398319886066 AQS2063 273110"
"0.00010847899102373049 ACHIEVEMENT_WIN_SCENARIO_01_DIETY 8930"
"0.000109708787931595 FIRST_SUPER_GAME 262410"
"0.00010998825018759817 EUTA_GAME_FlagWaver 13260"
"0.00010998825018759817 EUTA_GAME_HatTrick 13260"
"0.00010998825018759817 EUTA_GAME_PaintTownRed 13260"
"0.00010998825018759817 EUTA_HUMILIATION_KillJoy 13260"
"0.00010998825018759817 EUTA_HUMILIATION_SirSlaysALot 13260"
"0.00010998825018759817 EUTA_IA_Untouchable 13260"
"0.00010998825018759817 EUTA_VEHICLE_Ace 13260"
"0.00010998825018759817 EUTA_VEHICLE_Deathwish 13260"
"0.00010998825018759817 EUTA_VEHICLE_JackOfAllTrades 13260"
"0.00011104188888566568 IAOnceObjFlawlessDefense 203290"
"0.00011104188888566568 Rib1KStare 203290"
"0.00011104188888566568 RibDistAutoRifleman 203290"
"0.00011104188888566568 RibM14EBRGripPodBipodQual 203290"
"0.00011104188888566568 RibM14EBRHSSTGQual 203290"
"0.00011104188888566568 RibM249M150MGOQual 203290"
"0.00011104188888566568 RibM249MagpulMVGQual 203290"
"0.00011104188888566568 RibM4ACCFlashHiderQual 203290"
"0.00011104188888566568 RibM4ACCSupressorQual 203290"
"0.00011104188888566568 RibM4PMAG20Qual 203290"
"0.00011104188888566568 RibMissionFirst 203290"
"0.00011189774522790685 Chain Gang 212480"
"0.00011189774522790685 Justice Shot 212480"
"0.00011189774522790685 Ninja Skills 212480"
"0.00011189774522790685 Three's Company 212480"
"0.00011796417675213888 Test 239220"
"0.00011801000800915062 lonelyisland 42910"
The first item is an achievement for Frozen Synapse whose name is an empty string, and that isn't shown in the Steam stats page. Most of the other achievements in this list can't be found elsewhere, either.
The first one that's visible in the human-readable achievement lists is AQS2063 or Escape for Counter-Strike Nexon: Zombies.
Speculation about players completing the achievement
The API gives very accurate numbers. Since 0.0001046398319886066 is 1/955,659 with very little error, one could speculate that there are 955,659 Counter-Strike Nexon: Zombies players and exactly one of them has got the achievement. Obviously any multiple of these numbers is possible, too.