Ana Sayfa / API entegrasyonu örnekleri

API entegrasyonu örnekleri

Labrika API’de veri okuma ve görev başlatma için istek sıralarını inceleyin. Kimlikleri, işlem durumlarını ve sonuçları entegrasyonunuzda birleştirin.

Bu sayfada

İhtiyacınız olan sonucu seçin ve istekleri sırayla kullanın. Gerekli izinler her akışta belirtilir.

LABRIKA_API_KEY değerini ayarlayın. SITE_UUID ve ENGINE_ID değerlerini site listesinden, PROJECT_ID değerini proje listesinden alın. COST_ESTIMATE_ID ve IDEMPOTENCY_KEY değerlerini fiyat teklifindeki cost_estimate_id ve idempotency_key alanlarından alın. RUN_ID değerini başlatma yanıtından alın. LIST_REVISION değerini sonuçtaki list.revision alanından alın. Listeyi düzenledikten sonra uygulamadan önce LIST_REVISION değerini PATCH yanıtındaki revision ile güncelleyin.

Zaman aşımında aynı Idempotency-Key ve gövdeyle tekrar deneyin. 401 için anahtarı, 403 için izinleri, 409 için çakışma nedenini kontrol edin. 429 varsa Retry-After değerini izleyin.

Son sıralamalar

İlgili bölge ve arama motoru için kayıtlı sıralamaları okuyun.

serp:read

Anahtar kelime sıralamalarını okumak için etkin bir Business veya Agency aboneliği gerekir. Site listelerine ve ölçüm tarihlerine serp:read ile erişilebilir.

  1. GET /serp/sites?limit=10

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/serp/sites?limit=10" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  2. GET /serp/sites/$SITE_UUID/search-engines/$ENGINE_ID/dates?limit=5

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/serp/sites/$SITE_UUID/search-engines/$ENGINE_ID/dates?limit=5" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  3. GET /serp/sites/$SITE_UUID/search-engines/$ENGINE_ID/positions?collected_at=last&limit=20

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/serp/sites/$SITE_UUID/search-engines/$ENGINE_ID/positions?collected_at=last&limit=20" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
Yanıt örneği
{
  "data": [
    {
      "site_uuid": "d3c9e51b06a44e27831f205ceac20000",
      "host": "example.com",
      "search_engines": [
        {
          "id": 42,
          "engine_title": "Google"
        }
      ]
    }
  ]
}

Tam site denetimi başlatma

Teklif kimliğini saklayın ve site UUID’siyle aşamayı okuyun.

site-audits:runmain-reports:read

  1. GET /main-reports/sites?limit=10

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/main-reports/sites?limit=10" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  2. POST /site-audits/sites/$SITE_UUID/cost

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/site-audits/sites/$SITE_UUID/cost" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data '{"pages_limit":500,"payment_option":"auto"}'
  3. POST /site-audits/sites/$SITE_UUID/run

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/site-audits/sites/$SITE_UUID/run" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
      --data-binary @- <<JSON
    {"cost_estimate_id":"${COST_ESTIMATE_ID:?}"}
    JSON
  4. GET /site-audits/sites/$SITE_UUID/progress

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/site-audits/sites/$SITE_UUID/progress" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
Yanıt örneği
{
  "data": {
    "cost_estimate_id": "ESTIMATE_FROM_COST",
    "idempotency_key": "KEY_FROM_COST",
    "page_credits": 500,
    "amount_minor": 0
  }
}

Site için anahtar kelimeler

Sonucu okuyun, çalışma listesini düzenleyin ve seçilen sürümü site ayarlarına ekleyin.

domain-keywords:run

Fiyat teklifine göre PAYMENT_OPTION değerini credits_available true ise ai_credits, balance_available true ise money_balance olarak ayarlayın. İkisi de false ise başlatmadan önce bakiye yükleyin. Başlatmayı yeniden denerken aynı ödeme seçeneğini kullanın.

  1. POST /domain-keywords/cost

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/cost" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data '{"domain":"example.com","keyword_count":80}'
  2. POST /domain-keywords/run

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/run" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
      --data-binary @- <<JSON
    {"cost_estimate_id":"${COST_ESTIMATE_ID:?}","payment_option":"${PAYMENT_OPTION:?}"}
    JSON
  3. GET /domain-keywords/runs/$RUN_ID/progress

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/runs/$RUN_ID/progress" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  4. GET /domain-keywords/runs/$RUN_ID

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/runs/$RUN_ID" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  5. PATCH /domain-keywords/runs/$RUN_ID/list

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/runs/$RUN_ID/list" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -X PATCH \
      --data-binary @- <<JSON
    {"revision":${LIST_REVISION:?},"mode":"append","items":[{"text":"wholesale tea"}]}
    JSON
  6. POST /domain-keywords/runs/$RUN_ID/apply

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/domain-keywords/runs/$RUN_ID/apply" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data-binary @- <<JSON
    {"site_uuid":"${SITE_UUID:?}","revision":${LIST_REVISION:?}}
    JSON
Yanıt örneği
{
  "cost_estimate_id": "ESTIMATE_FROM_COST",
  "idempotency_key": "KEY_FROM_COST",
  "ai_credits": 40,
  "amount_minor": 20,
  "currency": "USD",
  "credits_available": true,
  "balance_available": true,
  "keyword_count": 80
}

Yapay zekâ görünürlüğü için istemler

İşletmenin sunduklarını ve hariç tuttuklarını belirtin. 30–2000 istemi onar onar seçin.

prompt-suggestions:run

Fiyat teklifine göre PAYMENT_OPTION değerini credits_available true ise ai_credits, balance_available true ise money_balance olarak ayarlayın. İkisi de false ise başlatmadan önce bakiye yükleyin. Başlatmayı yeniden denerken aynı ödeme seçeneğini kullanın.

  1. POST /prompt-suggestions/cost

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/cost" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data '{"domain":"example.com","company_description":"We supply wholesale loose-leaf tea and tasting packs to cafés and independent retailers. We help customers plan their range and deliver regularly under contract.","exclusions":["Coffee","Coffee equipment","Retail purchases"],"prompt_count":30}'
  2. POST /prompt-suggestions/run

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/run" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
      --data-binary @- <<JSON
    {"cost_estimate_id":"${COST_ESTIMATE_ID:?}","payment_option":"${PAYMENT_OPTION:?}"}
    JSON
  3. GET /prompt-suggestions/runs/$RUN_ID/progress

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/runs/$RUN_ID/progress" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  4. GET /prompt-suggestions/runs/$RUN_ID

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/runs/$RUN_ID" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  5. PATCH /prompt-suggestions/runs/$RUN_ID/list

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/runs/$RUN_ID/list" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -X PATCH \
      --data-binary @- <<JSON
    {"revision":${LIST_REVISION:?},"mode":"append","items":[{"text":"Where can cafés buy wholesale tea?"}]}
    JSON
  6. POST /prompt-suggestions/runs/$RUN_ID/apply

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/prompt-suggestions/runs/$RUN_ID/apply" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data-binary @- <<JSON
    {"site_uuid":"${SITE_UUID:?}","revision":${LIST_REVISION:?}}
    JSON
Yanıt örneği
{
  "cost_estimate_id": "ESTIMATE_FROM_COST",
  "idempotency_key": "KEY_FROM_COST",
  "ai_credits": 21,
  "amount_minor": 11,
  "currency": "USD",
  "credits_available": true,
  "balance_available": true
}

Yapay zekâ görünürlüğü

Alan adıyla eşleşen projeleri bulun ve mevcut bir projeyi kullanmayı veya yeni bir proje oluşturmayı seçin. Raporu onaylanan fiyatla başlatın. Teklifteki Idempotency-Key değerini kullanın. Onayla birlikte yeni ayarlar eskilerinin yerini alır.

sites:createai-visibility:run

Kayıtlı veya yeni ayarlarla fiyatı hesaplayın. Yapay zekâ kredileri ve hesap para birimindeki fiyatı görmek için payment_option alanını boş bırakın. Rapor onaydan sonra başlar.

  1. GET /sites/by-domain?domain=example.com

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/sites/by-domain?domain=example.com" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  2. GET /ai-visibility/sites/$SITE_UUID/models

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/ai-visibility/sites/$SITE_UUID/models" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  3. POST /ai-visibility/sites/$SITE_UUID/cost

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/ai-visibility/sites/$SITE_UUID/cost" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      --data '{"settings":{"domain":"example.com","brand":"Acme","aliases":["Acme Studio"],"prompts":["Where can cafés order tea wholesale?"],"models":["chatgpt"],"competitors":[{"domain":"competitor.example","brand":"Rival Tea"}]}}'
  4. POST /ai-visibility/sites/$SITE_UUID/run

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/ai-visibility/sites/$SITE_UUID/run" \
      -H "Authorization: Bearer $LABRIKA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
      --data-binary @- <<JSON
    {"cost_estimate_id":"${COST_ESTIMATE_ID:?}"}
    JSON
Yanıt örneği
{
  "data": {
    "cost_estimate_id": "ESTIMATE_FROM_COST",
    "idempotency_key": "KEY_FROM_COST",
    "ai_credits": 1,
    "money_equivalent_minor": 1,
    "can_start": true
  }
}

Site değişiklikleri

İzleme projesini bulun ve son uyarılarını okuyun.

diff-projects:readdiff-alerts:read

  1. GET /diff-projects?limit=10

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/diff-projects?limit=10" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"
  2. GET /diff-projects/$PROJECT_ID/alerts?limit=20

    curl --silent --show-error --fail-with-body "https://app.labrika.com/public-api/v1/diff-projects/$PROJECT_ID/alerts?limit=20" \
      -H "Authorization: Bearer $LABRIKA_API_KEY"

HTTP 202, işlemin tamamlandığını değil isteğin kabul edildiğini gösterir. Kimliği saklayın ve belirtilen GET yöntemiyle durumu kontrol edin. Durum okurken HTTP 200 alınması da görevin başarılı olduğunu kanıtlamaz: status ve hata alanlarına bakın. Döndürülürse retry_after_seconds süresine uyun.

Ortak API/MCP kullanım bütçesi, para bakiyesi, abonelik kotaları ve yapay zekâ kredileri farklı kaynaklardır. Para çekmeyen bir maliyet tahmini teknik bütçeyi tüketebilir. Ücretli işlemden önce güncel tahmini, ödeme seçeneğini ve yanıttaki para birimini kontrol edin.