---
title: "Zmień lead"
method: PATCH
path: "/leads/{id}"
tags: ["Leady"]
---

# Zmień lead

`PATCH /leads/{id}`

## Request

- Base URL: `https://outreachpilot.pl/api/v1`
- URL: `https://outreachpilot.pl/api/v1/leads/{id}`
- Auth: HTTP bearer

Częściowa aktualizacja pól, statusu i tagów (`tags` zastępuje całą listę). `null` czyści wartość. Zmiana `status` wysyła webhook `lead.status_changed` (`changed_by: api`).

**Wymagany zakres klucza:** `leads:write`.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `company_name` string, nullable: Nazwa firmy.
  - `first_name` string, nullable: Imię.
  - `last_name` string, nullable: Nazwisko.
  - `email` string, nullable: Adres e-mail (unikalny w Twojej bazie).
  - `phone` string, nullable: Telefon.
  - `job_title` string, nullable: Stanowisko.
  - `company_city` string, nullable: Miasto.
  - `company_industry` string, nullable: Branża.
  - `company_website` string, nullable: Strona WWW firmy.
  - `company_address` string, nullable: Adres.
  - `company_nip` string, nullable: NIP.
  - `company_regon` string, nullable: REGON.
  - `company_voivodeship` string, nullable: Województwo.
  - `company_pkd` string, nullable: Kod PKD.
  - `linkedin_url` string, nullable: Profil LinkedIn (URL).
  - `notes` string, nullable: Notatki.
  - `tags` string[]: Zastępuje całą listę tagów.
  - `status` 'nowy' | 'w_kampanii' | 'odpowiedzial' | 'zainteresowany' | 'brak_zainteresowania' | 'odrzucony': Status leada. Zmiana wywołuje webhook `lead.status_changed`.

## Response `200`

Sukces.

- object
  - `data` Lead, required
    - `id` string, required
    - `email` string, nullable, required
    - `first_name` string, nullable, required
    - `last_name` string, nullable, required
    - `job_title` string, nullable, required
    - `phone` string, nullable, required
    - `linkedin_url` string, nullable, required
    - `company_name` string, nullable, required
    - `company_nip` string, nullable, required
    - `company_regon` string, nullable, required
    - `company_website` string, nullable, required
    - `company_city` string, nullable, required
    - `company_voivodeship` string, nullable, required
    - `company_address` string, nullable, required
    - `company_industry` string, nullable, required
    - `company_pkd` string, nullable, required
    - `company_country` string, nullable, required: ISO 3166-1 alpha-2; `null` = Polska.
    - `status` 'nowy' | 'w_kampanii' | 'odpowiedzial' | 'zainteresowany' | 'brak_zainteresowania' | 'odrzucony', required
    - `source` 'ceidg' | 'krs' | 'google_maps' | 'pkt' | 'firmy_net' | 'panorama' | 'osm' | 'linkedin' | 'import_csv' | 'manual', required
    - `tags` string[], required
    - `notes` string, nullable, required
    - `ai_score` integer, nullable, required: Ocena AI 1-10 albo `null`.
    - `email_status` 'valid' | 'risky' | 'invalid' | 'unknown', nullable, required: Wynik weryfikacji adresu (sonda SMTP): `valid` zweryfikowany, `risky` ryzykowny (catch-all), `invalid` nieprawidłowy, `unknown` nie udało się sprawdzić, `null` nie sprawdzono.
    - `email_verified_at` string, nullable, required: Data i czas ISO 8601 (UTC).
    - `website_status` 'has' | 'none_confirmed' | 'unknown', nullable, required
    - `registry_status` 'active' | 'suspended' | 'deleted' | 'liquidation' | 'bankrupt' | 'unknown', nullable, required: Status firmy w CEIDG/KRS.
    - `origin` object, nullable, required: Skąd i kiedy pozyskaliśmy dane (art. 14 RODO).
      - `source` string, required
      - `source_detail` string
      - `acquired_at` string, required: Data i czas ISO 8601 (UTC).
      - `source_url` string
    - `times_contacted` integer, required
    - `times_opened` integer, required
    - `times_clicked` integer, required
    - `times_replied` integer, required
    - `last_contacted_at` string, nullable, required: Data i czas ISO 8601 (UTC).
    - `created_at` string, required: Data i czas ISO 8601 (UTC).
    - `updated_at` string, required: Data i czas ISO 8601 (UTC).

## Other responses

- `400`: Nieprawidłowe żądanie. Kody: `invalid_request`.
- `401`: Brak, zły, odwołany lub wygasły klucz (`missing_api_key`, `invalid_api_key`, `api_key_revoked`, `api_key_expired`, `account_inactive`).
- `403`: Plan nie obejmuje API (`plan_upgrade_required`, odpowiedź zawiera informacje o planie; nie dotyczy tras wtyczki z kluczem `extension:*`) albo klucz nie ma wymaganego zakresu (`insufficient_scope`).
- `404`: Nie znaleziono. Kody: `not_found`.
- `409`: Konflikt. Kody: `duplicate_lead`.
- `422`: Błąd walidacji. Kody: `validation_error`.
- `429`: Przekroczono limit żądań (`rate_limit_exceeded`). Zobacz nagłówek `Retry-After`.

---

[API](https://skmtc.dev/outreachpilot/apis/outreachpilot-api.md) · [All operations](https://skmtc.dev/outreachpilot/apis/outreachpilot-api/llms.txt) · [OpenAPI document](https://skmtc.dev/outreachpilot/apis/outreachpilot-api/revisions/2262dabfb07c?raw)
