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

# Create an API Endpoint

> Create a new API endpoint within an API collection

# Create an API Endpoint

Create a new API endpoint within an API collection.

## Body Parameters

<ParamField body="name" type="string" required>
  Name of the API endpoint. Must be unique within the parent API collection.
</ParamField>

<ParamField body="apiCollection" type="string" required>
  Fully qualified name of the parent APICollection (e.g., `sample_api_service.pet`).
</ParamField>

<ParamField body="endpointURL" type="string">
  URL for the API endpoint (e.g., `https://petstore3.swagger.io/#/pet/addPet`).
</ParamField>

<ParamField body="requestMethod" type="string">
  HTTP request method: `GET`, `POST`, `PUT`, `PATCH`, or `DELETE`.
</ParamField>

<ParamField body="requestSchema" type="object">
  Schema describing the request body.

  <Expandable title="properties">
    <ParamField body="schemaType" type="string">
      Type of schema (e.g., `JSON`).
    </ParamField>

    <ParamField body="schemaFields" type="array">
      Array of field objects describing the schema.

      <Expandable title="properties">
        <ParamField body="name" type="string">
          Name of the field.
        </ParamField>

        <ParamField body="dataType" type="string">
          Data type of the field (e.g., `INT`, `STRING`, `OBJECT`).
        </ParamField>

        <ParamField body="description" type="string">
          Description of the field.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="responseSchema" type="object">
  Schema describing the response body.

  <Expandable title="properties">
    <ParamField body="schemaType" type="string">
      Type of schema (e.g., `JSON`).
    </ParamField>

    <ParamField body="schemaFields" type="array">
      Array of field objects describing the schema.

      <Expandable title="properties">
        <ParamField body="name" type="string">
          Name of the field.
        </ParamField>

        <ParamField body="dataType" type="string">
          Data type of the field.
        </ParamField>

        <ParamField body="description" type="string">
          Description of the field.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="displayName" type="string">
  Human-readable display name for the API endpoint.
</ParamField>

<ParamField body="description" type="string">
  Description of the API endpoint in Markdown format.
</ParamField>

<ParamField body="owners" type="array">
  Array of owner references (users or teams) to assign to the API endpoint.

  <Expandable title="properties">
    <ParamField body="id" type="string">
      UUID of the owner entity.
    </ParamField>

    <ParamField body="type" type="string">
      Type of owner entity (e.g., `user`, `team`).
    </ParamField>

    <ParamField body="name" type="string">
      Name of the owner entity.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="domain" type="string">
  Fully qualified name of the domain to assign for governance purposes.
</ParamField>

<ParamField body="tags" type="array">
  Array of classification tags to apply to the API endpoint.

  <Expandable title="properties">
    <ParamField body="tagFQN" type="string" required>
      Fully qualified name of the tag.
    </ParamField>

    <ParamField body="labelType" type="string">
      Type of label (e.g., `Manual`, `Derived`, `Propagated`).
    </ParamField>

    <ParamField body="state" type="string">
      State of the tag (e.g., `Suggested`, `Confirmed`).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="extension" type="object">
  Custom property values defined by your organization's metadata schema.
</ParamField>

<RequestExample dropdown>
  ```python POST /v1/apiEndpoints theme={null}
  from metadata.sdk import configure
  from metadata.sdk.entities import APIEndpoints
  from metadata.generated.schema.api.data.createAPIEndpoint import CreateAPIEndpointRequest

  configure(
      host="https://your-company.open-metadata.org/api",
      jwt_token="your-jwt-token"
  )

  request = CreateAPIEndpointRequest(
      name="addPet",
      displayName="Add Pet",
      apiCollection="sample_api_service.pet",
      description="Add a new pet to the store",
      endpointURL="https://petstore3.swagger.io/#/pet/addPet",
      requestMethod="POST",
      requestSchema={
          "schemaType": "JSON",
          "schemaFields": [
              {"name": "id", "dataType": "INT", "description": "ID of pet"}
          ]
      }
  )

  endpoint = APIEndpoints.create(request)
  print(f"Created: {endpoint.fullyQualifiedName}")
  ```

  ```java POST /v1/apiEndpoints theme={null}
  import static org.openmetadata.sdk.fluent.APIEndpoints.*;

  // Create using builder pattern
  var endpoint = APIEndpoints.builder()
      .name("addPet")
      .displayName("Add Pet")
      .apiCollection("sample_api_service.pet")
      .description("Add a new pet to the store")
      .endpointURL("https://petstore3.swagger.io/#/pet/addPet")
      .requestMethod("POST")
      .create();
  ```

  ```bash POST /v1/apiEndpoints theme={null}
  curl -X POST "{base_url}/api/v1/apiEndpoints" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "addPet",
      "displayName": "Add Pet",
      "apiCollection": "sample_api_service.pet",
      "description": "add a new pet",
      "endpointURL": "https://petstore3.swagger.io/#/pet/addPet",
      "requestMethod": "POST",
      "requestSchema": {
        "schemaType": "JSON",
        "schemaFields": [
          {"name": "id", "dataType": "INT", "description": "ID of pet"}
        ]
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "1f61427a-4a64-4070-9ac8-1d29302dac7c",
    "name": "addPet",
    "displayName": "Add Pet",
    "fullyQualifiedName": "sample_api_service.pet.addPet",
    "description": "add a new pet",
    "version": 0.1,
    "updatedAt": 1769982733987,
    "updatedBy": "admin",
    "endpointURL": "https://petstore3.swagger.io/#/pet/addPet",
    "requestMethod": "POST",
    "requestSchema": {
      "schemaType": "JSON",
      "schemaFields": [
        {"name": "id", "dataType": "INT", "description": "ID of pet"}
      ]
    },
    "href": "http://localhost:8585/api/v1/apiEndpoints/1f61427a-4a64-4070-9ac8-1d29302dac7c",
    "owners": [],
    "tags": [],
    "service": {
      "id": "58d413a8-abc3-4a6d-bd8a-13a0234b1ff8",
      "type": "apiService",
      "name": "sample_api_service",
      "deleted": false
    },
    "serviceType": "Rest",
    "deleted": false,
    "domains": []
  }
  ```
</ResponseExample>

***

## Returns

Returns the created API endpoint object with all specified properties and system-generated fields.

## Response

<ResponseField name="id" type="string">
  Unique identifier for the API endpoint (UUID format).
</ResponseField>

<ResponseField name="name" type="string">
  API endpoint name.
</ResponseField>

<ResponseField name="fullyQualifiedName" type="string">
  Fully qualified name in format `service.collection.endpointName`.
</ResponseField>

<ResponseField name="displayName" type="string">
  Human-readable display name.
</ResponseField>

<ResponseField name="description" type="string">
  Description of the API endpoint in Markdown format.
</ResponseField>

<ResponseField name="endpointURL" type="string">
  URL for the API endpoint.
</ResponseField>

<ResponseField name="requestMethod" type="string">
  HTTP request method (GET, POST, PUT, PATCH, DELETE).
</ResponseField>

<ResponseField name="requestSchema" type="object">
  Schema describing the request body.

  <Expandable title="properties">
    <ResponseField name="schemaType" type="string">
      Type of schema (e.g., JSON).
    </ResponseField>

    <ResponseField name="schemaFields" type="array">
      Array of field definitions.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="responseSchema" type="object">
  Schema describing the response body.

  <Expandable title="properties">
    <ResponseField name="schemaType" type="string">
      Type of schema (e.g., JSON).
    </ResponseField>

    <ResponseField name="schemaFields" type="array">
      Array of field definitions.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="service" type="object">
  Reference to the parent API service.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the API service.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of entity (always `apiService`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the API service.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="serviceType" type="string">
  Type of API service (e.g., Rest).
</ResponseField>

<ResponseField name="owners" type="array" optional>
  List of owners assigned to the API endpoint.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the owner entity.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of owner entity (e.g., `user`, `team`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the owner entity.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="domains" type="array" optional>
  Domain assignments for governance.
</ResponseField>

<ResponseField name="tags" type="array" optional>
  Classification tags applied to the API endpoint.

  <Expandable title="properties">
    <ResponseField name="tagFQN" type="string">
      Fully qualified name of the tag.
    </ResponseField>

    <ResponseField name="labelType" type="string">
      Type of label (e.g., `Manual`, `Derived`, `Propagated`).
    </ResponseField>

    <ResponseField name="state" type="string">
      State of the tag (e.g., `Suggested`, `Confirmed`).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="extension" type="object" optional>
  Custom property values defined by your organization's metadata schema.
</ResponseField>

<ResponseField name="version" type="number">
  Version number for the entity (starts at 0.1).
</ResponseField>

***

## Create or Update (PUT)

Use `PUT /v1/apiEndpoints` instead of `POST` to perform an upsert. If an API endpoint with the same `fullyQualifiedName` already exists, it will be updated; otherwise, a new API endpoint is created. The request body is the same as `POST`.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/apiEndpoints" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ ... same body as POST ... }'
```

<Note>
  `PUT` will not return a `409` conflict error if the entity already exists -- it will update the existing entity instead.
</Note>

***

## Bulk Create or Update (PUT)

Use `PUT /v1/apiEndpoints/bulk` to create or update multiple API endpoints in a single request. The request body is an array of create request objects.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/apiEndpoints/bulk" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "addPet", "apiCollection": "sample_api_service.pet", "requestMethod": "POST" },
    { "name": "getPet", "apiCollection": "sample_api_service.pet", "requestMethod": "GET" }
  ]'
```

***

## Error Handling

| Code  | Error Type              | Description                                                          |
| ----- | ----------------------- | -------------------------------------------------------------------- |
| `400` | `BAD_REQUEST`           | Invalid request body or missing required fields                      |
| `401` | `UNAUTHORIZED`          | Invalid or missing authentication token                              |
| `403` | `FORBIDDEN`             | User lacks permission to create API endpoints                        |
| `409` | `ENTITY_ALREADY_EXISTS` | API endpoint with same name already exists in collection (POST only) |
