> For the complete documentation index, see [llms.txt](https://developer.konukcrm.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.konukcrm.com/api-referansi/hata-kodlari.md).

# Hata Kodları

Tüm hatalar ortak zarfla döner. Dallanmayı **HTTP durum kodu** üzerinden yapın.

## HTTP durumları

| Kod   | Anlamı                                     | Tekrar denenir mi?           | Yapılacak                                        |
| ----- | ------------------------------------------ | ---------------------------- | ------------------------------------------------ |
| `200` | Başarılı                                   | —                            | —                                                |
| `201` | Oluşturuldu                                | —                            | `data.id`'yi saklayın                            |
| `204` | İçerik yok (silme / başarılı no-op)        | —                            | —                                                |
| `400` | Hatalı istek — gövde ayrıştırılamadı       | **Hayır**                    | İstek formatını düzeltin                         |
| `401` | Kimlik doğrulanmadı / token süresi doldu   | Yenileme sonrası **bir kez** | Kimlik Doğrulama sayfasına bakın                 |
| `403` | İzin yok                                   | **Hayır**                    | Rol izinlerini kontrol edin                      |
| `404` | Kaynak yok veya bu tenant'a ait değil      | **Hayır**                    | Kimliği doğrulayın                               |
| `409` | Çakışma — eşzamanlı güncelleme, çift kayıt | Yeniden okuyup **evet**      | Son durumu çekip birleştirin                     |
| `422` | Doğrulama hatası                           | **Hayır**                    | `errors` dizisini işleyin                        |
| `429` | Hız limiti                                 | **Evet**                     | `Retry-After` + jitter                           |
| `500` | Sunucu hatası                              | **Evet**                     | Üstel geri çekilme; sürerse `traceId` ile destek |
| `503` | Geçici olarak kullanılamıyor (bakım)       | **Evet**                     | Geri çekilerek deneyin                           |

## Alan hata kodları (`errors[].code`)

| Kod                    | Anlamı                                      |
| ---------------------- | ------------------------------------------- |
| `required`             | Zorunlu alan eksik                          |
| `invalid_format`       | Biçim hatalı (e-posta, telefon, tarih)      |
| `out_of_range`         | Sayısal değer izinli aralık dışında         |
| `date_range`           | Bitiş tarihi başlangıçtan önce veya eşit    |
| `not_found`            | Referans verilen kayıt yok                  |
| `duplicate`            | Benzersizlik ihlali (aynı kod/e-posta)      |
| `occupancy_violation`  | Oda tipinin kişi sayısı sınırları aşıldı    |
| `no_availability`      | Seçilen tarihlerde müsait oda yok           |
| `no_season_defined`    | Tarih aralığı için sezon/fiyat tanımı yok   |
| `integration_disabled` | İlgili entegrasyon bu tenant'ta etkin değil |
| `quota_exceeded`       | Depolama veya kullanım kotası aşıldı        |

## Alan hatalarını işleme

```typescript
if (res.status === 422) {
  const { errors } = await res.json();
  for (const e of errors ?? []) {
    form.setFieldError(e.field, e.message);   // message zaten Türkçe ve kullanıcıya uygundur
  }
}
```

## Tekrar deneme stratejisi

```typescript
async function withRetry<T>(fn: () => Promise<T>, max = 4): Promise<T> {
  for (let attempt = 0; ; attempt++) {
    try {
      return await fn();
    } catch (err) {
      const status = err.status;
      const retryable = status === 429 || status >= 500;
      if (!retryable || attempt >= max) throw err;

      const base = err.retryAfter ?? Math.min(2 ** attempt, 30);
      const jitter = Math.random() * base * 0.3;   // eşzamanlı istemcilerin çakışmasını önler
      await sleep((base + jitter) * 1000);
    }
  }
}
```

## Destek talebi

Her destek kaydında şunları paylaşın:

* `traceId`
* İstek metodu ve yolu (gizli bilgi olmadan)
* UTC zaman damgası
* Beklenen ve gözlenen davranış

İletişim: {{<destek@konukcrm.com>}}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.konukcrm.com/api-referansi/hata-kodlari.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
