@dave you can use historical API for the same.

historical API - https://smartapi.angelone.in/docs/Historical

To get the token for a scrip of your choice, you can use instruments API.

Instruments API - https://smartapi.angelone.in/docs/Instruments