add err to api