# Calculate start timestamp and end timestamp of promql rest api

**URL:** <https://discuss.prometheus.io/t/calculate-start-timestamp-and-end-timestamp-of-promql-rest-api/284>\
**Category:** Exporters and Metrics\
**Created:** [June 3, 2021, 8:51pm UTC](https://discuss.prometheus.io/t/calculate-start-timestamp-and-end-timestamp-of-promql-rest-api/284 "2021-06-03T20:51:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![venerari](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/venerari/32/147_2.png) [@venerari](https://discuss.prometheus.io/u/venerari)\
**Post date:** [June 3, 2021, 8:51pm UTC](https://discuss.prometheus.io/t/calculate-start-timestamp-and-end-timestamp-of-promql-rest-api/284/1 "2021-06-03T20:51:33Z")

</div>

Hi All

/api/v1/query\_range?query=avg(container\_cpu\_usage\_seconds\_total%7Bnamespace%3D%27test1%27%2Cpod%3D~%27httpd1.\*%27%7D)%20by%20(namespace)%20&start=1622038429.000&end=1622643229.000&step=2419&\_=1622729547000

How can I calculate the step without using promql cli, I want to use python? This is for 1 week range which is 2419.

Also this or last epoch timestamp,  
&\_=1622729547000

Thanks!
