> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanova.io/llms.txt
> Use this file to discover all available pages before exploring further.

# معاينة أثر خفض مستوى الخطة

> GET /plans/downgrade-impact/

يعاين الموارد التي ستعيق خفض مستوى الخطة قبل الالتزام بالدفع، على مضيف **Management API** (‏`api.scanova.io`)، مصادَقًا عليه بمفتاح Management API الخام الخاص بك.

```
GET https://api.scanova.io/plans/downgrade-impact/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField query="target_plan" type="string" required>
  slug الخطة المستهدفة (من حقل `slug` في [سرد الخطط المتاحة](/ar/api-reference/management-api/plans/available)).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.scanova.io/plans/downgrade-impact/?target_plan=starter-scanova-io" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "violations": [
      {
        "codename": "TOTAL_QR_CODES",
        "quota_name": "Total QR Codes",
        "exceed_value": 12,
        "resolvable": true,
        "total_affected_count": 112,
        "affected_resources": ["Q07afe81aa0034c01", "Q19bd72cc1145d02"]
      }
    ],
    "current_plan_expiry": "2027-08-16",
    "days_remaining": 365
  }
  ```
</ResponseExample>

تعني مصفوفة `violations` الفارغة أن خفض المستوى نظيف حاليًا — لا شيء يحتاج إلى تغيير مسبقًا. هذا الطرف للقراءة فقط تمامًا ولا يغيّر شيئًا؛ يعيد استخدام نفس محرك القواعد الذي يطبّقه الدفع الفعلي تمامًا، لذا لا يمكن أن يتعارض مع ما سيحدث فعليًا عند المضي في خفض المستوى.

### حقول الاستجابة

<ResponseField name="violations" type="array">
  إدخال واحد لكل حصة لا يمكن للخطة المستهدفة استيعابها بالنظر إلى الاستخدام الحالي للحساب.

  <Expandable title="خصائص violation">
    <ResponseField name="codename" type="string">المعرّف الثابت للحصة (مثل `TOTAL_QR_CODES`، `SHARED_USERS`).</ResponseField>
    <ResponseField name="quota_name" type="string">اسم الحصة القابل للقراءة البشرية.</ResponseField>
    <ResponseField name="exceed_value" type="integer">مقدار تجاوز الحساب حاليًا لحد الخطة المستهدفة.</ResponseField>
    <ResponseField name="resolvable" type="boolean">ما إذا كان بإمكان الحساب حل هذا بنفسه (مثل حذف/تعطيل بعض الموارد) قبل خفض المستوى.</ResponseField>
    <ResponseField name="total_affected_count" type="integer">العدد الإجمالي للموارد المحسوبة ضمن هذه الحصة.</ResponseField>
    <ResponseField name="affected_resources" type="array">معرّفات الموارد المحدَّدة المحسوبة (مثل قيم `qrid` لرموز QR) — قد تكون عيّنة مُختصرة عند الأعداد المرتفعة.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="current_plan_expiry" type="string">
  تاريخ انتهاء الخطة الحالية، أو `null` لخطة بلا تاريخ انتهاء.
</ResponseField>

<ResponseField name="days_remaining" type="integer | null">
  الأيام المتبقية حتى `current_plan_expiry`، أو `null` إذا لم يكن للخطة تاريخ انتهاء.
</ResponseField>

يعيد الرد `400` إذا كانت `target_plan` مفقودة.

## طرق ذات صلة

* [سرد الخطط المتاحة](/ar/api-reference/management-api/plans/available) — العثور على `slug` لمعاينة خفض المستوى إليه.
* [الخطة الحالية](/ar/api-reference/management-api/plans/current) — الخطة الحالية للحساب ومنح الحصص الخاصة به.
* [نظرة عامة على Management API](/ar/api-reference/management-api/overview) — مخطط المصادقة وقواعد الحصة المطبّقة على هذا الطرف.


## OpenAPI

````yaml api-reference/openapi/management-api.json GET /plans/downgrade-impact/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /plans/downgrade-impact/:
    get:
      summary: Preview a plan downgrade's impact
      description: >-
        Read-only preview of which specific resources (e.g. QR codes over a new
        lower limit, shared users beyond a new seat count) would block a
        downgrade to `target_plan`, before committing to checkout. Reuses the
        exact same violation-detection logic real checkout enforces, so this
        preview can never disagree with what actually happens at order creation.
      operationId: getManagedDowngradeImpact
      parameters:
        - name: target_plan
          in: query
          required: true
          schema:
            type: string
          description: The target plan's slug.
      responses:
        '200':
          description: >-
            Violations that would block the downgrade (empty array if none),
            plus the current plan's remaining time.
          content:
            application/json:
              example:
                violations:
                  - codename: TOTAL_QR_CODES
                    quota_name: Total QR Codes
                    exceed_value: 12
                    resolvable: true
                    total_affected_count: 112
                    affected_resources:
                      - Q07afe81aa0034c01
                      - Q19bd72cc1145d02
                current_plan_expiry: '2027-08-16'
                days_remaining: 365
        '400':
          description: Missing `target_plan` query parameter.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````