# WithOpenApiEndpoint

- Module: [Aspire.Hosting.Azure.ApiManagement](/reference/api/go/aspire.hosting.azure.apimanagement.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`AzureApiManagementApiResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementapiresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Imports an OpenAPI document exposed by the API's target compute resource.

## Remarks

Azure API Management retrieves linked documents through its control plane, so the selected endpoint must be
externally reachable during deployment. Use `WithOpenApiDocument` for private backends.
An API can have only one OpenAPI source: either a document file or an endpoint.
Repeating the same source configuration is allowed; configuring a different source throws.

## Definition

```go
func (AzureApiManagementApiResource) WithOpenApiEndpoint(options ...*WithOpenApiEndpointOptions) AzureApiManagementApiResource
```

## Parameters

- `options` (`...*WithOpenApiEndpointOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithOpenApiEndpointOptions` argument.

- `DocumentPath` (`*string`) -- The absolute path of the OpenAPI endpoint, such as `/openapi/v1.json`.
- `EndpointName` (`*string`) -- The target endpoint name. An external HTTP or HTTPS endpoint is selected when omitted.
- `Format` ([`*AzureApiManagementOpenApiFormat`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementopenapiformat.md)) -- The document format. The endpoint path extension is used when omitted.

## Returns

[`AzureApiManagementApiResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementapiresource.md) -- The API Management API resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzureApiManagementApiResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementapiresource.md)
