Operasyonel

API Dökümanları

XFetch Orchestrator REST API referansı

Temel URL

Tüm API istekleri bu temel URL üzerinden yapılır:

https://archepolis.xyz/api

Kimlik Doğrulama

Tüm istekler X-API-Key başlığı ile bir API anahtarı gerektirir. Anahtarınızı Kontrol Paneli → API Anahtarları sekmesinden oluşturabilirsiniz.

Header formatı
X-API-Key: xfetch_YOUR_API_SECRET
POST/api/execute/

Senkron Yönetici Entegresi (Public Execution API)

Synchronous

Ağa kayıtlı PULL veya PUSH nodeları üzerinden senkronize (anında sonuç beklemeli) görev başlatır ve sonucu JSON olarak döner. Kuyruk bekleme ve node çalışma süreleri ayrı izlenir. Node timeout tabanı 1500 saniyedir; her başlayan 3000 tweet bloğunda ölçeklenir ve 7200 saniye ile sınırlıdır. Ağır işlerde async jobs kullanılması önerilir.

💸 Fiyatlandırma Politikası: user_tweets_fetch istekleri dönen tweet sayısına göre (1000 tweet başına ücret), search_fetch istekleri ise gelen sonuç sayısına göre (1000 sonuç başına ücret) hesaplanarak faturalanır. Eğer hiç bir sonuç dönmezse yapılandırılmış minimum işlem taban ücreti kesilir.

İstek Gövdesi

typestring — Hedef tip (Örn: user_tweets_fetch veya search_fetch)
paramsobject — Tipin beklediği argümanlar (Örn: {"username": "celalyaziyor"})
excludestring[] — originals, quotes, replies ve/veya retweets; varsayılan boş liste reply dahil eder, replies değeri Posts-only seçer.
referenced_depthinteger — geriye uyumlu ortak derinlik 1-3; varsayılan 1.
self_reference_depthinteger — aynı yazar referansları için 0-100.
other_reference_depthinteger — diğer yazar referansları için 0-100.
timeout_secondsinteger — async ağır işler için opsiyonel 60-7200 saniye override.
since_idstring — cache dahil yalnız bu ID'den yeni tweetler; meta.since_id_reached cutoff durumunu açıklar.
cURL İLE KULLANIM
curl -X POST https://archepolis.xyz/api/execute/ \
  -H "X-API-Key: xfetch_YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "user_tweets_fetch",
    "params": {
        "username": "celalyaziyor",
        "count": 100,
        "exclude": ["retweets", "quotes"],
        "self_reference_depth": 100,
        "other_reference_depth": 100
    }
  }'

Standart Yanıt Yapısı (Normalized Schema)

BAŞARILI YANIT (200 OK)
{
  "success": true,
  "data": {
    "name": "Celal Yaziyor",
    "tweets": ["Hello World!"]
  },
  "meta": {
    "job_id": "job_f4d1d11cf8d9c7b6",
    "node_id": "node_l6ojwk2n",
    "duration_ms": 79,
    "token_usage": 2,
    "result_count": 1,
    "cost": 0.05,
    "cached": false
  },
  "error": null
}

X API v2 Tarzı Public Endpointler

Bu endpointler /2 altında çalışır ve standart v2 response döndürür. Legacy /api/execute/ formatı değişmez. /2/users için usernames veya numeric ids kullanılır; eksik hedefler errors[] ve meta.lookup_errors içinde raporlanır. Senkron çağrıda 25 veya daha az kullanıcı önerilir.

GET /2/tweets/{id}
curl "https://archepolis.xyz/2/tweets/2095223570918166647?self_reference_depth=100&other_reference_depth=100" \
  -H "X-API-Key: xfetch_YOUR_API_SECRET"
GET /2/users/by/username/{username}
curl https://archepolis.xyz/2/users/by/username/celalyaziyor \
  -H "X-API-Key: xfetch_YOUR_API_SECRET"
GET /2/users
curl "https://archepolis.xyz/2/users?usernames=celalyaziyor,SinemasaYT" \
  -H "X-API-Key: xfetch_YOUR_API_SECRET"
GET /2/users?ids=
curl "https://archepolis.xyz/2/users?ids=15828364,783214" \
  -H "X-API-Key: xfetch_YOUR_API_SECRET"
GET /2/users/{id}/tweets
curl "https://archepolis.xyz/2/users/44196397/tweets?max_results=100&self_reference_depth=100&other_reference_depth=100" \
  -H "X-API-Key: xfetch_YOUR_API_SECRET"
V2 response shape
{
  "data": [],
  "includes": {
    "tweets": [],
    "users": [],
    "media": [],
    "places": [],
    "polls": []
  },
  "meta": {
    "job_id": "...",
    "node_id": "...",
    "result_count": 0,
    "response_contract_version": 2,
    "timeline": {},
    "longform_enrichment": {},
    "referenced_enrichment": {},
    "lookup_errors": []
  },
  "errors": []
}

includes.media[] nesneleri media_key, type, url, preview_image_url, boyut, süre, alt_text ve variants[] alanlarını taşır. entities.urls[] içinde url, expanded_url, display_url ve kaynakta yoksa null olan unwound_url bulunur.

Tarih Aralığı

user_date_range_fetch en yeni count kaydı sonradan elemek yerine, pencere içinden yeterli sonuç bulunana veya since sınırına ulaşılana kadar geriye sayfalar. since dahil, until hariçtir. meta.date_range_scan taranan en yeni/en eski tarihi, taranan kayıt sayısını ve range_complete kanıtını döndürür.

user_date_range_fetch
curl -X POST https://archepolis.xyz/api/execute/   -H "X-API-Key: xfetch_YOUR_API_SECRET"   -H "X-Response-Format: v2"   -H "Content-Type: application/json"   -d '{
    "type": "user_date_range_fetch",
    "params": {
      "username": "celalyaziyor",
      "since": "2026-01-01",
      "until": "2026-06-01",
      "count": 5
    }
  }'
async user_date_range_fetch
curl -X POST https://archepolis.xyz/api/jobs/   -H "X-API-Key: xfetch_YOUR_API_SECRET"   -H "Content-Type: application/json"   -d '{
    "target_username": "celalyaziyor",
    "job_type": "user_date_range_fetch",
    "params": {
      "since": "2026-01-01",
      "until": "2026-06-01",
      "count": 20
    }
  }'

Async çağrıda master tipi node'un username_fetch capability'sine çevirir. result_data.meta.date_range_scan içindeki range_complete, partial, scan_limit_reached ve stop_reason alanları taramanın kapsamını gösterir.

POST/api/jobs/

Kullanıcı Getirme İşlemi

Belirtilen kullanıcı adına ait profil verisini X (Twitter) platformundan tarar ve yapılandırılmış formatta döndürür. İş asenkron olarak kuyruğa alınır ve atanan node tarafından işlenir.

İstek Gövdesi

target_usernamestring — Hedef kullanıcı adı (zorunlu)
job_typestring — execute tipleri ve alias'ları kabul edilir; master node capability adına çevirir.
priorityinteger — Öncelik seviyesi (0-10, varsayılan: 0)
cURL
curl -X POST https://archepolis.xyz/api/jobs/ \
  -H "Authorization: Bearer xfetch_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "target_username": "elonmusk",
    "job_type": "username_fetch",
    "priority": 5
  }'
JavaScript (fetch)
const res = await fetch(
  "https://archepolis.xyz/api/jobs/",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer xfetch_YOUR_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      target_username: "elonmusk",
      job_type: "username_fetch",
      priority: 5
    })
  }
);
const job = await res.json();
console.log(job.id);
Python (requests)
import requests

resp = requests.post(
    "https://archepolis.xyz/api/jobs/",
    headers={
        "Authorization": "Bearer xfetch_YOUR_KEY",
        "Content-Type": "application/json"
    },
    json={
        "target_username": "elonmusk",
        "job_type": "username_fetch",
        "priority": 5
    }
)
job = resp.json()
print(job["id"])
GET/api/jobs/{job_id}

İş Durumu Sorgula

Oluşturulan bir işin güncel durumunu, sonucunu ve metadata bilgisini getirir.

Örnek Yanıt
{
  "id": "a1b2c3d4-e5f6-...",
  "target_username": "elonmusk",
  "job_type": "username_fetch",
  "status": "completed",
  "priority": 5,
  "assigned_node_id": "node-abc123",
  "retry_count": 0,
  "token_usage": 150,
  "cost": 0.0015,
  "result_data": { ... },
  "created_at": "2026-04-05T17:00:00Z",
  "started_at": "2026-04-05T17:00:01Z",
  "completed_at": "2026-04-05T17:00:03Z"
}

queued / processing / waiting_rate_limit / retrying aktif akistir. Retryable hata terminal failed olmadan yeniden kuyruga girer.

completed / failed / cancelled / late_completed / late_failed terminaldir ve yeniden acilmaz.

ACCOUNT_RATE_LIMITED terminal hata degil, hesap rotasyonu progress bilgisidir. Client bu kodda isi iptal etmemelidir.

Verili rate-limit checkpoint'i completed ve meta.partial=true olarak korunur. Verisiz RateLimitExhausted, waiting_rate_limit durumunda cooldown bekler.

Istenen count'tan az sonuc tek basina partial degildir. Timeline no_page_tweets, no_cursor, repeated_cursor veya cursor_cycle ile bittiyse partial=false ve limited=false doner.

Rate-limit bilgisi progress_code ve progress_message alanlarindadir; error_message gercek hatalara ayrilmistir. retry_count >= 999 timeout/legacy sentinel degeridir.

Iptal: POST /api/jobs/{job_id}/cancel.

Hata Kodları

KodDurumAçıklama
400Bad RequestEksik veya desteklenmeyen istek parametresi
401UnauthorizedGeçersiz veya eksik API anahtarı (X-API-Key)
402Payment RequiredKotanız doldu (Quota Exceeded)
404Not Foundİlgili node hazır değil veya aktif yük limitinde
403ForbiddenAPI anahtarı iptal edilmiş veya yetki dışı
404Not Foundİstenen kaynak bulunamadı
429Rate Limitedİstek hız limiti aşıldı
500Server ErrorSunucu tarafında beklenmeyen hata