duration to api schema