# Certificate Authorities # Hostname Associations ## List Hostname Associations `certificate_authorities.hostname_associations.get(HostnameAssociationGetParams**kwargs) -> HostnameAssociationGetResponse` **get** `/zones/{zone_id}/certificate_authorities/hostname_associations` List Hostname Associations ### Parameters - `zone_id: str` Identifier. - `mtls_certificate_id: Optional[str]` 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 - `class HostnameAssociationGetResponse: …` - `hostnames: Optional[List[HostnameAssociation]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_association = client.certificate_authorities.hostname_associations.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(hostname_association.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 `certificate_authorities.hostname_associations.update(HostnameAssociationUpdateParams**kwargs) -> HostnameAssociationUpdateResponse` **put** `/zones/{zone_id}/certificate_authorities/hostname_associations` Replace Hostname Associations ### Parameters - `zone_id: str` Identifier. - `hostnames: Optional[SequenceNotStr[HostnameAssociation]]` - `mtls_certificate_id: Optional[str]` 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 - `class HostnameAssociationUpdateResponse: …` - `hostnames: Optional[List[HostnameAssociation]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) hostname_association = client.certificate_authorities.hostname_associations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(hostname_association.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 - `str` ### TLS Hostname Association - `class TLSHostnameAssociation: …` - `hostnames: Optional[List[HostnameAssociation]]` - `mtls_certificate_id: Optional[str]` 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 - `class HostnameAssociationGetResponse: …` - `hostnames: Optional[List[HostnameAssociation]]` ### Hostname Association Update Response - `class HostnameAssociationUpdateResponse: …` - `hostnames: Optional[List[HostnameAssociation]]`