Zuhause / API-Integrationsbeispiele

API-Integrationsbeispiele

Verbinden Sie Anfragen für Positionen, Audits, Keywords, Prompts und Monitoring. Die Abläufe erläutern Rechte, Kennungen und die Behandlung von Wiederholungen.

Auf dieser Seite

Wählen Sie das gewünschte Ergebnis und folgen Sie den Anfragen. Die erforderlichen Berechtigungen stehen neben jedem Ablauf.

Setzen Sie LABRIKA_API_KEY. Übernehmen Sie SITE_UUID und ENGINE_ID aus der Website-Liste und PROJECT_ID aus der Projektliste. Setzen Sie COST_ESTIMATE_ID und IDEMPOTENCY_KEY anhand der Felder cost_estimate_id und idempotency_key aus der Kostenschätzung. RUN_ID steht in der Startantwort. Setzen Sie LIST_REVISION anhand von list.revision im Ergebnis. Aktualisieren Sie nach der Bearbeitung LIST_REVISION mit revision aus der PATCH-Antwort, bevor Sie die Liste übernehmen.

Nach einem Timeout senden Sie denselben Idempotency-Key und dieselben Daten. Bei 401 den Schlüssel prüfen, bei 403 die Rechte, bei 409 den Konfliktgrund. Bei 429 gilt Retry-After, falls vorhanden.

Aktuelle Rankings

Lesen Sie gespeicherte Positionen für die passende Region und Suchmaschine.

serp:read

Zum Abrufen von Keyword-Positionen benötigen Sie ein aktives Business- oder Agency-Abonnement. Die Website-Liste und die Messtermine sind mit serp:read verfügbar.

  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"
Antwortauszug
{
  "data": [
    {
      "site_uuid": "d3c9e51b06a44e27831f205ceac20000",
      "host": "example.com",
      "search_engines": [
        {
          "id": 42,
          "engine_title": "Google"
        }
      ]
    }
  ]
}

Vollständiges Audit starten

Speichern Sie die Angebots-ID und prüfen Sie die Phase mit der Website-UUID.

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"
Antwortauszug
{
  "data": {
    "cost_estimate_id": "ESTIMATE_FROM_COST",
    "idempotency_key": "KEY_FROM_COST",
    "page_credits": 500,
    "amount_minor": 0
  }
}

Keywords für eine Website

Lesen und bearbeiten Sie die Liste. Übertragen Sie die gewählte Revision in die Einstellungen.

domain-keywords:run

Setzen Sie PAYMENT_OPTION anhand der Kostenschätzung auf ai_credits, wenn credits_available true ist, oder auf money_balance, wenn balance_available true ist. Sind beide Werte false, laden Sie das Guthaben vor dem Start auf. Verwenden Sie bei einem erneuten Start dieselbe Zahlungsmethode.

  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
Antwortauszug
{
  "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
}

Prompts für KI-Sichtbarkeit

Beschreiben Sie das Angebot und die Ausschlüsse. Wählen Sie 30–2.000 Prompts in Zehnerschritten.

prompt-suggestions:run

Setzen Sie PAYMENT_OPTION anhand der Kostenschätzung auf ai_credits, wenn credits_available true ist, oder auf money_balance, wenn balance_available true ist. Sind beide Werte false, laden Sie das Guthaben vor dem Start auf. Verwenden Sie bei einem erneuten Start dieselbe Zahlungsmethode.

  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
Antwortauszug
{
  "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
}

KI-Sichtbarkeit

Suchen Sie Projekte für die Domain und wählen Sie ein bestehendes oder ein neues Projekt. Starten Sie den Bericht zum bestätigten Preis. Verwenden Sie den Idempotency-Key aus dem Angebot. Neue Einstellungen ersetzen die bisherigen Einstellungen bei der Bestätigung.

sites:createai-visibility:run

Berechnen Sie den Preis mit gespeicherten oder neuen Einstellungen. Ohne payment_option sehen Sie den Preis in KI-Kontingenten und der Kontowährung. Der Bericht wird erst nach der Bestätigung gestartet.

  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
Antwortauszug
{
  "data": {
    "cost_estimate_id": "ESTIMATE_FROM_COST",
    "idempotency_key": "KEY_FROM_COST",
    "ai_credits": 1,
    "money_equivalent_minor": 1,
    "can_start": true
  }
}

Website-Änderungen

Finden Sie das Monitoring-Projekt und lesen Sie die jüngsten Meldungen.

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 bestätigt die Annahme, nicht den Abschluss. Speichern Sie die ID und prüfen Sie den Zustand mit der angegebenen GET-Methode. Auch HTTP 200 bei einer Statusabfrage beweist keinen erfolgreichen Abschluss: Lesen Sie status und Fehlerfelder. Beachten Sie retry_after_seconds, falls vorhanden.

Das gemeinsame API/MCP-Budget, Geldguthaben, Abonnementkontingente und KI-Credits sind getrennte Ressourcen. Eine Kostenschätzung ohne Geldabbuchung kann das technische Budget verbrauchen. Prüfen Sie vor kostenpflichtigen Aktionen die aktuelle Schätzung, Zahlungsart und Währung der Antwort.