Expense report API returns wrong amounts

I am implementing a system that uses the expense report API. Clockify API Documentation

I was testing it out and noticed that decimal places were moved in the amounts returned for expenses. I double checked the expense report through the Clockify webapp and the decimal place was in-tack there.

I’m using python requests with the built-in json parser and this what I get in the totals field:

`‘totalAmount’: 15998.0,`

This is how it is shown in the Clockify web app.

image

Is the API moving the decimal place for some reason?

I just ran another test and it looks like trailing zeros are added and the decimal place is shifted to the right by 2 digits

A logged expense of the amount 1599.8 will return 159980.0

A logged expense of the amount 159.98 will return 15998.0

Still unsure if this is intended. But I can work with it.

Hi @Jesudas,

Thanks for checking this so thoroughly! The difference you’re seeing is expected. The Expense Report API returns amounts in the smallest currency unit (for example, cents instead of dollars).

So when you see something like this in the API response:

“totalAmount”: 15998.0

it represents USD 159.98 in the Clockify web app.

If you’d like to see the same format as the web app, you can manually divide the value by 100.

Cheers!

1 Like

Thank you for the quick response. I noticed that for the rest of amounts returned by the API and now divide by 100. Thanks.

2 Likes