> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meter.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Strategy Group Endpoints

> REST API endpoints for managing strategy groups

# Strategy Group Endpoints

Create and manage strategy groups for bulk operations on collections of strategies.

## Create strategy group

```http theme={null}
POST /api/strategy-groups
```

### Request body

```json theme={null}
{
  "name": "E-commerce Monitors",
  "description": "Product price tracking across 50 stores"
}
```

| Field         | Type   | Required | Description              |
| ------------- | ------ | -------- | ------------------------ |
| `name`        | string | Yes      | Name for the group       |
| `description` | string | No       | Description of the group |

### Response

```json theme={null}
{
  "id": "aa0e8400-e29b-41d4-a716-446655440000",
  "name": "E-commerce Monitors",
  "description": "Product price tracking across 50 stores",
  "strategy_count": 0,
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-01-15T10:30:00Z"
}
```

### Example

```bash theme={null}
curl -X POST https://api.meter.sh/api/strategy-groups \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "E-commerce Monitors",
    "description": "Product price tracking across 50 stores"
  }'
```

## List strategy groups

```http theme={null}
GET /api/strategy-groups?limit=50&offset=0
```

### Query parameters

| Parameter | Type    | Required | Description                  |
| --------- | ------- | -------- | ---------------------------- |
| `limit`   | integer | No       | Max results (default: 50)    |
| `offset`  | integer | No       | Results to skip (default: 0) |

### Response

```json theme={null}
[
  {
    "id": "aa0e8400-e29b-41d4-a716-446655440000",
    "name": "E-commerce Monitors",
    "description": "Product price tracking across 50 stores",
    "strategy_count": 12,
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:30:00Z"
  }
]
```

### Example

```bash theme={null}
curl https://api.meter.sh/api/strategy-groups?limit=10 \
  -H "Authorization: Bearer sk_live_..."
```

## Get strategy group

Get details for a specific group including member strategies.

```http theme={null}
GET /api/strategy-groups/{group_id}
```

### Response

```json theme={null}
{
  "id": "aa0e8400-e29b-41d4-a716-446655440000",
  "name": "E-commerce Monitors",
  "description": "Product price tracking across 50 stores",
  "strategies": [
    {
      "strategy_id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Amazon Products",
      "description": "Extract product listings",
      "url": "https://amazon.com/products",
      "created_at": "2025-01-15T10:30:00Z",
      "updated_at": "2025-01-15T10:30:00Z"
    }
  ],
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-01-15T10:30:00Z"
}
```

### Example

```bash theme={null}
curl https://api.meter.sh/api/strategy-groups/{group_id} \
  -H "Authorization: Bearer sk_live_..."
```

## Update strategy group

Update a group's name or description.

```http theme={null}
PATCH /api/strategy-groups/{group_id}
```

### Request body

```json theme={null}
{
  "name": "Updated Name",
  "description": "Updated description"
}
```

All fields are optional. Include only fields to update.

### Example

```bash theme={null}
curl -X PATCH https://api.meter.sh/api/strategy-groups/{group_id} \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "New Group Name"}'
```

## Delete strategy group

Delete a group. Strategies in the group become ungrouped — they are not deleted.

```http theme={null}
DELETE /api/strategy-groups/{group_id}
```

### Response

```json theme={null}
{
  "message": "Strategy group deleted successfully"
}
```

### Example

```bash theme={null}
curl -X DELETE https://api.meter.sh/api/strategy-groups/{group_id} \
  -H "Authorization: Bearer sk_live_..."
```

## Add strategies to group

Add existing strategies to a group.

```http theme={null}
POST /api/strategy-groups/{group_id}/strategies
```

### Request body

```json theme={null}
{
  "strategy_ids": [
    "550e8400-e29b-41d4-a716-446655440000",
    "660e8400-e29b-41d4-a716-446655440000"
  ]
}
```

### Response

```json theme={null}
{
  "message": "Strategies added to group"
}
```

### Example

```bash theme={null}
curl -X POST https://api.meter.sh/api/strategy-groups/{group_id}/strategies \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "strategy_ids": [
      "550e8400-e29b-41d4-a716-446655440000",
      "660e8400-e29b-41d4-a716-446655440000"
    ]
  }'
```

## Remove strategy from group

Remove a strategy from a group (sets the strategy's group to null — the strategy is not deleted).

```http theme={null}
DELETE /api/strategy-groups/{group_id}/strategies/{strategy_id}
```

### Response

```json theme={null}
{
  "message": "Strategy removed from group"
}
```

### Example

```bash theme={null}
curl -X DELETE https://api.meter.sh/api/strategy-groups/{group_id}/strategies/{strategy_id} \
  -H "Authorization: Bearer sk_live_..."
```

## Apply group schedule

Create or update a schedule for every strategy in the group.

```http theme={null}
POST /api/strategy-groups/{group_id}/schedule
```

### Request body

```json theme={null}
{
  "interval_seconds": 3600,
  "webhook_url": "https://your-app.com/webhooks/meter",
  "webhook_type": "standard"
}
```

| Field              | Type    | Required    | Description                                                                                  |
| ------------------ | ------- | ----------- | -------------------------------------------------------------------------------------------- |
| `interval_seconds` | integer | Conditional | Run every N seconds (min: 60)                                                                |
| `cron_expression`  | string  | Conditional | Cron expression                                                                              |
| `webhook_url`      | string  | No          | Webhook URL for notifications                                                                |
| `webhook_secret`   | string  | No          | Webhook secret (auto-generated if not provided)                                              |
| `webhook_type`     | string  | No          | `standard`, `slack`, `slack_workflow`, or `discord`. Auto-detected from URL if not specified |
| `webhook_metadata` | object  | No          | Custom JSON metadata for webhook payloads                                                    |

<Note>
  Provide either `interval_seconds` or `cron_expression`, not both.
</Note>

### Response

```json theme={null}
{
  "message": "Group schedule applied",
  "created": 8,
  "updated": 4
}
```

### Example

```bash theme={null}
curl -X POST https://api.meter.sh/api/strategy-groups/{group_id}/schedule \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "interval_seconds": 3600,
    "webhook_url": "https://your-app.com/webhooks/meter"
  }'
```

## Delete group schedules

Delete all schedules for strategies in the group.

```http theme={null}
DELETE /api/strategy-groups/{group_id}/schedule
```

### Response

```json theme={null}
{
  "message": "Group schedules deleted"
}
```

### Example

```bash theme={null}
curl -X DELETE https://api.meter.sh/api/strategy-groups/{group_id}/schedule \
  -H "Authorization: Bearer sk_live_..."
```

## Toggle group schedules

Enable or disable all schedules for strategies in the group.

```http theme={null}
PATCH /api/strategy-groups/{group_id}/schedule/toggle
```

### Request body

```json theme={null}
{
  "enabled": false
}
```

### Response

```json theme={null}
{
  "message": "Group schedules updated"
}
```

### Example

```bash theme={null}
curl -X PATCH https://api.meter.sh/api/strategy-groups/{group_id}/schedule/toggle \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
```

## Apply group schema

Apply an output schema to all strategies in the group. This triggers asynchronous regeneration of each strategy.

```http theme={null}
PATCH /api/strategy-groups/{group_id}/schema
```

### Request body

```json theme={null}
{
  "output_schema": {
    "title": "string",
    "price": "number",
    "in_stock": "boolean"
  }
}
```

| Field           | Type   | Required | Description                                       |
| --------------- | ------ | -------- | ------------------------------------------------- |
| `output_schema` | object | Yes      | JSON schema defining the desired output structure |

See [Output Schemas](/concepts/output-schemas) for supported types and nesting.

### Response

```json theme={null}
{
  "message": "Schema applied and regeneration started",
  "strategy_count": 12
}
```

### Example

```bash theme={null}
curl -X PATCH https://api.meter.sh/api/strategy-groups/{group_id}/schema \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "output_schema": {
      "title": "string",
      "price": "number",
      "in_stock": "boolean"
    }
  }'
```

## Get schema progress

Poll the progress of a group schema regeneration task.

```http theme={null}
GET /api/strategy-groups/{group_id}/schema/progress
```

### Response

Returns progress details from the background regeneration task.

### Example

```bash theme={null}
curl https://api.meter.sh/api/strategy-groups/{group_id}/schema/progress \
  -H "Authorization: Bearer sk_live_..."
```

## Test group webhook

Send a test webhook using a group's schedule webhook configuration.

```http theme={null}
POST /api/strategy-groups/{group_id}/webhook/test
```

### Response

```json theme={null}
{
  "success": true,
  "status_code": 200,
  "message": "Webhook delivered successfully"
}
```

### Example

```bash theme={null}
curl -X POST https://api.meter.sh/api/strategy-groups/{group_id}/webhook/test \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json"
```

<Note>
  The test uses the webhook URL from any existing schedule in the group. At least one member strategy must have a schedule with a `webhook_url` configured.
</Note>

## Error responses

| Status | Description                                                        |
| ------ | ------------------------------------------------------------------ |
| `400`  | Invalid request (missing required fields, invalid cron expression) |
| `401`  | Invalid or missing API key                                         |
| `404`  | Strategy group not found                                           |
| `422`  | Validation error (e.g., both interval and cron provided)           |
| `500`  | Internal server error                                              |

See [REST API Errors](/api-reference/rest/errors) for detailed error handling.

## Next steps

<CardGroup cols={2}>
  <Card title="Strategy Groups Concept" icon="layer-group" href="/concepts/strategy-groups">
    Understand strategy group architecture
  </Card>

  <Card title="Output Schemas" icon="table" href="/concepts/output-schemas">
    Define output structure for groups
  </Card>

  <Card title="Python SDK" icon="python" href="/api-reference/python/client">
    Strategy group methods in the SDK
  </Card>

  <Card title="Webhooks" icon="webhook" href="/guides/webhooks">
    Handle webhook notifications
  </Card>
</CardGroup>

## Need help?

Email me at [mckinnon@meter.sh](mailto:mckinnon@meter.sh)
