
# Procurize.AI REST API Referansı

**API tokenınızı kullanarak bilgi tabanınıza – belgeler, anketler, RAG ve raporlar – programlı olarak erişin.**

> **Uygulama:** Procurize.AI API v1  
> **Kimlik Doğrulama:** `X-API-Key` başlığı üzerinden API anahtarı (token yönetimi için [API Tokenları](/api-tokens/) bölümüne bakın)  
> **Temel URL:** `https://api.procurize.com`

## Genel Bakış

Procurize.AI REST API, platformun temel özelliklerine programlı erişim sağlar. Procurize.AI'yi iç sistemlerinizle entegre etmenize, bilgi tabanı yönetimini otomatikleştirmenize ve özel iş akışları oluşturmanıza olanak tanır.

**Desteklenen modüller (token‑ile kimlik doğrulama):**

- [**RagArticle**](#ragarticle) – belgeleri yönetin
- [**RagFaq**](#ragfaq) – SSS girişlerini yönetin
- [**RagQuery**](#ragquery) – RAG sorgularını yürütün

## Kimlik Doğrulama

Tüm kimliği doğrulanmış uç noktalar, istek başlığında bir API tokenı gerektirir.

| Başlık | Değer |
|--------|-------|
| `X-API-Key` | `<YOUR_API_TOKEN>` |

**Örnek:**
```bash
curl -X GET "https://api.procurize.com/v1/..." \
  -H "X-API-Key: your-api-token-here"
```

> 💡 Tokenlar kuruluşunuza bağlıdır – istekte kuruluş kimliği belirtmenize gerek yoktur.

## Temel URL

Tüm REST API uç noktaları şu adreste sunulur:
```
https://api.procurize.com
```

## Hata İşleme

API, standart HTTP durum kodlarını kullanır.

| Kod | Anlam |
|------|---------|
| `200 OK` | İstek başarılı |
| `201 Created` | Kaynak başarıyla oluşturuldu |
| `204 No Content` | İstek başarılı, yanıt gövdesi yok |
| `400 Bad Request` | Geçersiz parametreler veya hatalı istek |
| `401 Unauthorized` | Eksik veya geçersiz API tokenı |
| `403 Forbidden` | Token bu eylem için izne sahip değil |
| `404 Not Found` | Kaynak bulunamadı |
| `500 Internal Server Error` | Beklenmeyen sunucu hatası |

Hata yanıtları, makine tarafından okunabilir bir hata kodu ve insan tarafından okunabilir bir mesaj içerir.

## Modül Referansı

### RagArticle

#### GET /questionnaire/rag/articles/summary

**Özet:** Anasayfa özeti

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| proj | query | string (uuid) | Hayır | Proje ID'si. |

**Yanıt (200):**
```json
{
  "active": 5
}
```

---

#### GET /questionnaire/rag/articles/total

**Özet:** Makale sayısı

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| q | query | string | Hayır | Makale adı veya koduna göre filtre. |
| state | query | array | Hayır | Durumlara göre filtre. |
| project | query | array | Hayır | Projelere göre filtre. |
| type | query | array | Hayır | Belge türlerine göre filtre. |

**Yanıt (200):**
```json
42
```

---

#### GET /questionnaire/rag/articles/list

**Özet:** Makalelerin listesini al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| q | query | string | Hayır | Makale adı veya koduna göre filtre. |
| state | query | array | Hayır | Durumlara göre filtre. |
| project | query | array | Hayır | Projelere göre filtre. |
| type | query | array | Hayır | Belge türlerine göre filtre. |
| s | query | string | Hayır | Sıralama alanı. |
| asc | query | boolean | Hayır | Artan sıralama. |
| ps | query | integer (int32) | Hayır | Sayfa boyutu. |
| p | query | integer (int32) | Hayır | 1‑tabanlı sayfa numarası. |

**Yanıt (200):**
```json
{
  "paging": {
    "pageNumber": 1,
    "pageSize": 10,
    "total": 42,
    "totalPages": 5
  },
  "items": [
    {
      "code": "ART-001",
      "org": "00000000-0000-0000-0000-000000000000",
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Article Title",
      "description": "Article description",
      "documentTypes": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "name": "Type Name",
          "plural": "Type Names",
          "count": 5
        }
      ],
      "size": 150,
      "revision": {
        "id": "00000000-0000-0000-0000-000000000000",
        "collectionId": "00000000-0000-0000-0000-000000000000",
        "rev": 3,
        "date": "2025-01-15T10:30:00Z",
        "author": {
          "id": "user123",
          "name": "John Doe",
          "email": "john.doe@example.com",
          "login": "johndoe",
          "ra": true
        },
        "authorName": "John Doe",
        "analysisSummary": {
          "id": "00000000-0000-0000-0000-000000000000",
          "initiator": {
            "id": "user123",
            "name": "John Doe",
            "email": "john.doe@example.com",
            "login": "johndoe",
            "ra": true
          },
          "created": "2025-01-15T10:30:00Z",
          "state": "Completed",
          "stateDate": "2025-01-15T10:35:00Z",
          "stateDetails": "Analysis completed successfully",
          "operationId": "op-12345"
        }
      },
      "type": "Article",
      "state": "Active",
      "projects": [
        "00000000-0000-0000-0000-000000000000"
      ],
      "items": [
        "00000000-0000-0000-0000-000000000000"
      ],
      "isShared": false
    }
  ]
}
```

---

#### POST /questionnaire/rag/file-to-md

**Özet:** Dosyadan Markdown içeriğini döndürür

**İstek Gövdesi (multipart/form-data):**
```json
{
  "url": "https://example.com/file.pdf",
  "file": "binary"
}
```

**Yanıt (200):**
```json
"Markdown content from file"
```

---

#### POST /questionnaire/rag/article/create

**Özet:** Makale oluştur

**İstek Gövdesi (multipart/form-data):**
```json
{
  "code": "ART-001",
  "name": "Article Title",
  "description": "Article description",
  "content": "# Article Content\n\nThis is the article content.",
  "url": "https://example.com/file.pdf",
  "file": "binary"
}
```

**Yanıt (200):**
```json
{
  "code": "ART-001",
  "org": "00000000-0000-0000-0000-000000000000",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "Article Title",
  "description": "Article description",
  "documentTypes": null,
  "size": 150,
  "revision": null,
  "type": "Article",
  "state": "Active",
  "projects": null,
  "items": null,
  "isShared": false
}
```

---

#### GET /questionnaire/rag/article/check

**Özet:** Makalenin varlığını kontrol eder.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

**Yanıt (200):**
```json
true
```

---

#### GET /questionnaire/rag/article-info

**Özet:** Koda göre makale bilgilerini al.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

**Yanıt (200):**
```json
{
  "code": "ART-001",
  "org": "00000000-0000-0000-0000-000000000000",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "Article Title",
  "description": "Article description",
  "documentTypes": null,
  "size": 150,
  "revision": null,
  "type": "Article",
  "state": "Active",
  "projects": null,
  "items": null,
  "isShared": false
}
```

---

#### GET /questionnaire/rag/article

**Özet:** Koda göre makale içeriğini al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |
| format | query | string | Hayır | `true` ise yanıt gövdesinde HTML içerik döner. Aksi takdirde Markdown formatında içerik döner. |
| split | query | boolean | Hayır | `true` ise içerik RAG öğeleriyle ayrılmış olarak döner. |
| css | query | boolean | Hayır | `true` ise HTML/PDF içeriği CSS ile birlikte döner. |

**Yanıt (200):**
```json
"# Article Title\n\nThis is the article content in Markdown format."
```

#### POST /questionnaire/rag/article

**Özet:** Makale meta verilerini güncelle

**İstek Gövdesi:**
```json
{
  "code": "ART-001",
  "name": "Updated Article Title",
  "description": "Updated description",
  "projects": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "documentTypes": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Type Name",
      "plural": "Type Names"
    }
  ],
  "isShared": true,
  "state": "Active"
}
```

**Yanıt (200):**
```json
{}
```

#### DELETE /questionnaire/rag/article

**Özet:** Makaleyi sil

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

---

#### GET /questionnaire/rag/article/pdf

**Özet:** Koda göre makaleyi PDF olarak al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

**Yanıt (200):**
```json
(pdf binary)
```

---

#### GET /questionnaire/rag/article/content

**Özet:** Makale içeriğini al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

**Yanıt (200):**
```json
{
  "content": "# Article Title\n\nContent here."
}
```

---

#### POST /questionnaire/rag/article/content

**Özet:** Makale içeriğini güncelle

**İstek Gövdesi (multipart/form-data):**
```json
{
  "code": "ART-001",
  "content": "# Updated Content",
  "file": "binary"
}
```

---

#### POST /questionnaire/rag/plural

**Özet:** İsim için çoğul formu al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| noun | query | string | Hayır | Çoğul yapılacak isim. |

**Yanıt (200):**
```json
{
  "plural": "Articles"
}
```

---

#### POST /questionnaire/rag/article/find-types

**Özet:** Makaleyi AI ile analiz et ve türlerini döndür

**İstek Gövdesi (multipart/form-data):**
```json
{
  "code": "ART-001",
  "content": "# Article Content"
}
```

**Yanıt (200):**
```json
[
  {
    "plural": "Types"
  }
]
```

---

#### POST /questionnaire/rag/article/format-with-ai

**Özet:** AI ile makale içeriğini biçimlendir

**İstek Gövdesi (multipart/form-data):**
```json
{
  "code": "ART-001",
  "content": "# Article Content"
}
```

**Yanıt (200):**
```json
{
  "formattedContent": "# Formatted Article Content"
}
```

---

#### POST /questionnaire/rag/article/improve-on-suggestions

**Özet:** Önerilere göre belgeyi iyileştir

**İstek Gövdesi (multipart/form-data):**
```json
{
  "suggestions": [
    {
      "sectionTitle": "Introduction",
      "suggestion": "Add more details here."
    }
  ],
  "code": "ART-001",
  "content": "# Article Content"
}
```

**Yanıt (200):**
```json
{
  "improvedContent": "# Improved Content"
}
```

---

#### GET /questionnaire/rag/article/parts

**Özet:** Makale bölümlerinin listesini döndürür

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | query | array | Evet | Makale bölümlerinin listesi. |

**Yanıt (200):**
```json
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "code": "part-1",
    "title": "Introduction",
    "orderNumber": 1,
    "content": "Introduction content."
  }
]
```

---

#### GET /questionnaire/rag/article/revisions

**Özet:** Makale revizyonlarının listesini döndürür

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |

**Yanıt (200):**
```json
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "collectionId": "00000000-0000-0000-0000-000000000000",
    "rev": 1,
    "date": "2025-01-15T10:30:00Z",
    "author": {
      "id": "user123",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "login": "johndoe",
      "ra": true
    },
    "authorName": "John Doe",
    "analysisSummary": {
      "id": "00000000-0000-0000-0000-000000000000",
      "initiator": {
        "id": "user123",
        "name": "John Doe",
        "email": "john.doe@example.com",
        "login": "johndoe",
        "ra": true
      },
      "created": "2025-01-15T10:30:00Z",
      "state": "Completed",
      "stateDate": "2025-01-15T10:35:00Z",
      "stateDetails": "Analysis completed",
      "operationId": "op-12345"
    }
  }
]
```

---

#### GET /questionnaire/rag/article/revisions/info/{id}

**Özet:** Makale revizyon bilgilerini al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | path | string (uuid) | Evet | Revizyon ID'si. |

**Yanıt (200):**
```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "collectionId": "00000000-0000-0000-0000-000000000000",
  "rev": 1,
  "date": "2025-01-15T10:30:00Z",
  "author": {
    "id": "user123",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "login": "johndoe",
    "ra": true
  },
  "authorName": "John Doe",
  "analysisSummary": {
    "id": "00000000-0000-0000-0000-000000000000",
    "initiator": {
      "id": "user123",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "login": "johndoe",
      "ra": true
    },
    "created": "2025-01-15T10:30:00Z",
    "state": "Completed",
    "stateDate": "2025-01-15T10:35:00Z",
    "stateDetails": "Analysis completed",
    "operationId": "op-12345"
  }
}
```

---

#### GET /questionnaire/rag/article/revisions/{id}

**Özet:** Makale revizyon içeriğini al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | path | string (uuid) | Evet | Revizyon ID'si. |

**Yanıt (200):**
```json
"# Article Revision Content\n\nPrevious version."
```

---

#### GET /questionnaire/rag/article/analyze

**Özet:** AI ile makale içeriğini analiz et

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Makalenin kodu. |
| rev | query | integer (int32) | Hayır | Revizyon numarası. |
| force | query | boolean | Hayır | Yeni analiz oluştur ve varsa eksik önceki analizi sil. |

**Yanıt (200):**
```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "initiator": {
    "id": "user123",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "login": "johndoe",
    "ra": true
  },
  "created": "2025-01-15T10:30:00Z",
  "state": "Completed",
  "stateDate": "2025-01-15T10:35:00Z",
  "stateDetails": "Analysis completed",
  "operationId": "op-12345"
}
```

---

#### GET /questionnaire/rag/article/analyze/{id}

**Özet:** Makale analiz sonucunu al

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | path | string (uuid) | Evet | Analiz ID'si. |

**Yanıt (200):**
```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "initiator": {
    "id": "user123",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "login": "johndoe",
    "ra": true
  },
  "created": "2025-01-15T10:30:00Z",
  "state": "Completed",
  "stateDate": "2025-01-15T10:35:00Z",
  "stateDetails": "Analysis completed",
  "operationId": "op-12345",
  "fragments": [
    "fragment-1",
    "fragment-2"
  ],
  "ownInconcies": "Own inconsistencies found",
  "ragInconcies": "RAG inconsistencies found",
  "proposals": "Improvement proposals"
}
```

---

#### GET /questionnaire/rag/messages/list

**Özet:** Tüm mesajları listele

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | query | string (uuid) | Evet | RAG Koleksiyon ID'si. |
| item | query | string (uuid) | Hayır | RAG Öğe ID'si. |
| message | query | string (uuid) | Hayır | Mesaj ID'si. |
| asc | query | boolean | Hayır | Artan sıralama. |
| ps | query | integer (int32) | Hayır | Sayfa boyutu. |
| p | query | integer (int32) | Hayır | 1‑tabanlı sayfa numarası. |

**Yanıt (200):**
```json
{
  "paging": {
    "pageNumber": 1,
    "pageSize": 10,
    "total": 5,
    "totalPages": 1
  },
  "items": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "replyTo": null,
      "questionnaire": null,
      "section": null,
      "question": null,
      "ragCollection": "00000000-0000-0000-0000-000000000000",
      "ragItem": "00000000-0000-0000-0000-000000000000",
      "targetId": "00000000-0000-0000-0000-000000000000",
      "targetType": "Question",
      "targetNum": 1,
      "author": {
        "id": "user123",
        "name": "John Doe",
        "email": "john.doe@example.com",
        "login": "johndoe",
        "ra": true
      },
      "text": "Message content",
      "created": "2025-01-15T10:30:00Z",
      "updated": "2025-01-15T10:30:00Z",
      "replies": 0
    }
  ]
}
```

---

#### POST /questionnaire/rag/messages/add

**Özet:** Yeni mesaj ekle

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | query | string (uuid) | Evet | RAG Koleksiyon ID'si. |
| item | query | string (uuid) | Hayır | RAG Öğe ID'si. |
| message | query | string (uuid) | Hayır | Yanıtlanacak mesaj ID'si. |

**İstek Gövdesi:**
```json
{
  "text": "New message content"
}
```

**Yanıt (200):**
```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "replyTo": null,
  "questionnaire": null,
  "section": null,
  "question": null,
  "ragCollection": "00000000-0000-0000-0000-000000000000",
  "ragItem": "00000000-0000-0000-0000-000000000000",
  "targetId": "00000000-0000-0000-0000-000000000000",
  "targetType": "Question",
  "targetNum": 1,
  "author": {
    "id": "user123",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "login": "johndoe",
    "ra": true
  },
  "text": "New message content",
  "created": "2025-01-15T10:30:00Z",
  "updated": "2025-01-15T10:30:00Z",
  "replies": 0
}
```

---

#### POST /questionnaire/rag/message

**Özet:** Mevcut mesajı güncelle

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| c | query | string (uuid) | Evet | RAG Koleksiyon ID'si. |
| id | query | string (uuid) | Evet | Mesaj ID'si. |

**İstek Gövdesi:**
```json
{
  "text": "Updated message content"
}
```

**Yanıt (200):**
```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "replyTo": null,
  "questionnaire": null,
  "section": null,
  "question": null,
  "ragCollection": "00000000-0000-0000-0000-000000000000",
  "ragItem": "00000000-0000-0000-0000-000000000000",
  "targetId": "00000000-0000-0000-0000-000000000000",
  "targetType": "Question",
  "targetNum": 1,
  "author": {
    "id": "user123",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "login": "johndoe",
    "ra": true
  },
  "text": "Updated message content",
  "created": "2025-01-15T10:30:00Z",
  "updated": "2025-01-15T10:45:00Z",
  "replies": 0
}
```

#### DELETE /questionnaire/rag/message

**Özet:** Mevcut mesajı sil

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| id | query | string (uuid) | Evet | Mesaj ID'si. |

**Yanıt (200):**
```json
{}
```

### RagFaq

#### GET /questionnaire/rag/faq-collections/summary

**Özet:** Anasayfa özeti

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| proj | query | string (uuid) | Hayır | Proje ID'si. |

**Yanıt (200):**
```json
{
  "active": 3
}
```

---

#### GET /questionnaire/rag/faq-collections/total

**Özet:** SSS koleksiyon sayısı.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| q | query | string | Hayır | Koleksiyon adı veya koduna göre filtre. |
| state | query | array | Hayır | Durumlara göre filtre. |
| project | query | array | Hayır | Projelere göre filtre. |

**Yanıt (200):**
```json
3
```

---

#### GET /questionnaire/rag/faq-collections/list

**Özet:** SSS koleksiyonlarının listesini al.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| q | query | string | Hayır | Koleksiyon adı veya koduna göre filtre. |
| state | query | array | Hayır | Durumlara göre filtre. |
| project | query | array | Hayır | Projelere göre filtre. |
| s | query | string | Hayır | Sıralama alanı. |
| asc | query | boolean | Hayır | Artan sıralama. |
| ps | query | integer (int32) | Hayır | Sayfa boyutu. |
| p | query | integer (int32) | Hayır | 1‑tabanlı sayfa numarası. |

**Yanıt (200):**
```json
{
  "paging": {
    "pageNumber": 1,
    "pageSize": 10,
    "total": 3,
    "totalPages": 1
  },
  "items": [
    {
      "code": "FAQ-001",
      "org": "00000000-0000-0000-0000-000000000000",
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "FAQ Collection",
      "description": "FAQ collection description",
      "documentTypes": null,
      "size": 5,
      "revision": null,
      "type": "Faq",
      "state": "Active",
      "projects": null,
      "items": null,
      "isShared": false
    }
  ]
}
```

---

#### GET /questionnaire/rag/faq-collections/find-items

**Özet:** SSS öğelerini bul.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| q | query | string | Evet | Soruya göre filtre. |
| project | query | string (uuid) | Hayır | Projeye göre filtre. |
| ps | query | integer (int32) | Hayır | Sayfa boyutu. |
| p | query | integer (int32) | Hayır | 1‑tabanlı sayfa numarası. |

**Yanıt (200):**
```json
{
  "paging": {
    "pageNumber": 1,
    "pageSize": 10,
    "total": 5,
    "totalPages": 1
  },
  "items": [
    {
      "index": 0,
      "question": "What is this product?",
      "answer": "This is a great product.",
      "comment": "Product FAQ",
      "state": "Active"
    }
  ]
}
```

---

#### POST /questionnaire/rag/faq-collection/create

**Özet:** Yeni SSS koleksiyonu oluştur.

**İstek Gövdesi (multipart/form-data):**
```json
{
  "code": "FAQ-001",
  "name": "FAQ Collection",
  "description": "FAQ collection description",
  "content": "Content here",
  "file": "binary"
}
```

**Yanıt (200):**
```json
{
  "code": "FAQ-001",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "FAQ Collection",
  "description": "FAQ collection description",
  "documentTypes": null,
  "size": 5,
  "revision": null,
  "type": "Faq",
  "state": "Active",
  "projects": null,
  "items": null,
  "isShared": false
}
```

---

#### POST /questionnaire/rag/faq-collection

**Özet:** SSS koleksiyonu meta verilerini güncelle.

**İstek Gövdesi:**
```json
{
  "code": "FAQ-001",
  "name": "Updated FAQ Collection",
  "description": "Updated description",
  "projects": null,
  "documentTypes": null,
  "isShared": false,
  "state": "Active"
}
```

#### DELETE /questionnaire/rag/faq-collection

**Özet:** SSS koleksiyonunu sil.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |

#### GET /questionnaire/rag/faq-collection

**Özet:** SSS koleksiyonunu al.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |

**Yanıt (200):**
```json
{
  "code": "FAQ-001",
  "org": "00000000-0000-0000-0000-000000000000",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "FAQ Collection",
  "description": "FAQ collection description",
  "documentTypes": null,
  "size": 5,
  "revision": null,
  "type": "Faq",
  "state": "Active",
  "projects": null,
  "items": null,
  "isShared": false
}
```

---

#### GET /questionnaire/rag/faq-collection/check

**Özet:** SSS koleksiyonunun varlığını kontrol et.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |

**Yanıt (200):**
```json
true
```

---

#### GET /questionnaire/rag/faq-collection/items-total

**Özet:** SSS öğelerinin sayısı.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |
| q | query | string | Hayır | SSS öğesi içeriğine göre filtre. |

**İstek Gövdesi:**
```json
["Active", "Default"]
```

**Yanıt (200):**
```json
5
```

---

#### GET /questionnaire/rag/faq-collection/items

**Özet:** SSS öğelerinin listesini al.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |
| q | query | string | Hayır | SSS öğesi içeriğine göre filtre. |
| state | query | array | Hayır | Durumlara göre filtre. |
| s | query | string | Hayır | Sıralama alanı. |
| asc | query | boolean | Hayır | Artan sıralama. |
| ps | query | integer (int32) | Hayır | Sayfa boyutu. |
| p | query | integer (int32) | Hayır | 1‑tabanlı sayfa numarası. |

**Yanıt (200):**
```json
{
  "paging": {
    "pageNumber": 1,
    "pageSize": 10,
    "total": 5,
    "totalPages": 1
  },
  "items": [
    {
      "index": 0,
      "question": "What is this product?",
      "answer": "This is a great product.",
      "comment": "Product FAQ",
      "state": "Active"
    }
  ]
}
```

---

#### POST /questionnaire/rag/faq-collection/item/create

**Özet:** Yeni SSS öğesi oluştur.

**İstek Gövdesi:**
```json
{
  "code": "FAQ-001",
  "index": 0,
  "question": "What is this product?",
  "answer": "This is a great product.",
  "comment": "Product FAQ",
  "state": "Active"
}
```

**Yanıt (200):**
```json
{
  "index": 0,
  "question": "What is this product?",
  "answer": "This is a great product.",
  "comment": "Product FAQ",
  "state": "Active"
}
```

---

#### GET /questionnaire/rag/faq-collection/item

**Özet:** SSS öğesini al.

**Parametreler:**
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |
| index | query | integer (int32) | Evet | Koleksiyondaki SSS öğesinin sıfır‑tabanlı indeksi. |

**Yanıt (200):**
```json
{
  "index": 0,
  "question": "What is this product?",
  "answer": "This is a great product.",
  "comment": "Product FAQ",
  "state": "Active"
}
```

#### POST /questionnaire/rag/faq-collection/item

**Özet:** SSS öğesini güncelle.

**İstek Gövdesi:**
```json
{
  "code": "FAQ-001",
  "index": 0,
  "newIndex": 1,
  "question": "Updated question?",
  "answer": "Updated answer.",
  "comment": "Updated comment",
  "state": "Active"
}
```

#### DELETE /questionnaire/rag/faq-collection/item

**Özet:** SSS öğesini sil.

**Parametreler::
| Ad | Yer | Tür | Gerekli | Açıklama |
|------|-----|------|----------|-------------|
| code | query | string | Evet | Koleksiyon kodu. |
| index | query | integer (int32) | Evet | Koleksiyondaki SSS öğesinin sıfır‑tabanlı indeksi. |

### RagQuery

#### POST /questionnaire/rag/query

**Özet:** RAG Bilgi Tabanında sorgu yap

**İstek Gövdesi:**
```json
{
  "project": "00000000-0000-0000-0000-000000000000",
  "excludeCollections": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "question": "What is this product?",
  "yourCompanyName": "Acme Corp",
  "yourCompanyAlias": "Acme",
  "customerName": "John Doe",
  "options": [
    "option1",
    "option2"
  ],
  "multiselect": false,
  "nArticles": 5,
  "nFaqs": 3,
  "threshold": 0.5,
  "debug": false,
  "withJustification": true,
  "withConfidenceLevel": true,
  "withFragments": true,
  "nAttempts": 3
}
```

**Yanıt (200):**
```json
{
  "attempt": 1,
  "preparedQuery": {
    "original": "What is this product?",
    "enhanced": "What is this product and its features?"
  },
  "ragItems": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "distance": 0.25
    }
  ],
  "question": "What is this product?",
  "generalInstructions": "Based on the knowledge base, here is the answer:",
  "text": "This product is a great solution for your needs.",
  "explanation": "The answer was found in multiple sources with high confidence."
}
```

---

#### POST /questionnaire/rag/query-stream

**Özet:** RAG Bilgi Tabanında akışlı sorgu yap

**İstek Gövdesi:** *(aynı içerik)*

```json
{
  "project": "00000000-0000-0000-0000-000000000000",
  "excludeCollections": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "question": "What is this product?",
  "yourCompanyName": "Acme Corp",
  "yourCompanyAlias": "Acme",
  "customerName": "John Doe",
  "options": [
    "option1",
    "option2"
  ],
  "multiselect": false,
  "nArticles": 5,
  "nFaqs": 3,
  "threshold": 0.5,
  "debug": false,
  "withJustification": true,
  "withConfidenceLevel": true,
  "withFragments": true,
  "nAttempts": 3
}
```

**Yanıt (200):**
```json
[
  {
    "text": "This product is a great solution",
    "fragments": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "part": 1,
        "distance": 0.25,
        "type": "Article",
        "code": "ART-001",
        "title": "Product Title",
        "fragment": "Product content fragment"
      }
    ]
  },
  {
    "text": " for your needs.",
    "fragments": []
  }
]
```

---

#### POST /questionnaire/rag/query-fragments

**Özet:** RAG Bilgi Tabanında parçalarla sorgu yap

**İstek Gövdesi:**
```json
{
  "project": "00000000-0000-0000-0000-000000000000",
  "exclude_documents": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "query": "What is this product?",
  "top_k": 5,
  "similarity_threshold": 0.5,
  "prepare_query": true
}
```

**Yanıt (200):**
```json
{
  "results": [
    {
      "document_id": "00000000-0000-0000-0000-000000000000",
      "document_code": "ART-001",
      "document_title": "Product Title",
      "revision": 3,
      "chunk_index": 0,
      "content": "Product content fragment",
      "metadata": {
        "author": "John Doe",
        "created_at": "2025-01-15T10:30:00Z",
        "last_updated_at": "2025-01-15T10:35:00Z",
        "doc_categories": [
          "Product",
          "Information"
        ]
      },
      "similarity_score": 0.85
    }
  ]
}
```

## İlgili Makaleler

- [API Tokenları – Oluşturma & Yönetim](/api-tokens/) – tokenları nasıl oluşturup yöneteceğinizi öğrenin  
- [Bilgi Tabanınızla AI’ya Soru Sorun](/ask-ai-with-your-knowledge-base/) – RAG sorgularını kullanma  

---