> ## 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.

# Update Endpoint

> Updates an existing endpoint (API method) in an API proxy. Only provided fields are updated; omitted fields remain unchanged.

## Endpoint

```
PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/endpoints/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer {token}   | Yes      |
| Content-Type  | application/json | Yes      |

### Path Parameters

| Parameter    | Type   | Required | Description    |
| ------------ | ------ | -------- | -------------- |
| projectName  | string | Yes      | Project name   |
| apiProxyName | string | Yes      | API Proxy name |

### Request Body

#### Full JSON Body Example

```json theme={null}
{
  "name": "/api/users",
  "httpMethod": "GET",
  "description": "Updated endpoint description",
  "backendResourceUrl": "/users/v2",
  "backendHttpMethod": "GET",
  "deploy": false,
  "deployTargetEnvironmentNameList": []
}
```

#### Request Body Fields

| Field                           | Type           | Required | Default | Description                                                            |
| ------------------------------- | -------------- | -------- | ------- | ---------------------------------------------------------------------- |
| name                            | string         | Yes      | -       | Endpoint path/name (used as identifier to find the endpoint)           |
| httpMethod                      | string         | Yes      | -       | HTTP method for the endpoint (used as identifier to find the endpoint) |
| description                     | string         | No       | -       | Endpoint description                                                   |
| backendResourceUrl              | string         | No       | -       | Backend resource URL                                                   |
| backendHttpMethod               | string         | No       | -       | HTTP method for backend call                                           |
| deploy                          | boolean        | No       | false   | If true, deploy the API proxy after saving changes                     |
| deployTargetEnvironmentNameList | array\[string] | No       | -       | List of environment names to deploy to (required when deploy=true)     |

**Note:** `name` and `httpMethod` are required and used to identify the endpoint. Other fields are optional and only provided fields are updated.

### EnumHttpRequestMethod

* `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `OPTIONS`, `HEAD`, `TRACE`, `ALL`

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true
}
```

When `deploy=true` is specified:

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "deploymentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployment successful"
      }
    ]
  }
}
```

#### Response Fields

| Field                              | Type    | Description                                       |
| ---------------------------------- | ------- | ------------------------------------------------- |
| success                            | boolean | Indicates if the request was successful           |
| deploymentResult                   | object  | Deployment result (only present when deploy=true) |
| deploymentResult.success           | boolean | Whether the overall deployment was successful     |
| deploymentResult.deploymentResults | array   | Per-environment deployment results                |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Endpoint identifier (name and httpMethod) must be provided in request body!"
}
```

or

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Endpoint with name (/api/users) and HTTP method (GET) is not found!"
}
```

#### Common Causes

* Missing `name` or `httpMethod` fields
* Endpoint with specified name and httpMethod does not exist
* Invalid field values

### Error Response (401 Unauthorized)

```json theme={null}
{
  "error": "unauthorized_client",
  "error_description": "Invalid token"
}
```

### Error Response (404 Not Found)

```json theme={null}
{
  "error": "not_found",
  "error_description": "ApiProxy (name: MyAPI) was not found!"
}
```

## cURL Example

### Example 1: Update Endpoint Description Only

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "/api/users",
    "httpMethod": "GET",
    "description": "Updated endpoint description"
  }'
```

### Example 2: Update Backend URL

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "/api/users",
    "httpMethod": "GET",
    "backendResourceUrl": "/users/v2",
    "backendHttpMethod": "GET"
  }'
```

### Example 3: Update Multiple Fields

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "/api/users",
    "httpMethod": "GET",
    "description": "Updated endpoint",
    "backendResourceUrl": "/users/v2"
  }'
```

### Example 4: Save and Deploy

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "/api/users",
    "httpMethod": "GET",
    "description": "Updated endpoint",
    "deploy": true,
    "deployTargetEnvironmentNameList": ["production"]
  }'
```

## Permissions

User must have **`API_MANAGEMENT` + `MANAGE`** permission in the project.

## Notes and Warnings

* **Endpoint Identifier**: `name` and `httpMethod` are required and used to identify the endpoint to update
* **Partial Updates**: Only provided fields (except `name` and `httpMethod`) are updated. Omitted fields remain unchanged
* **Unique Combination**: If updating `name` or `httpMethod`, ensure the new combination doesn't conflict with existing endpoints
* **Deploy**: When `deploy=true`, the API proxy is automatically deployed to the specified environments after saving

## Related Documentation

* [List Endpoints](/api-reference/api-proxies/endpoints/list-endpoints) - List all endpoints
* [Get Endpoint](/api-reference/api-proxies/endpoints/get-endpoint) - Get endpoint details
* [Create Endpoint](/api-reference/api-proxies/endpoints/create-endpoint) - Create a new endpoint
* [Delete Endpoint](/api-reference/api-proxies/endpoints/delete-endpoint) - Delete an endpoint
* [Update Endpoint Status](/api-reference/api-proxies/endpoints/update-endpoint-status) - Enable/disable endpoint
