Skip to content

Instantly share code, notes, and snippets.

@antiops
Created January 20, 2023 12:49
Show Gist options
  • Save antiops/ba75c409c4814886e1a152c0b4878484 to your computer and use it in GitHub Desktop.
Save antiops/ba75c409c4814886e1a152c0b4878484 to your computer and use it in GitHub Desktop.
LEGO Set Metadata API
  • Replace SET_ID_HERE with the LEGO set ID (Example: 30624)
  • The x-api-key worked for all the sets I tested, dunno if it changes

All the stuff

The API call used on the Building Instructions webpages. It returns all sorts of metadata

curl 'https://services.slingshot.lego.com/api/v4/lego_historic_product_read/_search' \
  -H 'content-type: application/json' \
  -H 'x-api-key: p0OKLXd8US1YsquudM1Ov9Ja7H91jhamak9EMrRB' \
  --data-raw '{"_source":["product_number","locale.en-us","locale.en-us","market.us.skus.item_id","market.us.skus.item_id","availability","themes","product_versions","assets"],"from":0,"size":1,"query":{"bool":{"must":[{"term":{"product_number":"SET_ID_HERE"}}],"should":[],"filter":[]}}}'

Set instructions pdf

curl 'https://services.slingshot.lego.com/api/v4/lego_historic_product_read/_search' \
  -H 'content-type: application/json' \
  -H 'x-api-key: p0OKLXd8US1YsquudM1Ov9Ja7H91jhamak9EMrRB' \
  --data-raw '{"_source":["product_versions"],"from":0,"size":1,"query":{"bool":{"must":[{"term":{"product_number":"SET_ID_HERE"}}],"should":[],"filter":[]}}}'

Examples

One liner for set 30624:

curl 'https://services.slingshot.lego.com/api/v4/lego_historic_product_read/_search' -H 'content-type: application/json' -H 'x-api-key: p0OKLXd8US1YsquudM1Ov9Ja7H91jhamak9EMrRB' --data-raw '{"_source":["product_versions"],"from":0,"size":1,"query":{"bool":{"must":[{"term":{"product_number":"30624"}}],"should":[],"filter":[]}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment