# Targets

## Targets

### list_targets

List targets with optional filters. Returns paginated results.

```python
async def list_targets(
    status: Optional[str] = None,
    epoch: Optional[int] = None,
    limit: Optional[int] = None,
    read_mask: Optional[str] = None,
) -> ListTargetsResponse
```

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `status` | `str` | No | `None` | Filter: `"open"`, `"filled"`, or `"claimed"` |
| `epoch` | `int` | No | `None` | Filter by generation epoch |
| `limit` | `int` | No | `None` | Maximum results per page |
| `read_mask` | `str` | No | `None` | Field mask for partial responses |

**Returns**: [`ListTargetsResponse`](https://docs.soma.org/reference/sdk/types/#listtargetsresponse)

#### Example

```python
response = await client.list_targets(status="open", limit=10)
for target in response.targets:
    print(f"{target.id}: threshold={target.distance_threshold}")
```

### get_targets

Get a flat list of targets (unwrapped from pagination).

```python
async def get_targets(
    status: Optional[str] = None,
    epoch: Optional[int] = None,
    limit: Optional[int] = None,
) -> list[Target]
```

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `status` | `str` | No | `None` | Filter: `"open"`, `"filled"`, or `"claimed"` |
| `epoch` | `int` | No | `None` | Filter by generation epoch |
| `limit` | `int` | No | `None` | Maximum results |

**Returns**: `list[`[`Target`](https://docs.soma.org/reference/sdk/types/#target)`]`

## Model Manifests

### get_model_manifests

Fetch weight manifests for models. Accepts either a list of model IDs or a `Target` object (uses its `model_ids`).

```python
async def get_model_manifests(
    model_ids_or_target: Union[list[str], Target],
) -> list[ModelManifest]
```

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `model_ids_or_target` | `list[str] \| Target` | Yes | - | Model IDs or a Target object |

**Returns**: `list[`[`ModelManifest`](https://docs.soma.org/reference/sdk/types/#modelmanifest)`]`

#### Example

```python
targets = await client.get_targets(status="open", limit=1)
manifests = await client.get_model_manifests(targets[0])
for m in manifests:
    print(f"URL: {m.url}, size: {m.size}")
```

## Fetching Data

### fetch_model

Download model weights via the fullnode network.

```python
async def fetch_model(model_id: str) -> bytes
```

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `model_id` | `str` | Yes | - | Model object ID |

**Returns**: `bytes`. Raw (encrypted) model weights.

### fetch_submission_data

Download submission data for a filled target via the fullnode network.

```python
async def fetch_submission_data(target_id: str) -> bytes
```

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `target_id` | `str` | Yes | - | Target object ID |

**Returns**: `bytes`. Raw submission data.