Return code of an API

Isn’t your api returning the status, when you call it? You can see the status and headers when you fetch the API schema - so use the status which is returned there.