{
  "openapi": "3.1.0",
  "info": {
    "title": "Habitoo Partner API v1",
    "version": "1.1.0",
    "description": "Contractul implementat P1–P5, inclusiv webhooks semnate și mediu demo izolat. Cheile se emit manual după solicitare; nu există emitere automată imediată."
  },
  "servers": [
    {
      "url": "https://www.habitoo.ro/api/public/partner/v1",
      "description": "Partner API public"
    }
  ],
  "security": [
    {
      "PartnerBearer": []
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "summary": "Identitatea portalului",
        "description": "Confirmă portalul, mediul cheii și limita. Metodă diferită de GET: 400 METHOD_NOT_ALLOWED.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                },
                "example": {
                  "portal": {
                    "id": "portal-demo",
                    "name": "Portal Demo",
                    "slug": "portal-demo"
                  },
                  "environment": "test",
                  "rate_limits": {
                    "requests_per_minute": 120,
                    "window_seconds": 60
                  },
                  "active_agencies": 1,
                  "api_version": "1.0"
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agencies": {
      "get": {
        "summary": "Agenții activate",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Agency"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "a7b50000-0000-4000-8000-000000000001",
                      "name": "Agenția Demo Habitoo",
                      "legal_name": "Agenția Demo Habitoo — FICTIV",
                      "cui": "DEMO-FICTIV-000",
                      "email": "demo@example.invalid",
                      "phone": "0000000000",
                      "website": null,
                      "logo_url": null,
                      "address": null,
                      "city": null,
                      "county": null,
                      "activated_at": "2026-11-07T12:00:00Z",
                      "status": "active"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agencies/{id}": {
      "get": {
        "summary": "Detaliile entității",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UUID al entității accesibile acestui portal.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agency"
                },
                "example": {
                  "id": "a7b50000-0000-4000-8000-000000000001",
                  "name": "Agenția Demo Habitoo",
                  "legal_name": "Agenția Demo Habitoo — FICTIV",
                  "cui": "DEMO-FICTIV-000",
                  "email": "demo@example.invalid",
                  "phone": "0000000000",
                  "website": null,
                  "logo_url": null,
                  "address": null,
                  "city": null,
                  "county": null,
                  "activated_at": "2026-11-07T12:00:00Z",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "get": {
        "summary": "Agenți accesibili",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "agency_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filtru opțional pe agenție."
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Agent"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "a7b50000-0000-4000-8000-000000000002",
                      "agency_id": "a7b50000-0000-4000-8000-000000000001",
                      "name": "Agent Demo 1",
                      "first_name": "Agent",
                      "last_name": "Demo 1",
                      "email": "agent1@example.invalid",
                      "phone": "0000000000",
                      "photo_url": null,
                      "position": "Agent Demo"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{id}": {
      "get": {
        "summary": "Detaliile entității",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UUID al entității accesibile acestui portal.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                },
                "example": {
                  "id": "a7b50000-0000-4000-8000-000000000002",
                  "agency_id": "a7b50000-0000-4000-8000-000000000001",
                  "name": "Agent Demo 1",
                  "first_name": "Agent",
                  "last_name": "Demo 1",
                  "email": "agent1@example.invalid",
                  "phone": "0000000000",
                  "photo_url": null,
                  "position": "Agent Demo"
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/listings": {
      "get": {
        "summary": "Inventarul anunțurilor",
        "description": "Ordine stabilă după actualizare și identificator. Retragerile se păstrează 30 zile.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "agency_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Restrânge inventarul la agenție."
          },
          {
            "name": "updated_since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Modificări după momentul indicat."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "withdrawn",
                "all"
              ],
              "default": "all"
            },
            "description": "active include anunțuri vizibile active sau rezervate."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Dimensiunea paginii."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 400
            },
            "description": "Cursor opac; păstrează aceleași filtre."
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Listing"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "a7b50000-0000-4000-8000-000000000100",
                      "reference": "TEST-001",
                      "agency_id": "a7b50000-0000-4000-8000-000000000001",
                      "agent_id": "a7b50000-0000-4000-8000-000000000002",
                      "status": "active",
                      "offers": [
                        {
                          "type": "sale",
                          "price": 80000,
                          "currency": "EUR",
                          "vat_included": null,
                          "negotiable": false
                        }
                      ],
                      "property_type": "apartment",
                      "property_subtype": null,
                      "title": "[Test] apartment — exemplu 1",
                      "description": "Anunț fictiv pentru testarea integrării Partner API. Nu reprezintă o ofertă reală.",
                      "rooms": 3,
                      "bedrooms": 2,
                      "bathrooms": 1,
                      "kitchens": null,
                      "balconies": null,
                      "usable_area": null,
                      "built_area": null,
                      "land_area": null,
                      "floor": 1,
                      "floors_total": null,
                      "build_year": 2020,
                      "layout": null,
                      "heating": null,
                      "furnishing": null,
                      "parking": null,
                      "energy_class": null,
                      "features": [],
                      "location": {
                        "county": "București",
                        "city": "București",
                        "district": "Centru",
                        "street": "Strada Fictivă Demo",
                        "street_number": "1",
                        "latitude": 44.43,
                        "longitude": 26.1,
                        "is_precise": true
                      },
                      "images": [
                        {
                          "url": "https://example.invalid/apartment.jpg",
                          "position": 0,
                          "is_cover": true
                        }
                      ],
                      "floor_plans": [],
                      "video_url": null,
                      "virtual_tour_url": null,
                      "created_at": "2026-11-07T12:00:00Z",
                      "updated_at": "2026-11-07T12:00:00Z",
                      "withdrawn_at": null
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/listings/{id}": {
      "get": {
        "summary": "Detaliile anunțului",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UUID al entității accesibile acestui portal.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Listing"
                },
                "example": {
                  "id": "a7b50000-0000-4000-8000-000000000100",
                  "reference": "TEST-001",
                  "agency_id": "a7b50000-0000-4000-8000-000000000001",
                  "agent_id": "a7b50000-0000-4000-8000-000000000002",
                  "status": "active",
                  "offers": [
                    {
                      "type": "sale",
                      "price": 80000,
                      "currency": "EUR",
                      "vat_included": null,
                      "negotiable": false
                    }
                  ],
                  "property_type": "apartment",
                  "property_subtype": null,
                  "title": "[Test] apartment — exemplu 1",
                  "description": "Anunț fictiv pentru testarea integrării Partner API. Nu reprezintă o ofertă reală.",
                  "rooms": 3,
                  "bedrooms": 2,
                  "bathrooms": 1,
                  "kitchens": null,
                  "balconies": null,
                  "usable_area": null,
                  "built_area": null,
                  "land_area": null,
                  "floor": 1,
                  "floors_total": null,
                  "build_year": 2020,
                  "layout": null,
                  "heating": null,
                  "furnishing": null,
                  "parking": null,
                  "energy_class": null,
                  "features": [],
                  "location": {
                    "county": "București",
                    "city": "București",
                    "district": "Centru",
                    "street": "Strada Fictivă Demo",
                    "street_number": "1",
                    "latitude": 44.43,
                    "longitude": 26.1,
                    "is_precise": true
                  },
                  "images": [
                    {
                      "url": "https://example.invalid/apartment.jpg",
                      "position": 0,
                      "is_cover": true
                    }
                  ],
                  "floor_plans": [],
                  "video_url": null,
                  "virtual_tour_url": null,
                  "created_at": "2026-11-07T12:00:00Z",
                  "updated_at": "2026-11-07T12:00:00Z",
                  "withdrawn_at": null
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/taxonomies": {
      "get": {
        "summary": "Liste de valori",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Taxonomies"
                },
                "example": {
                  "listing_status": [
                    {
                      "code": "active",
                      "label": "Activ"
                    },
                    {
                      "code": "reserved",
                      "label": "Rezervat"
                    },
                    {
                      "code": "withdrawn",
                      "label": "Retras"
                    }
                  ],
                  "offer_type": [
                    {
                      "code": "sale",
                      "label": "Vânzare"
                    },
                    {
                      "code": "rent",
                      "label": "Închiriere"
                    }
                  ],
                  "currency": [
                    {
                      "code": "EUR",
                      "label": "Euro"
                    },
                    {
                      "code": "RON",
                      "label": "Leu"
                    },
                    {
                      "code": "USD",
                      "label": "Dolar american"
                    }
                  ],
                  "property_type": [
                    {
                      "code": "apartment",
                      "label": "Apartament"
                    },
                    {
                      "code": "studio",
                      "label": "Garsonieră"
                    },
                    {
                      "code": "house",
                      "label": "Casă"
                    },
                    {
                      "code": "villa",
                      "label": "Vilă"
                    },
                    {
                      "code": "land",
                      "label": "Teren"
                    },
                    {
                      "code": "commercial",
                      "label": "Spațiu comercial"
                    },
                    {
                      "code": "office",
                      "label": "Birou"
                    },
                    {
                      "code": "industrial",
                      "label": "Hală / spațiu industrial"
                    },
                    {
                      "code": "duplex",
                      "label": "Duplex"
                    },
                    {
                      "code": "penthouse",
                      "label": "Penthouse"
                    },
                    {
                      "code": "other",
                      "label": "Altele"
                    }
                  ],
                  "layout": [
                    {
                      "code": "decomandat",
                      "label": "Decomandat"
                    },
                    {
                      "code": "semidecomandat",
                      "label": "Semidecomandat"
                    },
                    {
                      "code": "nedecomandat",
                      "label": "Nedecomandat"
                    },
                    {
                      "code": "circular",
                      "label": "Circular"
                    },
                    {
                      "code": "vagon",
                      "label": "Vagon"
                    },
                    {
                      "code": "open_space",
                      "label": "Open space"
                    }
                  ],
                  "heating": [
                    {
                      "code": "termoficare",
                      "label": "Termoficare"
                    },
                    {
                      "code": "centrala_proprie",
                      "label": "Centrală proprie"
                    },
                    {
                      "code": "centrala_imobil",
                      "label": "Centrală imobil"
                    },
                    {
                      "code": "convectoare",
                      "label": "Convectoare"
                    },
                    {
                      "code": "soba_teracota",
                      "label": "Sobă teracotă"
                    },
                    {
                      "code": "centrala_pe_lemne",
                      "label": "Centrală pe lemne"
                    },
                    {
                      "code": "incalzire_pardoseala",
                      "label": "Încălzire pardoseală"
                    },
                    {
                      "code": "calorifere",
                      "label": "Calorifere"
                    },
                    {
                      "code": "pompa_de_caldura",
                      "label": "Pompă de căldură"
                    }
                  ],
                  "furnishing": [
                    {
                      "code": "complet",
                      "label": "Complet"
                    },
                    {
                      "code": "partial",
                      "label": "Parțial"
                    },
                    {
                      "code": "nemobilat",
                      "label": "Nemobilat"
                    },
                    {
                      "code": "lux",
                      "label": "Lux"
                    },
                    {
                      "code": "modern",
                      "label": "Modern"
                    }
                  ],
                  "parking": [
                    {
                      "code": "fara",
                      "label": "Fără"
                    },
                    {
                      "code": "loc_de_parcare",
                      "label": "Loc de parcare"
                    },
                    {
                      "code": "garaj",
                      "label": "Garaj"
                    },
                    {
                      "code": "parcare_subterana",
                      "label": "Parcare subterană"
                    },
                    {
                      "code": "parcare_supraterana",
                      "label": "Parcare supraterană"
                    }
                  ],
                  "energy_class": [
                    {
                      "code": "A++",
                      "label": "Clasa A++"
                    },
                    {
                      "code": "A+",
                      "label": "Clasa A+"
                    },
                    {
                      "code": "A",
                      "label": "Clasa A"
                    },
                    {
                      "code": "B",
                      "label": "Clasa B"
                    },
                    {
                      "code": "C",
                      "label": "Clasa C"
                    },
                    {
                      "code": "D",
                      "label": "Clasa D"
                    },
                    {
                      "code": "E",
                      "label": "Clasa E"
                    },
                    {
                      "code": "F",
                      "label": "Clasa F"
                    },
                    {
                      "code": "G",
                      "label": "Clasa G"
                    }
                  ],
                  "features": [
                    {
                      "code": "terasa",
                      "label": "Terasă"
                    },
                    {
                      "code": "wc_serviciu",
                      "label": "WC serviciu"
                    },
                    {
                      "code": "boxa_la_subsol",
                      "label": "Boxă la subsol"
                    },
                    {
                      "code": "debara",
                      "label": "Debara"
                    },
                    {
                      "code": "pivnita",
                      "label": "Pivniță"
                    },
                    {
                      "code": "dressing",
                      "label": "Dressing"
                    },
                    {
                      "code": "mobilata",
                      "label": "Mobilată"
                    },
                    {
                      "code": "partial_mobilata",
                      "label": "Parțial mobilată"
                    },
                    {
                      "code": "utilata",
                      "label": "Utilată"
                    },
                    {
                      "code": "partial_utilata",
                      "label": "Parțial utilată"
                    },
                    {
                      "code": "nemobilata",
                      "label": "Nemobilată"
                    },
                    {
                      "code": "neutilata",
                      "label": "Neutilată"
                    },
                    {
                      "code": "apometre",
                      "label": "Apometre"
                    },
                    {
                      "code": "contor_caldura",
                      "label": "Contor căldură"
                    },
                    {
                      "code": "contor_gaz",
                      "label": "Contor gaz"
                    },
                    {
                      "code": "contor_curent_electric",
                      "label": "Contor curent electric"
                    },
                    {
                      "code": "contorizare_separata",
                      "label": "Contorizare separată"
                    },
                    {
                      "code": "masina_de_spalat_rufe",
                      "label": "Mașină de spălat rufe"
                    },
                    {
                      "code": "frigider",
                      "label": "Frigider"
                    },
                    {
                      "code": "aragaz",
                      "label": "Aragaz"
                    },
                    {
                      "code": "masina_de_spalat_vase",
                      "label": "Mașină de spălat vase"
                    },
                    {
                      "code": "fier_de_calcat",
                      "label": "Fier de călcat"
                    },
                    {
                      "code": "tv",
                      "label": "TV"
                    },
                    {
                      "code": "cafetiera",
                      "label": "Cafetieră"
                    },
                    {
                      "code": "uscator_par",
                      "label": "Uscător păr"
                    },
                    {
                      "code": "toaster",
                      "label": "Toaster"
                    },
                    {
                      "code": "dvd",
                      "label": "DVD"
                    },
                    {
                      "code": "sandwich_maker",
                      "label": "Sandwich-maker"
                    },
                    {
                      "code": "cuptor_microunde",
                      "label": "Cuptor microunde"
                    },
                    {
                      "code": "hota",
                      "label": "Hotă"
                    },
                    {
                      "code": "robot_bucatarie",
                      "label": "Robot bucătărie"
                    },
                    {
                      "code": "aspirator",
                      "label": "Aspirator"
                    },
                    {
                      "code": "hi_fi",
                      "label": "HI-FI"
                    },
                    {
                      "code": "plita_electrica",
                      "label": "Plită electrică"
                    },
                    {
                      "code": "interfon",
                      "label": "Interfon"
                    },
                    {
                      "code": "videointerfon",
                      "label": "Videointerfon"
                    },
                    {
                      "code": "supraveghere_video",
                      "label": "Supraveghere video"
                    },
                    {
                      "code": "lift",
                      "label": "Lift"
                    },
                    {
                      "code": "spatii_agrement",
                      "label": "Spații agrement"
                    },
                    {
                      "code": "sauna",
                      "label": "Sauna"
                    },
                    {
                      "code": "spa",
                      "label": "SPA"
                    },
                    {
                      "code": "acoperis",
                      "label": "Acoperiș"
                    },
                    {
                      "code": "curte",
                      "label": "Curte"
                    },
                    {
                      "code": "curte_comuna",
                      "label": "Curte comună"
                    },
                    {
                      "code": "gradina",
                      "label": "Grădină"
                    },
                    {
                      "code": "piscina_interioara",
                      "label": "Piscină interioară"
                    },
                    {
                      "code": "piscina_exterioara",
                      "label": "Piscină exterioară"
                    },
                    {
                      "code": "uscatorie",
                      "label": "Uscătorie"
                    },
                    {
                      "code": "asfaltate",
                      "label": "Asfaltate"
                    },
                    {
                      "code": "pietruite",
                      "label": "Pietruite"
                    },
                    {
                      "code": "neamenajate",
                      "label": "Neamenajate"
                    },
                    {
                      "code": "betonate",
                      "label": "Betonate"
                    },
                    {
                      "code": "iluminat_stradal",
                      "label": "Iluminat stradal"
                    },
                    {
                      "code": "mijloace_de_transport_in_comun",
                      "label": "Mijloace de transport în comun"
                    },
                    {
                      "code": "panoramica",
                      "label": "Panoramică"
                    },
                    {
                      "code": "spre_lac",
                      "label": "Spre lac"
                    },
                    {
                      "code": "spre_mare",
                      "label": "Spre mare"
                    },
                    {
                      "code": "spre_munte",
                      "label": "Spre munte"
                    },
                    {
                      "code": "spre_oras",
                      "label": "Spre oraș"
                    },
                    {
                      "code": "spre_padure",
                      "label": "Spre pădure"
                    },
                    {
                      "code": "jacuzzi",
                      "label": "Jacuzzi"
                    },
                    {
                      "code": "scara_interioara",
                      "label": "Scară interioară"
                    },
                    {
                      "code": "semineu",
                      "label": "Șemineu"
                    },
                    {
                      "code": "senzor_de_fum",
                      "label": "Senzor de fum"
                    },
                    {
                      "code": "sistem_de_alarma",
                      "label": "Sistem de alarmă"
                    },
                    {
                      "code": "telecomanda_poarta_garaj",
                      "label": "Telecomandă poartă garaj"
                    },
                    {
                      "code": "telecomanda_poarta_acces_auto",
                      "label": "Telecomandă poartă acces auto"
                    },
                    {
                      "code": "aer_conditionat",
                      "label": "Aer condiționat"
                    },
                    {
                      "code": "ventiloconvectoare",
                      "label": "Ventiloconvectoare"
                    },
                    {
                      "code": "aeroterme",
                      "label": "Aeroterme"
                    }
                  ],
                  "event_type": [
                    {
                      "code": "listing.upserted",
                      "label": "Anunț nou sau modificat"
                    },
                    {
                      "code": "listing.withdrawn",
                      "label": "Anunț retras"
                    },
                    {
                      "code": "agency.activated",
                      "label": "Agenție activată"
                    },
                    {
                      "code": "agency.deactivated",
                      "label": "Agenție dezactivată"
                    },
                    {
                      "code": "agent.updated",
                      "label": "Agent modificat"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/changes": {
      "get": {
        "summary": "Flux de modificări",
        "description": "Evenimente crescătoare după seq, păstrate 90 zile. Salvează next_cursor numai după aplicarea paginii.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 400
            },
            "description": "Fără cursor: inițializează poziția curentă, fără evenimente."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "Numărul de evenimente."
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Change"
                      }
                    },
                    "next_cursor": {
                      "type": "string"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [],
                  "next_cursor": "eyJzIjowfQ",
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/listings/{id}/publication": {
      "post": {
        "summary": "Starea publicării",
        "description": "Acceptă anunțuri vizibile acum sau retrase în ultimele 30 zile. O stare mai veche nu suprascrie starea nouă. Test: id este identificatorul înregistrării de feedback, nu listing_id.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UUID al entității accesibile acestui portal.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteResult"
                },
                "example": {
                  "id": "a7b50000-0000-4000-8000-000000000100",
                  "applied": true
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Publication"
              },
              "example": {
                "status": "published",
                "portal_listing_id": "DEMO-001",
                "url": "https://example.invalid/anunt/demo-001",
                "occurred_at": "2026-11-07T12:00:00Z"
              }
            }
          }
        }
      }
    },
    "/leads": {
      "post": {
        "summary": "Trimite lead",
        "description": "Email sau telefon obligatoriu; listing_id sau agency_id obligatoriu. Deduplicare portal + external_id. Testul folosește date separate, fără emailuri, cu marcaj Test.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lead deduplicat.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "const": "accepted",
                      "type": "string"
                    },
                    "deduplicated": {
                      "type": "boolean"
                    },
                    "test": {
                      "type": "boolean"
                    },
                    "label": {
                      "const": "Test",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "deduplicated"
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "status": "accepted",
                  "deduplicated": false
                }
              }
            }
          },
          "201": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "const": "accepted",
                      "type": "string"
                    },
                    "deduplicated": {
                      "type": "boolean"
                    },
                    "test": {
                      "type": "boolean"
                    },
                    "label": {
                      "const": "Test",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "deduplicated"
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "status": "accepted",
                  "deduplicated": false
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Lead"
              },
              "example": {
                "external_id": "DEMO-LEAD-001",
                "agency_id": "a7b50000-0000-4000-8000-000000000001",
                "name": "Client Demo",
                "email": "demo@example.invalid",
                "message": "Mesaj fictiv pentru test."
              }
            }
          }
        }
      }
    },
    "/leads/{id}/messages": {
      "post": {
        "summary": "Mesaj client",
        "description": "Acceptă numai lead-uri ale aceluiași portal și mediu.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UUID al entității accesibile acestui portal.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteResult"
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "deduplicated": false
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Message"
              },
              "example": {
                "external_id": "DEMO-MSG-001",
                "sender": "client",
                "body": "Mesaj fictiv."
              }
            }
          }
        }
      }
    },
    "/stats": {
      "post": {
        "summary": "Statistici zilnice",
        "description": "Maximum 500 rânduri; valorile suprascriu ziua, fără adunare la retrimitere. Anunț accesibil acum sau retras în ultimele 30 zile. Corpul este limitat la 1 MiB.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "accepted"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "accepted": 1
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Stats"
              },
              "example": {
                "items": [
                  {
                    "listing_id": "a7b50000-0000-4000-8000-000000000100",
                    "date": "2026-11-07",
                    "views": 12,
                    "contacts": 2,
                    "favorites": 1
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/sandbox/simulate": {
      "post": {
        "summary": "Simulează o modificare demo",
        "description": "Doar test; live primește 403. Generează eveniment în /changes. Corpul este limitat la 1000 caractere.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "listing.upserted",
                        "listing.withdrawn",
                        "agent.updated"
                      ]
                    },
                    "seq": {
                      "type": "integer"
                    },
                    "agency_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "seq",
                    "agency_id"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "a7b50000-0000-4000-8000-000000000100",
                  "type": "listing.upserted",
                  "seq": 1,
                  "agency_id": "a7b50000-0000-4000-8000-000000000001"
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Simulate"
              },
              "example": {
                "action": "listing_update"
              }
            }
          }
        }
      }
    },
    "/sandbox/reset": {
      "post": {
        "summary": "Resetează datele demo",
        "description": "Restaurează 12 anunțuri și 2 agenți pentru portalul curent. Șterge feedbackul demo, nu datele reale. Corpul este limitat la 1000 caractere.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reset": {
                      "type": "boolean"
                    },
                    "listings": {
                      "type": "integer",
                      "const": 12
                    },
                    "agents": {
                      "type": "integer",
                      "const": 2
                    },
                    "agency_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "reset",
                    "listings",
                    "agents",
                    "agency_id"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "reset": true,
                  "listings": 12,
                  "agents": 2,
                  "agency_id": "a7b50000-0000-4000-8000-000000000001"
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Reset"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/webhook": {
      "get": {
        "summary": "Configurația webhook",
        "description": "Configurație separată per portal și mediu; null dacă nu există. Secretul nu apare în listări.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Webhook"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "example": null
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Configurează sau reactivează webhook",
        "description": "Prima setare sau rotate_secret:true întoarce secretul o singură dată. Pentru webhook activ păstrează livrările în așteptare. Pentru webhook suspendat, PUT reactivează o subscriere nouă; recuperează evenimentele omise din /changes. Lipsa events sau [] înseamnă toate evenimentele.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookConfigured"
                },
                "example": {
                  "url": "https://example.invalid/habitoo-webhook",
                  "events": [],
                  "status": "active",
                  "has_secret": true,
                  "last_success_at": null,
                  "consecutive_failures": 0
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              },
              "example": {
                "url": "https://example.invalid/habitoo-webhook",
                "events": [
                  "listing.upserted",
                  "listing.withdrawn"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Oprește webhook",
        "description": "Date accesibile numai portalului autentificat, în mediul cheii folosite.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "deleted"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "deleted": true
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhook/test": {
      "post": {
        "summary": "Trimite un test webhook",
        "description": "Încearcă imediat webhook.test prin aceeași coadă ordonată. Dacă un eveniment anterior așteaptă reîncercarea, testul rămâne în coadă; queued nu confirmă livrarea.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1–200 caractere ASCII vizibile; unic per operație, păstrat 24 ore. Reîncercarea păstrează metoda, URL-ul, Content-Type și corpul brut identice.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "queued": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "queued"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111",
                  "queued": true
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict de idempotență, cerere în procesare sau external_id conflictual.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Corpul cererii depășește limita.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type trebuie să fie application/json.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "JSON sau date invalide.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Reset"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/webhook/deliveries": {
      "get": {
        "summary": "Jurnal livrări webhook",
        "description": "Încercări în ordine descrescătoare, separate test/live, păstrate 14 zile.",
        "security": [
          {
            "PartnerBearer": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Dimensiunea paginii."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d+$",
              "maxLength": 20
            },
            "description": "Cursor numeric opac de la pagina anterioară."
          }
        ],
        "responses": {
          "200": {
            "description": "Cerere reușită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Delivery"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parametru sau Idempotency-Key invalid/lipsă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Cheie API lipsă sau invalidă.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Cheie revocată, portal dezactivat sau acțiune rezervată testului.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Entitatea nu este accesibilă acestui portal/mediu.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Metodă neacceptată (la /me se întoarce 400).",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limita de cereri este depășită.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Secunde până la reîncercare.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Serviciu indisponibil temporar.",
            "headers": {
              "X-Request-Id": {
                "description": "Identificatorul cererii.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Limita per minut configurată pentru portal.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Cereri rămase în fereastra curentă.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Sfârșitul ferestrei în secunde Unix.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Listing": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificator UUID."
          },
          "reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Referința anunțului."
          },
          "agency_id": {
            "type": "string",
            "description": "Identificatorul agenției accesibile acestui portal."
          },
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Identificatorul agentului responsabil; poate lipsi."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "reserved",
              "withdrawn"
            ],
            "description": "Starea entității."
          },
          "offers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "sale",
                    "rent"
                  ],
                  "description": "Valoarea type a entității."
                },
                "price": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Valoarea price a entității."
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Valoarea currency a entității."
                },
                "vat_included": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Valoarea vat_included a entității."
                },
                "negotiable": {
                  "type": "boolean",
                  "description": "Valoarea negotiable a entității."
                }
              },
              "required": [
                "type",
                "price",
                "currency",
                "vat_included",
                "negotiable"
              ],
              "additionalProperties": false
            },
            "description": "Oferte de vânzare și/sau închiriere."
          },
          "property_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea property_type a entității."
          },
          "property_subtype": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea property_subtype a entității."
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea title a entității."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea description a entității."
          },
          "rooms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea rooms a entității."
          },
          "bedrooms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea bedrooms a entității."
          },
          "bathrooms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea bathrooms a entității."
          },
          "kitchens": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea kitchens a entității."
          },
          "balconies": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea balconies a entității."
          },
          "usable_area": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea usable_area a entității."
          },
          "built_area": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea built_area a entității."
          },
          "land_area": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea land_area a entității."
          },
          "floor": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea floor a entității."
          },
          "floors_total": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea floors_total a entității."
          },
          "build_year": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea build_year a entității."
          },
          "layout": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea layout a entității."
          },
          "heating": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea heating a entității."
          },
          "furnishing": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea furnishing a entității."
          },
          "parking": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea parking a entității."
          },
          "energy_class": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea energy_class a entității."
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Valoarea features a entității."
          },
          "location": {
            "type": "object",
            "properties": {
              "county": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Valoarea county a entității."
              },
              "city": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Valoarea city a entității."
              },
              "district": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Valoarea district a entității."
              },
              "street": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Strada fictivă sau publică numai dacă is_precise este true; altfel null."
              },
              "street_number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Numărul stradal numai pentru locație precisă; altfel null."
              },
              "latitude": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Coordonată exactă pentru locație precisă; altfel aproximată determinist."
              },
              "longitude": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Coordonată exactă pentru locație precisă; altfel aproximată determinist."
              },
              "is_precise": {
                "type": "boolean",
                "description": "Indică dacă locația poate fi prezentată exact."
              }
            },
            "required": [
              "county",
              "city",
              "district",
              "street",
              "street_number",
              "latitude",
              "longitude",
              "is_precise"
            ],
            "additionalProperties": false,
            "description": "Valoarea location a entității."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "Valoarea url a entității."
                },
                "position": {
                  "type": "number",
                  "description": "Valoarea position a entității."
                },
                "is_cover": {
                  "type": "boolean",
                  "description": "Valoarea is_cover a entității."
                }
              },
              "required": [
                "url",
                "position",
                "is_cover"
              ],
              "additionalProperties": false
            },
            "description": "Valoarea images a entității."
          },
          "floor_plans": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "Valoarea url a entității."
                },
                "position": {
                  "type": "number",
                  "description": "Valoarea position a entității."
                }
              },
              "required": [
                "url",
                "position"
              ],
              "additionalProperties": false
            },
            "description": "Listă rezervată; momentan goală."
          },
          "video_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Rezervat; momentan null."
          },
          "virtual_tour_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Rezervat; momentan null."
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea created_at a entității."
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea updated_at a entității."
          },
          "withdrawn_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Momentul retragerii; null pentru anunț activ."
          }
        },
        "required": [
          "id",
          "reference",
          "agency_id",
          "agent_id",
          "status",
          "offers",
          "property_type",
          "property_subtype",
          "title",
          "description",
          "rooms",
          "bedrooms",
          "bathrooms",
          "kitchens",
          "balconies",
          "usable_area",
          "built_area",
          "land_area",
          "floor",
          "floors_total",
          "build_year",
          "layout",
          "heating",
          "furnishing",
          "parking",
          "energy_class",
          "features",
          "location",
          "images",
          "floor_plans",
          "video_url",
          "virtual_tour_url",
          "created_at",
          "updated_at",
          "withdrawn_at"
        ],
        "additionalProperties": false
      },
      "Agency": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificator UUID."
          },
          "name": {
            "type": "string",
            "description": "Valoarea name a agenției."
          },
          "legal_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea legal_name a agenției."
          },
          "cui": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea cui a agenției."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea email a agenției."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea phone a agenției."
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea website a agenției."
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea logo_url a agenției."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea address a agenției."
          },
          "city": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea city a agenției."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea county a agenției."
          },
          "activated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valoarea activated_at a agenției."
          },
          "status": {
            "type": "string",
            "const": "active",
            "description": "Starea entității."
          }
        },
        "required": [
          "id",
          "name",
          "legal_name",
          "cui",
          "email",
          "phone",
          "website",
          "logo_url",
          "address",
          "city",
          "county",
          "activated_at",
          "status"
        ],
        "additionalProperties": false
      },
      "Agent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Identificator UUID."
          },
          "agency_id": {
            "type": "string",
            "description": "Identificatorul agenției accesibile acestui portal."
          },
          "name": {
            "type": "string",
            "description": "Valoarea name a entității."
          },
          "first_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea first_name a entității."
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea last_name a entității."
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea email a entității."
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea phone a entității."
          },
          "photo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea photo_url a entității."
          },
          "position": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Valoarea position a entității."
          }
        },
        "required": [
          "id",
          "agency_id",
          "name",
          "first_name",
          "last_name",
          "email",
          "phone",
          "photo_url",
          "position"
        ],
        "additionalProperties": false
      },
      "Taxonomies": {
        "type": "object",
        "properties": {
          "listing_status": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "active",
                    "reserved",
                    "withdrawn"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "offer_type": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "sale",
                    "rent"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "currency": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "EUR",
                    "RON",
                    "USD"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "property_type": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "apartment",
                    "studio",
                    "house",
                    "villa",
                    "land",
                    "commercial",
                    "office",
                    "industrial",
                    "duplex",
                    "penthouse",
                    "other"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "layout": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "decomandat",
                    "semidecomandat",
                    "nedecomandat",
                    "circular",
                    "vagon",
                    "open_space"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "heating": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "termoficare",
                    "centrala_proprie",
                    "centrala_imobil",
                    "convectoare",
                    "soba_teracota",
                    "centrala_pe_lemne",
                    "incalzire_pardoseala",
                    "calorifere",
                    "pompa_de_caldura"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "furnishing": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "complet",
                    "partial",
                    "nemobilat",
                    "lux",
                    "modern"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "parking": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "fara",
                    "loc_de_parcare",
                    "garaj",
                    "parcare_subterana",
                    "parcare_supraterana"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "energy_class": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "A++",
                    "A+",
                    "A",
                    "B",
                    "C",
                    "D",
                    "E",
                    "F",
                    "G"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "features": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "terasa",
                    "wc_serviciu",
                    "boxa_la_subsol",
                    "debara",
                    "pivnita",
                    "dressing",
                    "mobilata",
                    "partial_mobilata",
                    "utilata",
                    "partial_utilata",
                    "nemobilata",
                    "neutilata",
                    "apometre",
                    "contor_caldura",
                    "contor_gaz",
                    "contor_curent_electric",
                    "contorizare_separata",
                    "masina_de_spalat_rufe",
                    "frigider",
                    "aragaz",
                    "masina_de_spalat_vase",
                    "fier_de_calcat",
                    "tv",
                    "cafetiera",
                    "uscator_par",
                    "toaster",
                    "dvd",
                    "sandwich_maker",
                    "cuptor_microunde",
                    "hota",
                    "robot_bucatarie",
                    "aspirator",
                    "hi_fi",
                    "plita_electrica",
                    "interfon",
                    "videointerfon",
                    "supraveghere_video",
                    "lift",
                    "spatii_agrement",
                    "sauna",
                    "spa",
                    "acoperis",
                    "curte",
                    "curte_comuna",
                    "gradina",
                    "piscina_interioara",
                    "piscina_exterioara",
                    "uscatorie",
                    "asfaltate",
                    "pietruite",
                    "neamenajate",
                    "betonate",
                    "iluminat_stradal",
                    "mijloace_de_transport_in_comun",
                    "panoramica",
                    "spre_lac",
                    "spre_mare",
                    "spre_munte",
                    "spre_oras",
                    "spre_padure",
                    "jacuzzi",
                    "scara_interioara",
                    "semineu",
                    "senzor_de_fum",
                    "sistem_de_alarma",
                    "telecomanda_poarta_garaj",
                    "telecomanda_poarta_acces_auto",
                    "aer_conditionat",
                    "ventiloconvectoare",
                    "aeroterme"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "event_type": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "listing.upserted",
                    "listing.withdrawn",
                    "agency.activated",
                    "agency.deactivated",
                    "agent.updated"
                  ]
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "label"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "listing_status",
          "offer_type",
          "currency",
          "property_type",
          "layout",
          "heating",
          "furnishing",
          "parking",
          "energy_class",
          "features",
          "event_type"
        ],
        "additionalProperties": false
      },
      "Change": {
        "type": "object",
        "properties": {
          "seq": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "listing.upserted",
              "listing.withdrawn",
              "agency.activated",
              "agency.deactivated",
              "agent.updated"
            ]
          },
          "entity_type": {
            "type": "string",
            "enum": [
              "listing",
              "agency",
              "agent"
            ]
          },
          "entity_id": {
            "type": "string",
            "format": "uuid"
          },
          "agency_id": {
            "type": "string",
            "format": "uuid"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "seq",
          "type",
          "entity_type",
          "entity_id",
          "agency_id",
          "occurred_at"
        ],
        "additionalProperties": false
      },
      "Publication": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "published",
              "pending_review",
              "rejected",
              "removed"
            ],
            "description": "Starea entității."
          },
          "portal_listing_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Valoare portal_listing_id."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000,
            "description": "URL HTTPS opțional.",
            "pattern": "^https://"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "description": "Valoare code."
                },
                "message": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000,
                  "description": "Valoare message."
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            },
            "maxItems": 50,
            "description": "Valoare reasons."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Momentul evenimentului ISO 8601."
          }
        },
        "required": [
          "status"
        ],
        "additionalProperties": false
      },
      "Lead": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Valoare external_id."
          },
          "listing_id": {
            "type": "string",
            "format": "uuid",
            "description": "Valoare listing_id."
          },
          "agency_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identificatorul agenției accesibile acestui portal."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Valoare name."
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254,
            "description": "Valoare email."
          },
          "phone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "Valoare phone."
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Valoare message."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Valoare created_at."
          }
        },
        "required": [
          "external_id",
          "name"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "anyOf": [
              {
                "required": [
                  "email"
                ]
              },
              {
                "required": [
                  "phone"
                ]
              }
            ]
          },
          {
            "anyOf": [
              {
                "required": [
                  "listing_id"
                ]
              },
              {
                "required": [
                  "agency_id"
                ]
              }
            ]
          }
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Valoare external_id."
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Valoare body."
          },
          "sender": {
            "type": "string",
            "const": "client",
            "description": "Valoare sender."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Valoare created_at."
          }
        },
        "required": [
          "external_id",
          "body",
          "sender"
        ],
        "additionalProperties": false
      },
      "Stats": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "listing_id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Valoare listing_id."
                },
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "description": "Valoare date.",
                  "format": "date"
                },
                "views": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647,
                  "description": "Valoare views."
                },
                "contacts": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647,
                  "description": "Valoare contacts."
                },
                "favorites": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647,
                  "description": "Valoare favorites."
                }
              },
              "required": [
                "listing_id",
                "date"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 500,
            "description": "Valoare items."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "UNAUTHORIZED",
                  "FORBIDDEN",
                  "RATE_LIMIT_EXCEEDED",
                  "INVALID_IDEMPOTENCY_KEY",
                  "IDEMPOTENCY_KEY_REQUIRED",
                  "IDEMPOTENCY_CONFLICT",
                  "REQUEST_IN_PROGRESS",
                  "SERVICE_UNAVAILABLE",
                  "METHOD_NOT_ALLOWED",
                  "INVALID_PARAMETER",
                  "NOT_FOUND",
                  "UNSUPPORTED_MEDIA_TYPE",
                  "PAYLOAD_TOO_LARGE",
                  "INVALID_JSON",
                  "VALIDATION_ERROR",
                  "EXTERNAL_ID_CONFLICT"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {}
              },
              "request_id": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "code",
              "message",
              "details",
              "request_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Me": {
        "type": "object",
        "properties": {
          "portal": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "additionalProperties": false
          },
          "environment": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "rate_limits": {
            "type": "object",
            "properties": {
              "requests_per_minute": {
                "type": "integer"
              },
              "window_seconds": {
                "type": "integer",
                "const": 60
              }
            },
            "required": [
              "requests_per_minute",
              "window_seconds"
            ],
            "additionalProperties": false
          },
          "active_agencies": {
            "type": "integer"
          },
          "api_version": {
            "type": "string",
            "const": "1.0"
          }
        },
        "required": [
          "portal",
          "environment",
          "rate_limits",
          "active_agencies",
          "api_version"
        ],
        "additionalProperties": false
      },
      "WriteResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deduplicated": {
            "type": "boolean"
          },
          "applied": {
            "type": "boolean"
          },
          "test": {
            "type": "boolean"
          }
        }
      },
      "Simulate": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "listing_update",
              "listing_withdraw",
              "listing_create",
              "agent_update"
            ]
          }
        },
        "required": [
          "action"
        ],
        "additionalProperties": false
      },
      "Reset": {
        "type": "object",
        "additionalProperties": false
      },
      "WebhookInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "HTTPS public sur portul 443, fără credențiale, IP literal sau redirecționări. A și AAAA verificate prin DNS-over-HTTPS la salvare și livrare; orice adresă nepublică este respinsă."
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "listing.upserted",
                "listing.withdrawn",
                "agency.activated",
                "agency.deactivated",
                "agent.updated"
              ]
            },
            "maxItems": 5,
            "description": "Valoare events."
          },
          "rotate_secret": {
            "type": "boolean",
            "description": "Generează un secret nou; vechiul secret nu mai semnează livrările viitoare."
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "listing.upserted",
                "listing.withdrawn",
                "agency.activated",
                "agency.deactivated",
                "agent.updated"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "has_secret": {
            "type": "boolean",
            "const": true
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "consecutive_failures": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "url",
          "events",
          "status",
          "has_secret",
          "last_success_at",
          "consecutive_failures"
        ],
        "additionalProperties": false
      },
      "WebhookConfigured": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "listing.upserted",
                "listing.withdrawn",
                "agency.activated",
                "agency.deactivated",
                "agent.updated"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "has_secret": {
            "type": "boolean",
            "const": true
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "consecutive_failures": {
            "type": "integer",
            "minimum": 0
          },
          "secret": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "32 bytes hex, afișat numai la prima setare sau rotate_secret. Pentru HMAC se decodează hex în 32 bytes, nu se folosește șirul hex ca text."
          }
        },
        "required": [
          "url",
          "events",
          "status",
          "has_secret",
          "last_success_at",
          "consecutive_failures"
        ],
        "additionalProperties": false
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string",
            "enum": [
              "listing.upserted",
              "listing.withdrawn",
              "agency.activated",
              "agency.deactivated",
              "agent.updated",
              "webhook.test"
            ]
          },
          "seq": {
            "type": "integer"
          },
          "http_status": {
            "type": [
              "integer",
              "null"
            ]
          },
          "duration_ms": {
            "type": "integer"
          },
          "attempt": {
            "type": "integer"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "event",
          "seq",
          "http_status",
          "duration_ms",
          "attempt",
          "occurred_at",
          "error"
        ],
        "additionalProperties": false
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "listing.upserted",
              "listing.withdrawn",
              "agency.activated",
              "agency.deactivated",
              "agent.updated",
              "webhook.test"
            ]
          },
          "seq": {
            "type": "integer"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "properties": {
              "agency_id": {
                "type": "string",
                "format": "uuid"
              },
              "listing_id": {
                "type": "string",
                "format": "uuid"
              },
              "agent_id": {
                "type": "string",
                "format": "uuid"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "seq",
          "occurred_at",
          "data"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "PartnerBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "hbpk_test_ / hbpk_live_",
        "description": "Cheie privată emisă de Habitoo. În exemple: hbpk_test_EXEMPLU_FICTIV, valoare ilustrativă nefuncțională."
      }
    }
  },
  "x-webhook-delivery": {
    "headers": [
      "X-Habitoo-Event",
      "X-Habitoo-Delivery",
      "X-Habitoo-Signature",
      "User-Agent"
    ],
    "signature": "t={timestamp},v1={HMAC-SHA256(hex_decode(secret), t + dot + raw_body)}",
    "timeout_seconds": 10,
    "response_read_max_bytes": 65536,
    "retry_seconds": [
      60,
      300,
      1800,
      7200,
      21600,
      43200
    ],
    "maximum_age_hours": 24,
    "order": "seq per portal et mediu",
    "user_agent": "Habitoo-Webhooks/1.0"
  },
  "x-response-notes": [
    "Headerele de limită apar după identificarea portalului; la eșecul verificării limitei cererea este permisă și jurnalizată.",
    "Sandbox poate întoarce {not_found:true} cu HTTP 200 când datele demo/portalul nu sunt disponibile.",
    "Lead live: 201 nou / 200 deduplicat; test adaugă test:true și label:Test.",
    "Anunțurile create suplimentar în sandbox devin tombstone după reset."
  ]
}
