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

# Pricing Plans

> HTTP API: Pricing Plans

# Pricing Plans API

## Overview

The Pricing Plans API provides endpoints for viewing available pricing plans and their restrictions. Plans define limits on resources workspaces can create (projects, environments, resources, cloud connections, etc.).

**Base Endpoint:** `/api/pricing-plans`

All endpoints are publicly accessible (no authentication required).

**Note:** Plans are assigned to workspaces, not individual users. To manage workspace plans, use the [Payments API](/api/25-payments) for upgrades/downgrades or the [Workspaces API](/api/24-workspaces) to view a workspace's current plan.

***

## Pricing Plans Endpoints

### List All Pricing Plans

Get all active pricing plans available in the system.

**Endpoint:** `GET /api/pricing-plans`

**Authentication:** Not required

**Query Parameters:**

* `includeInactive` (optional): Include inactive plans (`true`/`false`, default: `false`)

**Example Request:**

```bash theme={null}
curl "https://api.gateways.app/api/pricing-plans"

# Include inactive plans
curl "https://api.gateways.app/api/pricing-plans?includeInactive=true"
```

**Example Response:**

```json theme={null}
{
  "message": "Pricing plans retrieved successfully",
  "count": 4,
  "data": [
    {
      "id": 1,
      "name": "Free",
      "slug": "free",
      "description": "Perfect for getting started",
      "price": 0.00,
      "pricePeriod": "month",
      "isActive": true,
      "restrictions": {
        "max_projects": 1,
        "max_environments_per_project": 1,
        "max_resources": 5,
        "max_resources_per_project": 5,
        "max_cloud_connections": 1,
        "max_workspace_members": 1,
        "features_disabled": [
          "multi_region",
          "team_collaboration",
          "advanced_monitoring",
          "priority_support"
        ]
      },
      "features": [
        "1 Project",
        "1 Environment per project",
        "5 Total resources",
        "1 Cloud connection",
        "Up to 1 workspace member",
        "Community support"
      ],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z"
    },
    {
      "id": 2,
      "name": "Starter",
      "slug": "starter",
      "description": "For small projects and teams",
      "price": 9.99,
      "pricePeriod": "month",
      "isActive": true,
      "restrictions": {
        "max_projects": 3,
        "max_environments_per_project": 3,
        "max_resources": 15,
        "max_resources_per_project": 15,
        "max_cloud_connections": 3,
        "max_workspace_members": 3,
        "features_disabled": [
          "advanced_monitoring",
          "priority_support"
        ]
      },
      "features": [
        "3 Projects",
        "3 Environments per project",
        "15 Total resources",
        "3 Cloud connections",
        "Up to 3 workspace members",
        "Email support"
      ],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z"
    },
    {
      "id": 3,
      "name": "Pro",
      "slug": "pro",
      "description": "For growing businesses",
      "price": 49.99,
      "pricePeriod": "month",
      "isActive": true,
      "restrictions": {
        "max_projects": 15,
        "max_environments_per_project": 15,
        "max_resources": 100,
        "max_resources_per_project": 100,
        "max_cloud_connections": 15,
        "max_workspace_members": 15,
        "features_disabled": []
      },
      "features": [
        "15 Projects",
        "15 Environments per project",
        "100 Total resources",
        "15 Cloud connections",
        "Up to 15 workspace members",
        "Advanced monitoring",
        "Priority support",
        "Multi-region support",
        "Team collaboration"
      ],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z"
    },
    {
      "id": 4,
      "name": "Ultimate",
      "slug": "ultimate",
      "description": "Unlimited scale for power users and large teams",
      "price": 199.99,
      "pricePeriod": "month",
      "isActive": true,
      "restrictions": {
        "max_projects": -1,
        "max_environments_per_project": -1,
        "max_resources": -1,
        "max_resources_per_project": -1,
        "max_cloud_connections": -1,
        "max_workspace_members": -1,
        "features_disabled": []
      },
      "features": [
        "Unlimited projects",
        "Unlimited environments",
        "Unlimited resources",
        "Unlimited cloud connections",
        "Unlimited workspace members",
        "Advanced monitoring",
        "Priority support",
        "Multi-region support",
        "Team collaboration"
      ],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z"
    }
  ]
}
```

**Note:** A value of `-1` in restrictions means unlimited.

**Error Responses:**

* `500 Internal Server Error`: Failed to retrieve pricing plans

***

### Get Pricing Plan by Slug

Get details of a specific pricing plan by its slug.

**Endpoint:** `GET /api/pricing-plans/:slug`

**Authentication:** Not required

**Path Parameters:**

* `slug` (required): Plan slug (e.g., `free`, `starter`, `pro`, `ultimate`, or yearly variants like `starter-yearly`, `ultimate-yearly`)

**Example Request:**

```bash theme={null}
curl "https://api.gateways.app/api/pricing-plans/free"
```

**Example Response:**

```json theme={null}
{
  "message": "Pricing plan retrieved successfully",
  "data": {
    "id": 1,
    "name": "Free",
    "slug": "free",
    "description": "Perfect for getting started",
    "price": 0.00,
    "pricePeriod": "month",
    "isActive": true,
    "restrictions": {
      "max_projects": 1,
      "max_environments_per_project": 1,
      "max_resources": 5,
      "max_resources_per_project": 5,
      "max_cloud_connections": 1,
      "max_workspace_members": 1,
      "features_disabled": [
        "multi_region",
        "team_collaboration",
        "advanced_monitoring",
        "priority_support"
      ]
    },
    "features": [
      "1 Project",
      "1 Environment per project",
      "5 Total resources",
      "1 Cloud connection",
      "Up to 1 workspace member",
      "Community support"
    ],
    "createdAt": "2024-01-15T10:00:00.000Z",
    "updatedAt": "2024-01-15T10:00:00.000Z"
  }
}
```

**Error Responses:**

* `404 Not Found`: Plan not found
* `500 Internal Server Error`: Failed to retrieve pricing plan

***

## Plan Restrictions

Plan restrictions are automatically enforced when workspaces try to create resources. If a workspace exceeds its plan limits, it will receive a `403 Forbidden` error with details about the limit.

### Restriction Types

| Restriction                    | Description                                                 | Unlimited Value |
| ------------------------------ | ----------------------------------------------------------- | --------------- |
| `max_projects`                 | Maximum number of projects                                  | `-1`            |
| `max_environments_per_project` | Maximum environments per project                            | `-1`            |
| `max_resources`                | Maximum total resources across all projects                 | `-1`            |
| `max_resources_per_project`    | Maximum resources per project                               | `-1`            |
| `max_cloud_connections`        | Maximum cloud provider connections                          | `-1`            |
| `max_workspace_members`        | Maximum workspace members (active) plus pending invitations | `-1`            |
| `features_disabled`            | Array of disabled feature names                             | `[]`            |

### Example Error Response

When a plan limit is exceeded:

```json theme={null}
{
  "error": "Plan limit exceeded",
  "message": "You have reached the maximum number of projects (1) for your plan. Please upgrade to create more projects.",
  "currentValue": 1,
  "limit": 1,
  "upgradeRequired": true
}
```

### Where Restrictions Are Enforced

Plan restrictions are automatically checked when:

* **Creating Projects** - Checks `max_projects`
* **Creating Environments** - Checks `max_environments_per_project`
* **Creating Resources** - Checks `max_resources` (workspace-wide) and `max_resources_per_project` (project-level)
  * Servers/Instances
  * Databases
  * Load Balancers
  * Storage Buckets
  * Applications
  * Firewalls
  * Terminals
  * CDNs
  * Functions
  * Static Websites
* **Creating Cloud Connections** - Checks `max_cloud_connections`
* **Inviting workspace members** - Checks `max_workspace_members` (counts active members + pending non-expired invitations)

***

## Default Plans

### Free Plan

* **Price:** \$0/month
* **Projects:** 1
* **Environments per Project:** 1
* **Total Resources:** 5
* **Resources per Project:** 5
* **Cloud Connections:** 1
* **Workspace members (incl. pending invites):** 1

### Starter Plan

* **Price:** \$9.99/month
* **Projects:** 3
* **Environments per Project:** 3
* **Total Resources:** 15
* **Resources per Project:** 15
* **Cloud Connections:** 3
* **Workspace members (incl. pending invites):** 3

### Pro Plan

* **Price:** \$49.99/month
* **Projects:** 15
* **Environments per Project:** 15
* **Total Resources:** 100
* **Resources per Project:** 100
* **Cloud Connections:** 15
* **Workspace members (incl. pending invites):** 15
* **Features:** Advanced monitoring, priority support, multi-region, team collaboration

### Ultimate Plan

* **Price:** \$199.99/month
* **Limits:** Unlimited (`-1` for cap fields), including **workspace members**
* **Features:** All caps unlimited in restrictions; multi-region, team collaboration, priority support, etc. (see seeded `features` JSON)

***

## Response Fields

### Pricing Plan Object

| Field          | Type           | Description                                       |
| -------------- | -------------- | ------------------------------------------------- |
| `id`           | number         | Unique plan ID                                    |
| `name`         | string         | Plan name (e.g., "Free", "Starter")               |
| `slug`         | string         | URL-friendly identifier (e.g., "free", "starter") |
| `description`  | string \| null | Plan description                                  |
| `price`        | number         | Monthly price in USD                              |
| `pricePeriod`  | string         | Billing period (`month` or `year`)                |
| `isActive`     | boolean        | Whether the plan is currently available           |
| `restrictions` | object         | Plan restrictions (see Restriction Types above)   |
| `features`     | array          | List of plan features                             |
| `createdAt`    | string         | Timestamp when plan was created (ISO 8601)        |
| `updatedAt`    | string         | Timestamp when plan was last updated (ISO 8601)   |

***

## Notes

* Plans are assigned to workspaces, not individual users
* All new workspaces are automatically assigned the Free plan
* Plan restrictions are enforced at the API level
* A value of `-1` in restrictions means unlimited
* Plan upgrades/downgrades are handled through the Payment API (see [Payments API](/api/25-payments))
* To get a workspace's current plan, use the Workspaces API (see [Workspaces API](/api/24-workspaces))
* Inactive plans cannot be assigned to workspaces
