{
  "openapi": "3.0.1",
  "info": {
    "title": "Arabic Receipt Reader (OCR + Saudi ZATCA QR)",
    "description": "Reads Arabic and English receipts and invoices, including Arabic-Indic digits: full OCR, total/VAT/subtotal/line-item candidates checked against each other, a needsReview flag, and exact fields from Saudi ZATCA e-invoice QR codes (signature not checked). For dense documents use Arabic Image OCR.",
    "version": "0.1",
    "x-build-id": "tdhbeB3RNI7CEpBY4"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/saif-tools~arabic-receipt-reader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-saif-tools-arabic-receipt-reader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/saif-tools~arabic-receipt-reader/runs": {
      "post": {
        "operationId": "runs-sync-saif-tools-arabic-receipt-reader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/saif-tools~arabic-receipt-reader/run-sync": {
      "post": {
        "operationId": "run-sync-saif-tools-arabic-receipt-reader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "imageUrls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Public links to receipt/invoice images (JPEG, PNG, WebP, GIF, BMP or TIFF). Images over 4 megapixels are billed as photos and downscaled to 4 MP before OCR. Leave empty to run the bundled sample receipt (free, marked sample: true).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "keyValueStoreRecords": {
            "title": "Key-value store records",
            "type": "array",
            "description": "Images already uploaded to an Apify key-value store. Write <code>record-key</code> for this run's default store, or <code>store-name-or-id/record-key</code>.",
            "items": {
              "type": "string"
            }
          },
          "includeQrFields": {
            "title": "Read Saudi e-invoice QR fields",
            "type": "boolean",
            "description": "Decode a Saudi ZATCA e-invoice QR when present and cross-check the printed total and VAT against it. Included in the receipt price: no extra charge. Turn off only if you do not want QR fields in the output.",
            "default": true
          },
          "confidenceThreshold": {
            "title": "Full-OCR: confidence threshold (0-100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "OCR confidence (0-100) below which a number is marked lowConfidence. Low confidence only sets needsReview when the total cannot be reconciled with line items, VAT or the QR total.",
            "default": 80
          },
          "sumToleranceCents": {
            "title": "Reconciliation tolerance (1/100 of the currency)",
            "minimum": 0,
            "type": "integer",
            "description": "How far line items + VAT (or subtotal + VAT, or the QR total) may be from the total and still count as reconciled. 5 = 0.05 SAR/AED.",
            "default": 5
          },
          "deskew": {
            "title": "Straighten tilted images",
            "type": "boolean",
            "description": "Detects and corrects rotation up to ±10°.",
            "default": true
          },
          "digitSecondPass": {
            "title": "Arabic-Indic digit second pass",
            "type": "boolean",
            "description": "Re-reads Arabic-Indic and Persian digits with a dedicated digit classifier. In full-OCR mode it cross-checks each number.",
            "default": true
          },
          "maskQrCodes": {
            "title": "Hide QR codes from OCR",
            "type": "boolean",
            "description": "Blanks detected QR codes before OCR so they don't turn into junk text.",
            "default": true
          },
          "stripTatweel": {
            "title": "Remove tatweel (ـ) in the normalised text",
            "type": "boolean",
            "description": "The normalised fields drop tatweel and map Arabic-Indic and Persian digits to 0-9 (٫ → . and ٬ → ,). The raw fields keep the text as read.",
            "default": true
          },
          "outputLines": {
            "title": "Include lines with confidence",
            "type": "boolean",
            "description": "One entry per text line with its confidence, bounding box and direction.",
            "default": true
          },
          "outputWords": {
            "title": "Include word boxes",
            "type": "boolean",
            "description": "Adds the words of each line with their bounding boxes. Makes rows much larger.",
            "default": false
          },
          "maxImageSizeMb": {
            "title": "Maximum image size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Larger files are skipped with a free error row.",
            "default": 20
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}