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

# دليل دمج واجهة برمجة التطبيقات WebExtrator للاستخراج الذكي

> WebExtrator Web Render & Extract API guide - Ace Data Cloud

`POST https://api.acedata.cloud/webextrator/extract`

يقوم بالاستخراج بناءً على `/webextrator/render`. بالإضافة إلى جميع معلمات واجهة render، يدعم أيضًا:

| الحقل           | النوع   | إلزامي | الافتراضي  | الوصف                                                                        |
| --------------- | ------- | :----: | ---------- | ---------------------------------------------------------------------------- |
| `expected_type` | string  |    ❌   | `markdown` | نوع الناتج المتوقع: `markdown` / `article` / `text` / `links` / `structured` |
| `enable_llm`    | boolean |    ❌   | false      | تفعيل المعالجة اللاحقة باستخدام LLM (مناسب لـ `article` / `structured`)      |
| `instruction`   | string  |    ❌   | -          | تعليمات استخراج LLM، مثل "استخراج عنوان المنتج، السعر، المواصفات"            |

## الاستجابة المتزامنة

```json theme={null}
{
  "success": true,
  "task_id": "550e8400-...",
  "trace_id": "550e8400-...",
  "started_at": "2026-05-02T10:30:00.123Z",
  "finished_at": "2026-05-02T10:30:08.789Z",
  "elapsed": 8.666,
  "data": {
    "kind": "extract",
    "expected_type": "article",
    "url": "https://example.com/post/1",
    "title": "مثال على مقال",
    "author": "تشانغ سان",
    "published_at": "2026-05-01",
    "content": "# مثال على مقال\n\nالنص ...",
    "summary": "هذا المقال يشرح ..."
  }
}
```

وضع عدم التزامن، رموز الخطأ، وقواعد الفوترة مماثلة تمامًا لـ `/webextrator/render`.

## مثال: استخراج نص المقال (تفعيل LLM)

```bash theme={null}
curl -X POST https://api.acedata.cloud/webextrator/extract \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/news/1",
    "expected_type": "article",
    "enable_llm": true
  }'
```

## مثال: استخراج مهيكل مخصص + غير متزامن

```bash theme={null}
curl -X POST https://api.acedata.cloud/webextrator/extract \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/item/123",
    "expected_type": "structured",
    "enable_llm": true,
    "instruction": "استخراج عنوان المنتج، السعر، المخزون، 3 روابط للصور الرئيسية",
    "callback_url": "https://your-domain.com/wbx-callback"
  }'
```
