# Quickstart

Your first integration in four steps. The examples run with a sandbox key; with a live key the same requests work on your real companies.

## 0. Sandbox key

In the dashboard: **API keys › Create sandbox key**. Put the key and secret in environment variables:

```bash
export ULAWK_ANAHTAR="ulk_DENEME_ANAHTARINIZ"
export ULAWK_GIZLI="ulsk_DENEME_GIZLI_ANAHTARINIZ"
```

## 1. Follow a company

The request does not wait: the record is created at once, notices and the profile are prepared in the background. If the company is already on your list you get `zaten_var` and no allowance is used.

```bash
curl -X POST https://ulawk.com/api/v1/sirket-ekle/ \
  -H "X-API-Key: $ULAWK_ANAHTAR" -H "X-API-Secret: $ULAWK_GIZLI" \
  -H "Content-Type: application/json" \
  -d '{"mudurluk": "İSTANBUL", "sicil_no": "555555"}'
```

The response has `sirket_id` and `durum_adresi` (`DENEME-YAVAS` in the sandbox).

## 2. Poll the status

`asama`: `ilanlar-cekiliyor` → `gazeteler-indiriliyor` → `profil-hazirlaniyor` → `hazir`. Poll every few minutes.

```bash
curl https://ulawk.com/api/v1/sirketler/DENEME-YAVAS/durum/ \
  -H "X-API-Key: $ULAWK_ANAHTAR" -H "X-API-Secret: $ULAWK_GIZLI"
```

## 3. Read the profile

Every record has `kaynak`; `veri_durumu` tells you how complete each section is.

```bash
curl https://ulawk.com/api/v1/sirketler/DENEME-100001/ \
  -H "X-API-Key: $ULAWK_ANAHTAR" -H "X-API-Secret: $ULAWK_GIZLI"
```

## 4. Subscribe to changes

When something changes in your categories we send the notice itself, signed. `gizli` appears only in this response; keep it and [verify the signature](/en/gelistirici/webhooklar/#imza).

```bash
curl -X POST https://ulawk.com/api/v1/webhooklar/ \
  -H "X-API-Key: $ULAWK_ANAHTAR" -H "X-API-Secret: $ULAWK_GIZLI" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://sisteminiz.ornek.com/ulawk", "kategoriler": ["durum", "yetkililer"]}'
```

Then send a made-up test notification with `POST /api/v1/webhooklar/{id}/test/`.

## All together (Python)

```python
import os
import time

import requests

TABAN = "https://ulawk.com"
B = {"X-API-Key": os.environ["ULAWK_ANAHTAR"], "X-API-Secret": os.environ["ULAWK_GIZLI"]}

ekle = requests.post(f"{TABAN}/api/v1/sirket-ekle/", headers=B, json={"mudurluk": "İSTANBUL", "sicil_no": "555555"}, timeout=30).json()
for _ in range(30):
    durum = requests.get(ekle["durum_adresi"], headers=B, timeout=30).json()
    if durum["profil_hazir"] or durum["asama"] == "sube":
        break
    time.sleep(60)  # in the sandbox DENEME-YAVAS never becomes ready; the loop stops after 30 tries

sirket_id = ekle["sirket_id"] if durum["profil_hazir"] else "DENEME-100001"  # a ready sandbox company
profil = requests.get(f"{TABAN}/api/v1/sirketler/{sirket_id}/", headers=B, timeout=30).json()
for y in profil["yetkililer"] or []:
    print(y["isim"], y["sifat"], y["kaynak"]["gazete_pdf"] if y["kaynak"] else "-")
```
