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

# Deploy API Proxy Group

> Deploys an API Proxy Group to a specific environment. All API Proxies in the group are deployed together.

## Endpoint

```plaintext theme={null}
POST /apiops/projects/{projectName}/apiProxyGroups/{apiProxyGroupName}/environments/{environmentName}/
```

## Authentication

Requires a Personal API Access Token.

### Header

```plaintext theme={null}
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value          | Required |
| ------------- | -------------- | -------- |
| Authorization | Bearer {token} | Yes      |

### Path Parameters

| Parameter         | Type   | Required | Description                   |
| ----------------- | ------ | -------- | ----------------------------- |
| projectName       | string | Yes      | Project name                  |
| apiProxyGroupName | string | Yes      | API Proxy Group name          |
| environmentName   | string | Yes      | Environment name to deploy to |

### Query Parameters

None.

### Request Body

Optional JSON body. When omitted, defaults are applied.

| Field       | Type    | Required | Description                                                                                                              |
| ----------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| description | string  | No       | Description/notes for the deploy history record. Defaults to "Deployed by APIOPS Api" if not provided.                   |
| persistent  | boolean | No       | If `true`, this deploy history record will not be auto-deleted when the retention limit is reached. Defaults to `false`. |

#### Example

```json theme={null}
{
  "description": "v2.1 release",
  "persistent": true
}
```

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "message": "Deployment completed successfully",
    "environmentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployed successfully"
      }
    ]
  }
}
```

### Response Fields

| Field            | Type    | Description                                                                  |
| ---------------- | ------- | ---------------------------------------------------------------------------- |
| success          | boolean | Indicates if the request was successful                                      |
| deploymentResult | object  | Deployment result. See [Deployment Result Object](#deployment-result-object) |

### Deployment Result Object

| Field              | Type           | Description                       |
| ------------------ | -------------- | --------------------------------- |
| success            | boolean        | Overall deployment success status |
| message            | string         | Deployment message                |
| environmentResults | array\[object] | Results per environment           |

### Environment Result Object

| Field           | Type    | Description                                    |
| --------------- | ------- | ---------------------------------------------- |
| environmentName | string  | Environment name                               |
| success         | boolean | Deployment success status for this environment |
| message         | string  | Deployment message for this environment        |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "API Proxy Group (PaymentAPIGroup) is not found or user does not have privilege to access it!"
}
```

or

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Environment (production) is not found or user does not have privilege to access it!"
}
```

## cURL Example

```bash theme={null}
curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxyGroups/PaymentAPIGroup/environments/production/" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### With Description and Persistent Flag

```bash theme={null}
curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxyGroups/PaymentAPIGroup/environments/production/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"description": "v2.1 release", "persistent": true}'
```

## Notes and Warnings

* **Group Deployment**:
  * All API Proxies in the group are deployed together
  * Group-level settings (CORS, cache, etc.) are also deployed

* **Environment Must Exist**:
  * Environment must exist and be accessible

## Permissions

* User must have **`API_MANAGEMENT` + `DEPLOY_UNDEPLOY`** permission in the project

## Related Documentation

* [Undeploy API Proxy Group](/api-reference/api-proxy-groups/deployment/undeploy-api-proxy-group) - Undeploy group from environment
* [List Environments](/api-reference/api-proxy-groups/deployment/list-environments) - List environments for group
