# Certificate Authorities # Hostname Associations ## List Hostname Associations `client.certificateAuthorities.hostnameAssociations.get(HostnameAssociationGetParamsparams, RequestOptionsoptions?): HostnameAssociationGetResponse` **get** `/zones/{zone_id}/certificate_authorities/hostname_associations` List Hostname Associations ### Parameters - `params: HostnameAssociationGetParams` - `zone_id: string` Path param: Identifier. - `mtls_certificate_id?: string` Query param: The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA. ### Returns - `HostnameAssociationGetResponse` - `hostnames?: Array` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameAssociation = await client.certificateAuthorities.hostnameAssociations.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(hostnameAssociation.hostnames); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "hostnames": [ "api.example.com" ] } } ``` ## Replace Hostname Associations `client.certificateAuthorities.hostnameAssociations.update(HostnameAssociationUpdateParamsparams, RequestOptionsoptions?): HostnameAssociationUpdateResponse` **put** `/zones/{zone_id}/certificate_authorities/hostname_associations` Replace Hostname Associations ### Parameters - `params: HostnameAssociationUpdateParams` - `zone_id: string` Path param: Identifier. - `hostnames?: Array` Body param - `mtls_certificate_id?: string` Body param: The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA. ### Returns - `HostnameAssociationUpdateResponse` - `hostnames?: Array` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hostnameAssociation = await client.certificateAuthorities.hostnameAssociations.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(hostnameAssociation.hostnames); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "hostnames": [ "api.example.com" ] } } ``` ## Domain Types ### Hostname Association - `HostnameAssociation = string` ### TLS Hostname Association - `TLSHostnameAssociation` - `hostnames?: Array` - `mtls_certificate_id?: string` The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA. ### Hostname Association Get Response - `HostnameAssociationGetResponse` - `hostnames?: Array` ### Hostname Association Update Response - `HostnameAssociationUpdateResponse` - `hostnames?: Array`