# Synchronous

> For short tasks, ask the submit call to wait:

```http
Prefer: wait=30
```

- If the job finishes within `N` seconds (capped at `GET /v1/meta` `limits.prefer_wait.max_seconds`), you get `200` with the **result** object (its
  first page — see [Result](https://docs.refabric.com/task-apis/calling-tasks/asynchronous-jobs#result)). A job that failed or was cancelled answers its error.
- Otherwise you get the normal `202` handle, and the job keeps running — poll or wait for the
  webhook as usual.
- Your HTTP client timeout must be longer than `N`.

```python
r = s.post(f"{API}/tasks/image.generate", json=body,
           headers={"Prefer": "wait=30", "Idempotency-Key": key}, timeout=75)
result = r.json() if r.status_code == 200 else None   # None → poll r.json()["status_url"]
```
