How can I refactor Api::SessionsController?
Put the common error methods in a Module and include it in each Controller where you need them (in a similar way like you already include Devise::Controllers::Helpers, but this time with your own namespace and module name.)

As for the method signatures

def error type, context=nil
def error_message type, context
def render_status state


it's common to leave the parenthesis out when calling class methods in class context (because they oftentimes make up a nice DSL), but please don't do it when defining methods, that can lead to annoying ambiguities.