{
  "openapi": "3.1.0",
  "info": {
    "title": "Rahunok Free Ukrainian Counterparty Checker API (EDRPOU / RNOKPP)",
    "version": "1.0.0",
    "description": "Free, zero-auth Ukrainian counterparty verification by EDRPOU (8 digits) or RNOKPP/IPN (10 digits). Returns legal entity status, name, address, director, VAT taxpayer ID, NBU bank liquidation status, DRFO metadata, and ready-to-use invoice prefill fields. Built for Gemini, Grok, ChatGPT, Claude and ERP integrations.",
    "contact": {
      "name": "Rahunok",
      "url": "https://rahunok.com/instrumenty/perevirka-kontragenta/",
      "email": "rahunok@rahunok.com"
    }
  },
  "servers": [
    {
      "url": "https://rahunok.com"
    }
  ],
  "paths": {
    "/api/counterparty": {
      "get": {
        "operationId": "checkUkrainianCounterpartyGet",
        "summary": "Verify Ukrainian EDRPOU (8 digits) or RNOKPP/IPN (10 digits) and fetch registration + VAT dossier",
        "description": "Validates Mod-11 (EDRPOU) or DRFO (RNOKPP) checksum, checks active vs liquidation status, resolves company name, address, director, VAT IPN, NBU bank license status, and returns prefill fields for /api/invoice.pdf. Free, no API key required.",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": false,
            "description": "8-digit Ukrainian EDRPOU or 10-digit RNOKPP/IPN. If omitted, returns API guide.",
            "schema": {
              "type": "string",
              "example": "37193071"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Response language for status labels and guidance: uk (default), en, pl, or ru.",
            "schema": {
              "type": "string",
              "enum": [
                "uk",
                "en",
                "pl",
                "ru"
              ],
              "default": "uk"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Counterparty dossier and verification result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_free": {
                      "type": "boolean"
                    },
                    "price": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "code_type": {
                      "type": "string",
                      "enum": [
                        "edrpou",
                        "rnokpp",
                        "vat_inn",
                        "invalid"
                      ]
                    },
                    "valid_format": {
                      "type": "boolean"
                    },
                    "checksum_valid": {
                      "type": "boolean"
                    },
                    "found_in_registry": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "terminating",
                        "terminated",
                        "unknown",
                        "invalid"
                      ]
                    },
                    "status_label": {
                      "type": "string"
                    },
                    "risk_level": {
                      "type": "string",
                      "enum": [
                        "low",
                        "medium",
                        "high"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "short_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "address": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "director": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kved_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kved_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "registration_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "termination_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vat": {
                      "type": "object"
                    },
                    "single_tax": {
                      "type": "object"
                    },
                    "nbu_institution": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "person_meta": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "proforma_prefill": {
                      "type": "object"
                    },
                    "markdown_summary": {
                      "type": "string"
                    },
                    "human_tool_url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "checkUkrainianCounterpartyPost",
        "summary": "Verify Ukrainian counterparty by EDRPOU or RNOKPP via JSON body",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "8-digit EDRPOU or 10-digit RNOKPP/IPN.",
                    "example": "37193071"
                  },
                  "lang": {
                    "type": "string",
                    "enum": [
                      "uk",
                      "en",
                      "pl",
                      "ru"
                    ],
                    "default": "uk"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Counterparty dossier and verification result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_free": {
                      "type": "boolean"
                    },
                    "price": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "code_type": {
                      "type": "string",
                      "enum": [
                        "edrpou",
                        "rnokpp",
                        "vat_inn",
                        "invalid"
                      ]
                    },
                    "valid_format": {
                      "type": "boolean"
                    },
                    "checksum_valid": {
                      "type": "boolean"
                    },
                    "found_in_registry": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "terminating",
                        "terminated",
                        "unknown",
                        "invalid"
                      ]
                    },
                    "status_label": {
                      "type": "string"
                    },
                    "risk_level": {
                      "type": "string",
                      "enum": [
                        "low",
                        "medium",
                        "high"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "short_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "address": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "director": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kved_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kved_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "registration_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "termination_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vat": {
                      "type": "object"
                    },
                    "single_tax": {
                      "type": "object"
                    },
                    "nbu_institution": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "person_meta": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "proforma_prefill": {
                      "type": "object"
                    },
                    "markdown_summary": {
                      "type": "string"
                    },
                    "human_tool_url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing code or invalid JSON"
          }
        }
      }
    }
  }
}