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

# قائمة الشركاء

> تحقّق من مُصدِري الفواتير المتاحين حاليًا

<div dir="ltr">
  ## نظرة عامة

  يُرجع حالة توفّر كل مُصدِر فواتير مدعوم. استدعِه قبل الاستكشاف كي تتمكن من إخفاء أي شريك غير متاح عن عملائك بدلًا من تركهم يصطدمون بـ `503` في نهاية النموذج.

  الاستجابة عبارة عن خريطة مفاتيحها هي قيمة `partner` نفسها بالضبط التي ترسلها إلى [استكشاف الفواتير](/ar/api-reference/bill-payment/discover-bills) — بما في ذلك علامات النبر في `Algérie Télécom`.

  <Note>
    يرى مفتاح `PRODUCTION` حالة التوفّر الحيّة. أما مفتاح `SANDBOX` فيرى خريطة ثابتة، لأن طلب sandbox لا يصل إلى شريك أبدًا ولأن حالة التوفّر الحيّة ستكون مضلِّلة هناك.
  </Note>

  ## الاستجابة

  <ResponseField name="success" type="boolean" required>
    `true` عند إرجاع الخريطة.
  </ResponseField>

  <ResponseField name="data" type="object" required>
    مُدخَل واحد لكل شريك. مجموعة المفاتيح ثابتة.

    <Expandable title="properties">
      <ResponseField name="ADE" type="object">
        Algérienne Des Eaux — المياه.
      </ResponseField>

      <ResponseField name="SONELGAZ" type="object">
        الكهرباء والغاز.
      </ResponseField>

      <ResponseField name="SEAAL" type="object">
        مياه الجزائر العاصمة وتيبازة.
      </ResponseField>

      <ResponseField name="AADL" type="object">
        أقساط السكن.
      </ResponseField>

      <ResponseField name="Algérie Télécom" type="object">
        الهاتف الثابت والإنترنت.
      </ResponseField>
    </Expandable>
  </ResponseField>

  لكل مُدخَل حقل واحد:

  <ResponseField name="status" type="string" required>
    `ACTIVE` — الاستكشاف والدفع مقبولان.

    `UNAVAILABLE` — الاستكشاف والدفع لهذا الشريك يُجيبان بـ `503 PARTNER_UNAVAILABLE`.
  </ResponseField>

  <ResponseField name="meta" type="object" required>
    <Expandable title="properties">
      <ResponseField name="timestamp" type="string" required>
        وقت الاستجابة، بتنسيق ISO 8601 UTC.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="requestId" type="string" required>
    معرّف الربط، يُرسَل أيضًا في ترويسة الاستجابة `X-Request-Id`.
  </ResponseField>

  ## الأمثلة

  <CodeGroup>
    ```bash cURL theme={null}
    curl https://billapi.oneclickdz.com/v3/partners \
      -H "X-Access-Token: YOUR_API_KEY"
    ```

    ```javascript Node.js theme={null}
    const response = await fetch("https://billapi.oneclickdz.com/v3/partners", {
      headers: { "X-Access-Token": process.env.ONECLICKDZ_API_KEY },
    });

    const body = await response.json();

    if (!body.success) {
      throw new Error(`${body.error.code}: ${body.error.message}`);
    }

    const available = Object.entries(body.data)
      .filter(([, partner]) => partner.status === "ACTIVE")
      .map(([name]) => name);

    console.log(available);
    ```

    ```python Python theme={null}
    import os
    import requests

    response = requests.get(
        'https://billapi.oneclickdz.com/v3/partners',
        headers={'X-Access-Token': os.getenv('ONECLICKDZ_API_KEY')}
    )

    body = response.json()

    if not body['success']:
        raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")

    available = [
        name for name, partner in body['data'].items()
        if partner['status'] == 'ACTIVE'
    ]

    print(available)
    ```

    ```php PHP theme={null}
    <?php
    $ch = curl_init('https://billapi.oneclickdz.com/v3/partners');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'X-Access-Token: ' . getenv('ONECLICKDZ_API_KEY')
    ]);

    $body = json_decode(curl_exec($ch), true);
    curl_close($ch);

    if (!$body['success']) {
        throw new Exception($body['error']['code'] . ': ' . $body['error']['message']);
    }

    $available = array_keys(array_filter(
        $body['data'],
        fn($partner) => $partner['status'] === 'ACTIVE'
    ));

    print_r($available);
    ?>
    ```
  </CodeGroup>

  ### استجابة النجاح

  ```json theme={null}
  {
    "success": true,
    "data": {
      "ADE": { "status": "ACTIVE" },
      "SONELGAZ": { "status": "ACTIVE" },
      "SEAAL": { "status": "UNAVAILABLE" },
      "AADL": { "status": "UNAVAILABLE" },
      "Algérie Télécom": { "status": "ACTIVE" }
    },
    "meta": {
      "timestamp": "2026-08-31T10:15:32.194Z"
    },
    "requestId": "req_9f3a1c72e0b84d51aB3xZq07"
  }
  ```

  ## استجابات الخطأ

  <AccordionGroup>
    <Accordion title="401 — رمز وصول مفقود">
      **لم تُرسَل ترويسة `X-Access-Token`.**

      ```json theme={null}
      {
        "success": false,
        "error": {
          "code": "MISSING_ACCESS_TOKEN",
          "message": "X-Access-Token header is required."
        },
        "requestId": "req_9f3a1c72e0b84d51aB3xZq07"
      }
      ```

      **ما العمل:** أضف الترويسة وأعد المحاولة.
    </Accordion>

    <Accordion title="401 — رمز وصول غير صالح">
      **رُفض المفتاح.**

      ```json theme={null}
      {
        "success": false,
        "error": {
          "code": "INVALID_ACCESS_TOKEN",
          "message": "The provided access token is invalid."
        },
        "requestId": "req_9f3a1c72e0b84d51aB3xZq07"
      }
      ```

      **ما العمل:** تحقّق من المفتاح باستخدام [التحقق من مفتاح API](/ar/api-reference/bill-payment/validate-key).
    </Accordion>

    <Accordion title="503 — المصادقة غير متاحة">
      **لم نتمكن من التحقق من مفتاحك في الوقت المناسب.**

      ```json theme={null}
      {
        "success": false,
        "error": {
          "code": "AUTH_UNAVAILABLE",
          "message": "Authentication is temporarily unavailable. Please retry shortly."
        },
        "requestId": "req_9f3a1c72e0b84d51aB3xZq07"
      }
      ```

      **ما العمل:** أعد المحاولة بعد المدة المحددة في ترويسة `Retry-After`. وقدّم آخر خريطة مخزّنة مؤقتًا في هذه الأثناء.
    </Accordion>

    <Accordion title="503 — الخدمة غير متاحة">
      **واجهة دفع الفواتير في صيانة مُخطّط لها.**

      ```json theme={null}
      {
        "success": false,
        "error": {
          "code": "SERVICE_UNAVAILABLE",
          "message": "The service is temporarily unavailable. Please retry shortly."
        },
        "requestId": "req_9f3a1c72e0b84d51aB3xZq07"
      }
      ```

      **ما العمل:** التزم بـ `Retry-After` وأعد المحاولة.
    </Accordion>
  </AccordionGroup>

  ## حالة التوفّر الحالية

  `SEAAL` و`AADL` حاليًا `UNAVAILABLE` في كل من sandbox والإنتاج، والاستكشاف أو الدفع لهما يُجيب بـ `503 PARTNER_UNAVAILABLE`. هذا هو الإعداد الحالي للمشغّل، لا قيد دائم — أبقِ الشريكين كليهما في شفرتك ودع هذا endpoint يقرر ما يُعرض.

  <Warning>
    لا تكتب حالة توفّر أي شريك بشكل ثابت في الشفرة. اقرأ هذه الخريطة، وتعامل مع `503 PARTNER_UNAVAILABLE` عند الاستكشاف على أنه شريك أصبح غير متاح بين آخر تحديث لديك وبين الطلب.
  </Warning>

  ## تخزين الخريطة مؤقتًا

  نادرًا ما تتغير حالة التوفّر. حدّثها وفق مؤقّت بدلًا من تحديثها قبل كل استكشاف، واستمر في تقديم آخر نسخة سليمة عندما يفشل التحديث.

  ```javascript theme={null}
  let cache = { map: null, fetchedAt: 0 };
  const TTL_MS = 5 * 60 * 1000;

  async function getPartners() {
    if (cache.map && Date.now() - cache.fetchedAt < TTL_MS) {
      return cache.map;
    }

    try {
      const response = await fetch("https://billapi.oneclickdz.com/v3/partners", {
        headers: { "X-Access-Token": process.env.ONECLICKDZ_API_KEY },
      });

      const body = await response.json();

      if (body.success) {
        cache = { map: body.data, fetchedAt: Date.now() };
      }
    } catch (error) {
      // Keep serving the previous map rather than blocking the customer.
    }

    return cache.map ?? {};
  }

  async function isAvailable(partner) {
    const map = await getPartners();
    return map[partner]?.status === "ACTIVE";
  }
  ```

  ## أفضل الممارسات

  <CardGroup cols={2}>
    <Card title="خزّن مؤقتًا لبضع دقائق" icon="database">
      تخزين مؤقت لمدة 5 دقائق يكفي. استدعاء هذا قبل كل استكشاف يضيف رحلة ذهاب وإياب دون أي فائدة.
    </Card>

    <Card title="أخفِق بلطف عند التحديث" icon="shield-halved">
      إذا فشل التحديث، فاحتفظ بالخريطة السابقة. قائمة شركاء فارغة أسوأ من قائمة قديمة قليلًا.
    </Card>

    <Card title="استخدم قيمة الشريك بالضبط" icon="quote-left">
      أرسل `Algérie Télécom` بعلامات النبر الخاصة بها. القيمة هي مفتاح هذه الخريطة، حرفًا بحرف.
    </Card>

    <Card title="عالج حالة التسابق" icon="triangle-exclamation">
      يمكن أن يصبح شريك غير متاح بعد أن خزّنته مؤقتًا. عالج `503 PARTNER_UNAVAILABLE` عند الاستكشاف أيضًا.
    </Card>
  </CardGroup>

  ## Endpoints ذات الصلة

  <CardGroup cols={2}>
    <Card title="التحقق من مفتاح API" icon="key" href="/ar/api-reference/bill-payment/validate-key">
      تأكّد من مفتاحك ومن بيئتك
    </Card>

    <Card title="استكشاف الفواتير" icon="magnifying-glass-dollar" href="/ar/api-reference/bill-payment/discover-bills">
      استعلم عمّا يترتب على حساب ما
    </Card>

    <Card title="الشركاء والحسابات" icon="address-card" href="/ar/bill-payment-guides/1-partners-and-accounts">
      المعرّفات الخاصة بكل شريك
    </Card>

    <Card title="نظرة عامة على دفع الفواتير" icon="file-invoice-dollar" href="/ar/bill-payment-guides/overview">
      كيف يتكامل التدفق بأكمله
    </Card>
  </CardGroup>
</div>
