Jira Rest APIs for Extracting committed and completed story points of a closed sprint

HI

We are using jira/rest/agile/latest/board/(board ID)/sprint/(sprint ID)/issue to extract issues of completed sprint. This API is run 2 days after sprint closure and by then the new sprint has started. The extracted issues are stored in a DB and using this data we do some calculations, for e.g. total committed SPs and completed SPs. It is possible that a issue which was not closed in previous closed sprint changes story points or any other field in the new active sprint, which is perfectly fine. Teams can change SP when new sprint starts. What we have observed is that the DB stores the latest SP value for the completed sprint, for e.g. a 5 point in sp1 was changed to 3 point is sp2. The DB stores 3 points for SP1 as well as SP2. where as the jira report shows 5 for sp1 and 3 for sp2. this makes our calculations unreliable. Is there anyway to solve this problem? The issue ID is same but sprint IDs are different. I want to see 2 different story points in DB for 2 different sprint IDs for the same issue as is visible in the jira sprint report. We are extracting large volume of data for a large number of projects and sprints and processing that raw data for various purposes

Thanks,

Pooja