encode and decode the inputs and out puts of the API's