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

# Create Group

> Create a product group to organize related subscription products

Create a product group to organize related subscription products.

```
POST /v1/actions/subscription-product-group/create-group
```

**Authentication:** API Key

## Request Body

| Field         | Type      | Required | Description                                             |
| ------------- | --------- | -------- | ------------------------------------------------------- |
| `storeId`     | string    | Yes      | Store ID (`STO_xxx` format)                             |
| `name`        | string    | Yes      | Group name (unique per store + environment)             |
| `description` | string    | No       | Group description                                       |
| `rules`       | object    | No       | Group rules (`{ sharedTrial: boolean }`)                |
| `productIds`  | string\[] | No       | Subscription product IDs (`PROD_xxx` format) to include |

## Example Request

<CodeGroup>
  ```typescript SDK theme={"system"}
  const { group } = await client.subscriptionProductGroups.create({
    storeId: "STO_2D5F8G3H1K4M6N9P",
    name: "Pricing Plans",
    description: "Free, Pro, and Enterprise tiers",
    rules: { sharedTrial: true },
    productIds: [
      "PROD_3F7H2J5L8N1Q4S6U",
      "PROD_8B4D6F9H2K5M7P1R",
      "PROD_1C3E5G7J0L2N4Q6S",
    ],
  });
  ```

  ```bash cURL theme={"system"}
  curl -X POST https://api.waffo.ai/v1/actions/subscription-product-group/create-group \
    -H "Content-Type: application/json" \
    -H "X-Merchant-Id: MER_7K3M9P2R5T8W1Y4Z" \
    -H "X-Timestamp: 2026-03-30T10:00:00Z" \
    -H "X-Signature: BASE64_RSA_SIGNATURE" \
    -d '{
      "storeId": "STO_2D5F8G3H1K4M6N9P",
      "name": "Pricing Plans",
      "description": "Free, Pro, and Enterprise tiers",
      "rules": { "sharedTrial": true },
      "productIds": [
        "PROD_3F7H2J5L8N1Q4S6U",
        "PROD_8B4D6F9H2K5M7P1R",
        "PROD_1C3E5G7J0L2N4Q6S"
      ]
    }'
  ```

  ```python Python theme={"system"}
  body = {
      "storeId": "STO_2D5F8G3H1K4M6N9P",
      "name": "Pricing Plans",
      "description": "Free, Pro, and Enterprise tiers",
      "rules": {"sharedTrial": True},
      "productIds": [
          "PROD_3F7H2J5L8N1Q4S6U",
          "PROD_8B4D6F9H2K5M7P1R",
          "PROD_1C3E5G7J0L2N4Q6S",
      ],
  }

  response = requests.post(
      "https://api.waffo.ai/v1/actions/subscription-product-group/create-group",
      json=body,
      headers=sign_request("POST", "/v1/actions/subscription-product-group/create-group", body),
  )
  group = response.json()["data"]["group"]
  ```
</CodeGroup>

## Success Response (200)

```json theme={"system"}
{
  "data": {
    "group": {
      "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
      "storeId": "STO_2D5F8G3H1K4M6N9P",
      "name": "Pricing Plans",
      "description": "Free, Pro, and Enterprise tiers",
      "rules": { "sharedTrial": true },
      "productIds": [
        "PROD_3F7H2J5L8N1Q4S6U",
        "PROD_8B4D6F9H2K5M7P1R",
        "PROD_1C3E5G7J0L2N4Q6S"
      ],
      "environment": "test",
      "createdAt": "2026-03-30T10:30:00.000Z",
      "updatedAt": "2026-03-30T10:30:00.000Z"
    }
  }
}
```

## Errors

> **Retry policy:** Never retry 4xx — fix the request and resubmit. Retry 5xx with exponential backoff (start 5s, max 3 attempts).

| Status | `errors[0].message`                                                            | What it means                                                        | Recommended handling                                      |
| ------ | ------------------------------------------------------------------------------ | -------------------------------------------------------------------- | --------------------------------------------------------- |
| 400    | `Missing or invalid header: x-context-environment`                             | Environment header missing or not `test` / `prod`                    | Fix the header, resubmit                                  |
| 400    | `Missing required fields: storeId, name`                                       | A required body field was omitted                                    | Add the missing field, resubmit                           |
| 400    | `Expected format: STO_xxx, got "..."` / `Expected format: PROD_xxx, got "..."` | `storeId` or a `productIds` entry could not be decoded as a Short ID | Fix the ID, resubmit                                      |
| 500    | `Internal server error`                                                        | Internal error or transient downstream failure                       | Retry with exponential backoff (start 5s, max 3 attempts) |
