# Enable or disable an agent

Enable or disable an agent in the partner's network. Disable sets `agentApproved` to `false` and pauses all currently unpaused campaigns. Enable sets `agentApproved` to `true` and does not resume campaigns.

### Request

```http
POST /partner/agents/status
```

#### Headers

| Name | Required | Description |
| --- | --- | --- |
| x-api-key | Yes | Partner API key |
| Content-Type | Yes | `application/json` |

#### Request Body

```json
{
  "agentId": "us-east-1:11111111-1111-1111-1111-111111111111",
  "enabled": false
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| agentId | string | Yes | Agent to update (`us-east-1:<uuid>`). Must belong to the API key's network. |
| enabled | boolean | Yes | `false` disables the agent. `true` enables the agent. |

### Disable (`enabled: false`)

1. Sets `agentApproved` to `false`.
2. Pauses every active, currently unpaused campaign for that agent (Postgres, Bridge spending periods, DynamoDB).
3. If the network has `requireAgentApproval`, the agent cannot create campaigns, purchase bulk leads, transfer funds, create groups, deposit, or unpause campaigns.

Campaigns stay paused after a later enable until the agent (once approved) or a manager resumes them.

### Enable (`enabled: true`)

Sets `agentApproved` to `true`. Does not change campaign pause state.

### Response

#### Success (200)

```json
{
  "agentId": "us-east-1:11111111-1111-1111-1111-111111111111",
  "networkId": "22222222-2222-2222-2222-222222222222",
  "enabled": false,
  "pausedCampaignCount": 3
}
```

| Field | Type | Description |
| --- | --- | --- |
| agentId | string | Agent that was updated (`us-east-1:<uuid>`) |
| networkId | uuid | Partner network from the API key |
| enabled | boolean | Resulting enabled state |
| pausedCampaignCount | number | Campaigns paused on disable (`0` on enable) |

#### Errors

| Status | Description |
| --- | --- |
| 400 | Body validation failed |
| 401 | Invalid or missing API key |
| 404 | Agent not in this network |
| 500 | Failed to pause campaigns in Bridge or DynamoDB |

### Example

```bash
curl -X POST "https://api.example.com/partner/agents/status" \
  -H "x-api-key: pk_your_partner_key" \
  -H "Content-Type: application/json" \
  -d '{"agentId":"us-east-1:11111111-1111-1111-1111-111111111111","enabled":false}'
```
