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

# Create Endpoint

> Creates a new REST endpoint (API method) in an API proxy. This operation is only available for REST API proxies.

## Endpoint

```
POST /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 (must be REST type) |

### Request Body

#### Full JSON Body Example

```json theme={null}
{
  "name": "/api/users",
  "description": "Get all users",
  "httpMethod": "GET",
  "backendResourceUrl": "/users",
  "backendHttpMethod": "GET"
}
```

#### Request Body Fields

| Field              | Type   | Required | Default | Description                                         |
| ------------------ | ------ | -------- | ------- | --------------------------------------------------- |
| name               | string | Yes      | -       | Endpoint path/name (must be unique with httpMethod) |
| description        | string | No       | -       | Endpoint description                                |
| httpMethod         | string | Yes      | -       | HTTP method for the endpoint                        |
| backendResourceUrl | string | Yes      | -       | Backend resource URL                                |
| backendHttpMethod  | string | Yes      | -       | HTTP method for backend call                        |

### EnumHttpRequestMethod

* `GET` - GET method
* `POST` - POST method
* `PUT` - PUT method
* `DELETE` - DELETE method
* `PATCH` - PATCH method
* `OPTIONS` - OPTIONS method
* `HEAD` - HEAD method
* `TRACE` - TRACE method
* `ALL` - All methods

## Response

### Success Response (200 OK)

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

#### Response Fields

| Field   | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| success | boolean | Indicates if the request was successful |

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Endpoint can only be added to REST API Proxies!"
}
```

#### Common Causes

* API Proxy is not REST type (SOAP proxies don't support manual endpoint creation)
* Endpoint name and HTTP method combination already exists
* Missing required fields (name, httpMethod, backendResourceUrl, backendHttpMethod)
* Invalid HTTP method 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: Create GET Endpoint

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

### Example 2: Create POST Endpoint

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

### Example 3: Create Endpoint with Different Backend Method

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

## Permissions

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

## Notes and Warnings

* **REST Only**: Endpoints can only be added to REST API proxies. SOAP endpoints are defined in the WSDL
* **Unique Combination**: The combination of `name` and `httpMethod` must be unique within the API proxy
* **Default Active**: New endpoints are created with `active: true` by default
* **Backend URL**: The `backendResourceUrl` can be a relative path or absolute URL

## 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
* [Update Endpoint](/api-reference/api-proxies/endpoints/update-endpoint) - Update an endpoint
* [Delete Endpoint](/api-reference/api-proxies/endpoints/delete-endpoint) - Delete an endpoint
