Does uploaded document allFailureReasons appear for documents with a single failure reason?

I just noticed the allFailureReasons field for uploaded documents, which has been added since we first implemented document upload approval handling. Documentation states:

Contained in the response will be a failureReason field which corresponds to one or more of the following values. In case of a failure due to multiple reasons, an additional allFailureReasons of reasons and descriptions is also returned

This almost sounds to me like the field will only be available when there are multiple failure/rejection reasons, and I need to still rely on the singular failureReason field if there is only one reject reason.

Is that the case, or can I replace our existing failureReason references to use allFailureReasons in all cases?

edit: Testing this empirically, allFailureReasons does seem to be populated even for a single failure reason. It would still be nice to know if this is official behavior though, and not something that could be retracted/“fixed” later to align with documentation.

Hi @abe!

Yes, the allFailureReasons JSON object will be present for any number of failures. It just looks like we’d need to update our documentation with the same. Thanks for bringing this up!

To provide more color, we introduced the allFailureReasons object to populate alongside failureReason to not introduce a breaking change. You can definitely replace your existing failureReason references to use allFailureReasons in all cases!

Thanks for posting! We’ll get our docs updated!

Great! I like the new data structure and not having to maintain a mapping of English descriptions of the error reasons in our code any more.

1 Like

That’s great! Thanks for the feedback! :slight_smile:

I take it this data wasn’t backfilled? Or at least not in the sandbox? As I tested a failed document from ~1 year ago and there’s a failureReason but allFailureReasons is empty

Screenshot from 2020-09-26 13-26-09

Document ID is 439642d5-dc29-4e84-bddd-6d06b42d5fab in the sandbox

Hi Abe! That would be correct. The allFailreReasons object only contains entries for newly created documents after it was added to the API.