Retrieving data of terminated pods

Hi, I want to query the CPU usage of pods that are terminated. And I want to return the result as time series data over an interval of time. Can you please help out? And I want to do it through an API call. One more question is whether should I use grafana query/ds API or Prometheus API is better for this kind of usage.