# Responses

## 200 (OK) / 202 (Accepted) / 400 (Bad Request)

**B2B**

If ZATCA has processed the invoice and we get a valid response back. In this case we return status code given by ZATCA.&#x20;

**B2C**

Since we process invoices in offline mode you will only receive a 200 OK if we are able to generate the QR code

### Schema

| Parameter                   | Value                                         | Description                                                         |
| --------------------------- | --------------------------------------------- | ------------------------------------------------------------------- |
| message                     | "Operation Successful/Unsuccessful"           | Basic message returned by us                                        |
| info\_messages              | \[]                                           | List of info messages returned by ZATCA                             |
| warning\_messages           | \[]                                           | List of warning messages returned by ZATCA                          |
| status                      | "REPORTED/NOT\_REPORTED/CLEARED/NOT\_CLEARED" | Reporting/Clearance Status of the invoice retunred by ZATCA         |
| schematron\_overall\_status | PASS/WARNING/FAIL                             | over schematron status of the invoice returned by ZATCA             |
| invoice                     | base64 encoded XML/None                       | Updated XML document. Value can be Null in case of clearance errors |
| qr\_code                    | ""                                            | Raw QR code generated                                               |
| icv                         | 123                                           | Invoice Counter Value                                               |
| invoice\_hash               | AVBC                                          | Invoice Hash calculated by us for the given XML                     |
| invoice\_id                 | 1                                             | Invoice ID                                                          |
| invoice\_uuid               | 484fde54-9439-453a-ae33-86b637c43c38          | Invoice UUID                                                        |

### Sample Response B2B

```json
{
    "info_messages": [
        {
            "type": "INFO",
            "code": "XSD_ZATCA_VALID",
            "category": "XSD validation",
            "message": "Complied with UBL 2.1 standards in line with ZATCA specifications",
            "status": "PASS",
            "source": "ZATCA"
        }
    ],
    "warning_messages": [],
    "error_messages": [],
    "schematron_overall_status": "PASS",
    "status": "CLEARED",
    "invoice": "base 64 encoded xml",
    "icv": 245,
    "pih": "cwwzw3caoAVpjqzgZbOEKW42FGlNsOPznT8DLbOJp3Q=",
    "invoice_hash": "cwwzw3caoAVpjqzgZbOEKW42FGlNsOPznT8DLbOJp3Q=",
    "qr_code": "ARpHb3luYSBFeHRlcm4gUHJpbnQgdGVzdCBBQgIPMzExMzE4Mzg0NjAwMDAzAxQyMDIyLTA5LTA2VDE1OjQxOjIyWgQEMS4xNQUEMC4xNQYseWR0bVVwUUVreFNDcXdHNlF2SXkyN0o1dFhBdmIzS1dpNFZzYUhicnEyMD0HYE1FUUNJQkhYZjFWdzlKTXp1UCtNc2lPSHMveFIxKytwU01ZNm9zM1ZNcktCRXBvTUFpQnFmc0FHUEZJa2ZobGkvdnRTSmJydW5FL0hqSXRIY29mZDYrMnBWeWcxUFE9PQhYMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEHo7DeavfOx/H5ixSAbTRZFEurkOCf4ezO6SxZa58jzdhRzYMBbgxwFYRP2TfIoYjLKcHsEwOQG6SrNX2LSLG+QlGMEQCIFxUCL06AH9+cmaskOShpb1xhp3HwJ8nYODr3lIxqk8wAiBjHfpD+WQBfbWEr/+ZPLr/crThohM/v2Rr4bz15Rtztg==",
    "invoice_id": "100",
    "invoice_uuid": "ff891ec0-a889-431a-8f25-81934f425397"
}
```

### Sample Response B2C

```json
{
    "info_messages": [
        {
            "type": "INFO",
            "code": "XSD_ZATCA_VALID",
            "category": "",
            "message": "Complied with UBL 2.1 standards in line with ZATCA specifications",
            "status": "",
            "source": "MI"
        }
    ],
    "warning_messages": [],
    "error_messages": [],
    "schematron_overall_status": "",
    "status": "",
    "invoice": "base 64 encoded xml",
    "icv": 245,
    "pih": "cwwzw3caoAVpjqzgZbOEKW42FGlNsOPznT8DLbOJp3Q=",
    "invoice_hash": "cwwzw3caoAVpjqzgZbOEKW42FGlNsOPznT8DLbOJp3Q=",
    "qr_code": "ARpHb3luYSBFeHRlcm4gUHJpbnQgdGVzdCBBQgIPMzExMzE4Mzg0NjAwMDAzAxQyMDIyLTA5LTA2VDE1OjQxOjIyWgQEMS4xNQUEMC4xNQYseWR0bVVwUUVreFNDcXdHNlF2SXkyN0o1dFhBdmIzS1dpNFZzYUhicnEyMD0HYE1FUUNJQkhYZjFWdzlKTXp1UCtNc2lPSHMveFIxKytwU01ZNm9zM1ZNcktCRXBvTUFpQnFmc0FHUEZJa2ZobGkvdnRTSmJydW5FL0hqSXRIY29mZDYrMnBWeWcxUFE9PQhYMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEHo7DeavfOx/H5ixSAbTRZFEurkOCf4ezO6SxZa58jzdhRzYMBbgxwFYRP2TfIoYjLKcHsEwOQG6SrNX2LSLG+QlGMEQCIFxUCL06AH9+cmaskOShpb1xhp3HwJ8nYODr3lIxqk8wAiBjHfpD+WQBfbWEr/+ZPLr/crThohM/v2Rr4bz15Rtztg==",
    "invoice_id": "100",
    "invoice_uuid": "ff891ec0-a889-431a-8f25-81934f425397"
}
```

## 422 (Validation Error) / 500

If there was an internal processing error due to incorrect inputs, there was a server crash or schematron validation errors you get the the following response&#x20;

| Parameter   | Value          | Description                                                                                       |
| ----------- | -------------- | ------------------------------------------------------------------------------------------------- |
| message     | Sample Message | Message string which contains the appropriate error message                                       |
| error\_code | 1006           | Error codes which can be shared to us to get further information regarding the reason for failure |
| data        | {}             | Object which returns more information on the specific error                                       |

```json
{
    "data": {
        "info_messages": [
            {
                "type": "INFO",
                "code": "XSD_ZATCA_VALID",
                "category": "",
                "message": "Complied with UBL 2.1 standards in line with ZATCA specifications",
                "status": "",
                "source": "MI"
            }
        ],
        "warning_messages": [],
        "error_messages": []
    }
    "error_code": 1000
    "message": "Schematron Validation Failed"
}
```
