Unexpected non-JSON response from ZATCA API

Unexpected non-JSON response from ZATCA API

Description

We are facing an issue where the ZATCA API sometimes returns a non-JSON response (HTML or XML) instead of the expected JSON format.
This causes an exception while parsing the response:

Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0

.

Because of this, our system cannot determine the invoice status — invoices are marked as neither “Cleared” nor “Rejected”.

We log every transaction and store a unique hash for each tax invoice that faced this issue.
We will attach a list of these hashes below and kindly ask you to verify whether these invoices were actually cleared on ZATCA’s side.

hLibkOnjXusDu4EMPy4AQRY5aVfy65MkPevG8XgVfOU=
C4eSDWKoxsJ0LsXqCOHtmMx8cwyIir7keMheaGZOZOQ=
1+5cXg1t1eAeu9JXs89hsDgvEH7qxBPjpOZSdRBmh4g=
rZ0fUDqk2kOj9fOHyTynFOI/xUoRUk8DGssFrl5a8x0=

Dear @mnuaimi

Thanks for reaching out, Welcome to our community.

To provide comprehensive support as usual, can I kindly ask you to elaborate with the below:

  1. What are the exact steps (In details) that you are doing during

  2. Which API you are hitting

Thanks,
.

1 Like

@halrashidy

Thank you for your response.

This issue occurs during the standard invoice clearance process, using the official Invoice Clearance API endpoint.


We would like to clarify that nothing has changed on our side — we are performing the same clearance steps as usual.
This is the first time we encounter such behavior.

Because the failure was unexpected, we are concerned that some of these invoices might have been cleared on ZATCA’s side, while our system marked them as not cleared due to the parsing error.

We are therefore attaching a sample of the affected invoice hashes and kindly request your team to verify whether these invoices were successfully cleared on your system.

Thank you for your assistance and continued support.