{
 "openapi": "3.1.0",
 "info": {
  "title": "ZATCA Onboarding (Accounting)",
  "version": "20261030b",
  "description": "Each signing unit taken through ZATCA’s onboarding: choose the environment (the Developer Portal sandbox, simulation, or production), enter the one-time password from the Fatoora portal, run the compliance checks (one sample of each document the unit issues), then request the production certificate. Renew before the certificate expires — a warning is raised 30 days ahead. The keys and ZATCA’s secrets are sealed and never shown. Register the unit itself under ZATCA Signing Units first."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "zatca-onboarding": {
    "type": "object",
    "required": [],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "branch_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Branch unit id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Code",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Name",
      "readOnly": true
     },
     "common_name": {
      "type": "string",
      "description": "Common name",
      "readOnly": true
     },
     "egs_serial": {
      "type": "string",
      "description": "Egs serial",
      "readOnly": true
     },
     "organization_unit": {
      "type": "string",
      "description": "Organization unit",
      "readOnly": true
     },
     "invoice_types": {
      "type": "string",
      "description": "Invoice types",
      "readOnly": true
     },
     "location": {
      "type": "string",
      "description": "Location",
      "readOnly": true
     },
     "industry": {
      "type": "string",
      "description": "Industry",
      "readOnly": true
     },
     "environment": {
      "type": "string",
      "description": "Environment",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "is_default": {
      "type": "boolean",
      "description": "Is default",
      "readOnly": true
     },
     "is_test": {
      "type": "boolean",
      "description": "Is test",
      "readOnly": true
     },
     "public_key_der": {
      "type": "string",
      "description": "Public key der",
      "readOnly": true
     },
     "csr": {
      "type": "string",
      "description": "Csr",
      "readOnly": true
     },
     "certificate": {
      "type": "string",
      "description": "Certificate",
      "readOnly": true
     },
     "certificate_serial": {
      "type": "string",
      "description": "Certificate serial",
      "readOnly": true
     },
     "certificate_issuer": {
      "type": "string",
      "description": "Certificate issuer",
      "readOnly": true
     },
     "certificate_expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Certificate expires at",
      "readOnly": true
     },
     "compliance_csid": {
      "type": "string",
      "description": "Compliance csid",
      "readOnly": true
     },
     "compliance_request_id": {
      "type": "string",
      "description": "Compliance request id",
      "readOnly": true
     },
     "production_csid": {
      "type": "string",
      "description": "Production csid",
      "readOnly": true
     },
     "production_csid_expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Production csid expires at",
      "readOnly": true
     },
     "onboarded_at": {
      "type": "string",
      "format": "date-time",
      "description": "Onboarded at",
      "readOnly": true
     },
     "last_icv": {
      "type": "string",
      "format": "decimal",
      "description": "Last icv",
      "readOnly": true
     },
     "last_hash": {
      "type": "string",
      "description": "Last hash",
      "readOnly": true
     },
     "last_invoice_id": {
      "type": "string",
      "format": "uuid",
      "description": "Last invoice id",
      "readOnly": true
     },
     "last_stamped_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last stamped at",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "onboarding_step": {
      "type": "string",
      "description": "Onboarding step",
      "readOnly": true
     },
     "onboarding_step_at": {
      "type": "string",
      "format": "date-time",
      "description": "Onboarding step at",
      "readOnly": true
     },
     "onboarding_message": {
      "type": "string",
      "description": "Onboarding message",
      "readOnly": true
     },
     "compliance_passed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Compliance passed at",
      "readOnly": true
     },
     "production_request_id": {
      "type": "string",
      "description": "Production request id",
      "readOnly": true
     },
     "pending_public_key_der": {
      "type": "string",
      "description": "Pending public key der",
      "readOnly": true
     },
     "pending_csr": {
      "type": "string",
      "description": "Pending csr",
      "readOnly": true
     },
     "renewed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Renewed at",
      "readOnly": true
     },
     "certificate_is_sample": {
      "type": "boolean",
      "description": "Certificate is sample",
      "readOnly": true
     },
     "expiry_warned_on": {
      "type": "string",
      "format": "date",
      "description": "Expiry warned on",
      "readOnly": true
     },
     "clearance_off_seen_at": {
      "type": "string",
      "format": "date-time",
      "description": "Clearance off seen at",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/zatca-onboarding": {
   "get": {
    "summary": "list zatca-onboarding",
    "operationId": "list_zatca_onboarding_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post zatca onboarding",
    "operationId": "action_zatca_onboarding_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}": {
   "get": {
    "summary": "get zatca-onboarding",
    "operationId": "get_zatca_onboarding_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put zatca onboarding",
    "operationId": "action_zatca_onboarding_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete zatca onboarding",
    "operationId": "action_zatca_onboarding_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/start": {
   "post": {
    "summary": "Start",
    "operationId": "action_zatca_onboarding_0_6",
    "description": "Body keys: environment, otp",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/compliance-checks": {
   "post": {
    "summary": "Compliance checks",
    "operationId": "action_zatca_onboarding_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/production": {
   "post": {
    "summary": "Production",
    "operationId": "action_zatca_onboarding_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/renew": {
   "post": {
    "summary": "Renew",
    "operationId": "action_zatca_onboarding_0_6",
    "description": "Body keys: otp",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/checks": {
   "get": {
    "summary": "Checks",
    "operationId": "action_zatca_onboarding_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/log": {
   "get": {
    "summary": "Log",
    "operationId": "action_zatca_onboarding_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-onboarding/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_zatca_onboarding_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}