function between api, index & record