9

Trailhead seems to have an API to access trailhead data about badges, project, modules, roles, users etc. but it requires an API key to use. Does anybody know how to get any API key to use this API?

https://api.trailhead.salesforce.com/

1
  • It is showing 'unauthorized'. Commented May 16, 2020 at 10:26

4 Answers 4

5

You will need to contact Trailhead to get an official X-API-Key key to use in the header. Try [email protected] initially.

I believe you also need to have your IP address whitelisted against the key. E.g. If you call the API with a random key you get a response along the line of:

{ "message": "Client not allowed : REMOTE_IP -> [104.156.92.21] IP -> [104.156.92.21] X- 71.241.141.120, 104.156.92.21" }

Via details that have leaked out via forums, there appears to be a "Trailhead API" module with a "Search Using the Trailhead API" challenge, but it isn't available to the public via Trailhead.

3
  • Good to know this internal information, I reached out to Salesforce for same and they have confirmed that TrailHead API is not public.
    – Amit Jain
    Commented Apr 15, 2018 at 8:54
  • Long live the links! The links are dead!
    – Adrian Larson
    Commented Jan 4, 2019 at 3:30
  • @AdrianLarson Ha! Someone has intentionally removed them by the looks of it. Commented Jan 5, 2019 at 5:57
2

I have built a custom app on heroku which provides public access to Trailhead API. However, it hangs for some user profiles (not sure why). While for the others it works just fine.

This is a hack implementation to get access to Trailhead API to get Trailhead user points and other attributes. Requests should be used in the form https://trailheadapi.herokuapp.com/?link=/id/userAlias

It is possible to deploy code to your own heroku instance https://github.com/Patlatus/Salesforce-Trailhead-Api-Hack

1
  • This API is also not working , giving this message - {"error": "Need to update our code", "descriptor": "markup://aura:clientOutOfSync"} Commented May 15, 2020 at 8:18
2

I have searched a lot for the API to get the trailblazer user data, but didn't get any single API working. Finally, I have created the API. Use this,

https://trailheadtrackerapi.herokuapp.com/?id=Username

you will get this response

{"EarnedBadgeTotal":"value","EarnedPointTotal":"value","CompletedTrailTotal":"value"}
4
  • This app is now returning the Heroku application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail
    – kreynen
    Commented Sep 28, 2020 at 13:53
  • Hi @kreynen, I am using free plan of Heroku, this error may come at the end of the month when my dyno hours per month expires. Today I tested, it is up again. Commented Oct 1, 2020 at 12:29
  • 2
    Thanks! Can you share the repo so other people can spin a an instance of it? Since this was broken, it forced me to look at how trailblazer.me/aura?r=0&aura.ApexAction.execute=2 works. It looks like the only unique value needed in the POST is the user's Trailhead uid. Since what I'm building is an app that tracks trailhead progress over time, I can look up the uid as users are added, but I still appreciate seeing how other developers are getting this information.
    – kreynen
    Commented Oct 2, 2020 at 14:32
  • Please go to: github.com/prateekgupta1987/trailhead-tracker-api.git Commented Oct 14, 2020 at 11:10
1

Chris Duarte, Senior Director and Editor-in-Chief, Trailhead at Salesforce confirmed that TrailHead API is not public and there is no plan to make it public in near future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .