Table of Contents

Interface ICustomHostnamesApi

Namespace
Cloudflare.NET.Zones.CustomHostnames
Assembly
Cloudflare.NET.dll

Defines the contract for managing Custom Hostnames (Cloudflare for SaaS) at the zone level.

Custom Hostnames allow SaaS providers to extend Cloudflare's security and performance benefits to their customers' vanity domains.

public interface ICustomHostnamesApi

Methods

CreateAsync(string, CreateCustomHostnameRequest, CancellationToken)

Creates a new custom hostname for the specified zone.

Task<CustomHostname> CreateAsync(string zoneId, CreateCustomHostnameRequest request, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

request CreateCustomHostnameRequest

The request containing the custom hostname configuration.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<CustomHostname>

The created custom hostname with its initial status and SSL information.

DeleteAsync(string, string, CancellationToken)

Deletes a custom hostname and any associated SSL certificates.

Task DeleteAsync(string zoneId, string customHostnameId, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

customHostnameId string

The ID of the custom hostname to delete.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

DeleteFallbackOriginAsync(string, CancellationToken)

Deletes the fallback origin configuration for the zone.

Task DeleteFallbackOriginAsync(string zoneId, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

GetAsync(string, string, CancellationToken)

Gets the details of a specific custom hostname.

Task<CustomHostname> GetAsync(string zoneId, string customHostnameId, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

customHostnameId string

The ID of the custom hostname to retrieve.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<CustomHostname>

The custom hostname details including current status and SSL information.

GetFallbackOriginAsync(string, CancellationToken)

Gets the fallback origin for custom hostnames in the zone.

Task<FallbackOrigin> GetFallbackOriginAsync(string zoneId, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<FallbackOrigin>

The fallback origin configuration.

Remarks

The fallback origin is the default origin server used when a custom hostname does not have a specific custom_origin_server configured.

ListAllAsync(string, ListCustomHostnamesFilters?, CancellationToken)

Lists all custom hostnames for the specified zone, automatically handling pagination.

IAsyncEnumerable<CustomHostname> ListAllAsync(string zoneId, ListCustomHostnamesFilters? filters = null, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

filters ListCustomHostnamesFilters

Optional filters to apply. Pagination parameters (Page, PerPage) will be managed automatically.

cancellationToken CancellationToken

A cancellation token.

Returns

IAsyncEnumerable<CustomHostname>

An asynchronous stream of all custom hostnames matching the criteria.

ListAsync(string, ListCustomHostnamesFilters?, CancellationToken)

Lists custom hostnames for the specified zone, allowing for manual pagination control.

Task<PagePaginatedResult<CustomHostname>> ListAsync(string zoneId, ListCustomHostnamesFilters? filters = null, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

filters ListCustomHostnamesFilters

Optional filters to apply, including pagination parameters.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<PagePaginatedResult<CustomHostname>>

A single page of custom hostnames along with pagination information.

Remarks

This method is intended for developers who need to control the pagination process manually. Use the properties of the returned PagePaginatedResult<T> to determine if there are more pages and to construct the filter for the next call.

UpdateAsync(string, string, UpdateCustomHostnameRequest, CancellationToken)

Updates an existing custom hostname.

Task<CustomHostname> UpdateAsync(string zoneId, string customHostnameId, UpdateCustomHostnameRequest request, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

customHostnameId string

The ID of the custom hostname to update.

request UpdateCustomHostnameRequest

The request containing the fields to update.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<CustomHostname>

The updated custom hostname.

Remarks

This is a PATCH operation. Only the properties set in the request will be updated. Sending a PATCH request can also be used to refresh the validation status.

UpdateFallbackOriginAsync(string, UpdateFallbackOriginRequest, CancellationToken)

Updates the fallback origin for custom hostnames in the zone.

Task<FallbackOrigin> UpdateFallbackOriginAsync(string zoneId, UpdateFallbackOriginRequest request, CancellationToken cancellationToken = default)

Parameters

zoneId string

The ID of the zone.

request UpdateFallbackOriginRequest

The request containing the new fallback origin.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<FallbackOrigin>

The updated fallback origin configuration.

See Also