Bring your own CA for mTLS (2)
Last updated Oct 16, 2026 This page explains how you can manage client certificates that have not been issued by Cloudflare CA. For a broader overview, refer to the mTLS at Cloudflare learning path.
Bring your own CA (BYOCA) is especially useful if you already have mTLS implemented and client certificates are already installed on devices.
Availability
- This feature is only available on Enterprise accounts.
- Each Enterprise account can upload up to five CAs. This quota does not apply to CAs uploaded through Cloudflare Access.
- The CA certificate quota is shared across API Shield, Workers mTLS, and Cloudflare Gateway.
- To increase this quota, contact your account team.
Note
If you exceed the CA certificate quota, the API returns error 1489 with the message "Hit maximum CA cert allocation." Contact your account team to request a quota increase.
Cloudflare Access uses a separate quota
CAs uploaded through Cloudflare Access use a separate quota that is not counted against the five-CA limit. If you see error 12130 ("maximum number of certificates has been reached") in Access, this relates to the Access certificate quota, not the BYOCA CA quota.
When to use BYOCA
BYOCA works well if:
- You already have an internal CA and client certificates are installed on your devices.
- You issue certificates at high volume or high churn — for example, one certificate per ephemeral virtual machine, container, or device. With BYOCA, Cloudflare stores only your CA certificate, not individual issued certificates, so there is no per-certificate quota.
- You want full control over certificate validity periods, key types, and revocation through your own CA tooling.
If you only have a small, stable set of devices or services to authenticate, the Cloudflare-managed CA is simpler to set up.
CA certificate requirements
When you upload your CA, Cloudflare validates the certificate according to certain requirements.
- The CA certificate can be from a publicly trusted CA or self-signed.
- In the certificate
Basic Constraints, the attributeCAmust be set toTRUE. - The certificate must use one of the signature algorithms listed below:<details><summary>
Allowed signature algorithms</summary>
<code>x509.SHA1WithRSA</code>
<code>x509.SHA256WithRSA</code>
<code>x509.SHA384WithRSA</code>
<code>x509.SHA512WithRSA</code>
<code>x509.ECDSAWithSHA1</code>
<code>x509.ECDSAWithSHA256</code>
<code>x509.ECDSAWithSHA384</code>
<code>x509.ECDSAWithSHA512</code></details>
Note
Uploading the CA private key is only required if you wish to use Zero Trust's block page. To upload your own CA with the private key, use the Upload mTLS certificate endpoint.
Set up mTLS with your CA
If your client certificates are issued by an intermediate CA, upload the full CA chain (the Intermediate CA followed by the Root CA) in a single PEM file. Refer to Upload the CA certificate, not a leaf certificate.
- In the Cloudflare dashboard, go to the Client Certificates page. Go to Client Certificates ↗
- Select Add Certificate.
- In the Certificate Authority dropdown, select Bring your own CA.
- Upload your CA certificate file (PEM encoded) and enter a name for the CA.
- Select Continue.
- On the Associate Hostnames page, enter the hostname that should use this CA for mTLS validation and select Add for each one. You can also skip this step and associate hostnames later.
-
Select Save to confirm.
-
Use the Upload mTLS certificate endpoint to upload the CA root certificate.
-
caboolean required - Set to
trueto indicate that the certificate is a CA certificate. certificatesstring required- Insert content from the
.pemfile associated with the CA certificate, formatted as a single string with\nreplacing the line breaks. namestring optional- Indicate a unique name for your CA certificate.
private_keystring optional-
Insert content from the
.pemfile associated with the private key for the certificate, formatted as a single string with\nreplacing the line breaks. -
Take note of the certificate ID (
id) that is returned in the API response. -
Use the Replace Hostname Associations endpoint to enable mTLS in each hostname that should use the CA for mTLS validation. Use the following parameters:
-
hostnamesarray required -
List the hostnames that will be using the CA for client certificate validation.
Caution
Submitting an empty array will remove all hostname associations. -
mtls_certificate_idstring required - Indicate the certificate ID obtained from the previous step.Caution
If no
mtls_certificate_idis provided, the action will be performed against the Cloudflare-managed CA. -
(Optional) Make a GET request to confirm the CA hostname associations.
After uploading the CA and associating hostnames, create a custom rule to enforce client certificate validation. You can do this via the dashboard or via API.
"expression": "(http.host in {\"<HOSTNAME_1>\" \"<HOSTNAME_2>\"} and not cf.tls_client_auth.cert_verified)",
"action": "block"
Note
When using CNAME records, enforce mTLS on the specific hostname where it should be checked. It is not enough to have it set on the CNAME target.
Multiple CAs for one hostname
There can be multiple CAs (Cloudflare-managed or BYOCA) associated with the same hostname. For BYOCA certificates, the most recently deployed certificate will be prioritized.
If you wish to remove the association from the Cloudflare-managed certificate and only use your BYOCA certificate(s):
- In the Cloudflare dashboard, go to the Client Certificates page. Go to Client Certificates ↗
- On the Hosts section under Cloudflare-issued Client Certificates, select Edit.
- Select the cross next to the hostname you want to remove.
-
Select Save to confirm.
-
List the hostname associations without the
mtls_certificate_idparameter.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>SSL and Certificates Write</code>
- <code>SSL and Certificates Read</code>
</details>
List Hostname Associationsbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/certificate_authorities/hostname_associations" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
- Copy the
hostnamesarray returned by the API and update it, removing the hostname that should no longer use the Cloudflare-managed CA. - Use the Replace Hostname Associations endpoint without the
mtls_certificate_idparameter to perform the action against the Cloudflare-managed CA. Forhostnamesuse the list from the previous step.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>SSL and Certificates Write</code>
</details>
Replace Hostname Associationsbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/certificate_authorities/hostname_associations" \
--request PUT \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"hostnames": [
"<UPDATED_HOSTNAME_ASSOCIATIONS>"
]
}'
Delete an uploaded CA
If you want to remove a CA that you have previously uploaded, you must first remove any hostname associations that it has.
- In the Cloudflare dashboard, go to the Client Certificates page. Go to Client Certificates ↗
- Select the BYOCA tab.
- Find the CA you want to delete and select the three dots next to it.
- Remove all associated hostnames first, if any exist.
-
Select the delete option and confirm.
-
Make a request to the Replace Hostname Associations endpoint, with an empty array for
hostnamesand specifying your CA certificate ID inmtls_certificate_id:
"hostnames": [],
"mtls_certificate_id": "<CERTIFICATE_ID>"
- Use the Delete mTLS certificate endpoint to delete the certificate.
List CA hostname associations
- In the Cloudflare dashboard, go to the Client Certificates page. Go to Client Certificates ↗
- Select the BYOCA tab.
- Find the CA you want to inspect and select the three dots next to it.
- Select Edit hostnames. The Certificate Details panel displays the associated hostnames.
Use the List Hostname Associations endpoint with the mtls_certificate_id query parameter set to the certificate ID of the uploaded CA.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>SSL and Certificates Write</code>
- <code>SSL and Certificates Read</code>
</details>
List Hostname Associationsbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/certificate_authorities/hostname_associations?mtls_certificate_id=ID_FROM_STEP_2" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ssl/client-certificates/byo-ca/#page","headline":"Bring your own CA for mTLS","description":"Cloudflare mTLS now supports client certificates that have not been issued by Cloudflare CA. Learn how you can bring your own CA and use it with Cloudflare mTLS.","url":"https://developers.cloudflare.com/ssl/client-certificates/byo-ca/","inLanguage":"en","image":"https://developers.cloudflare.com/ssl/client-certificates/byo-ca/og.png?v=c020e73e6b5686bc","dateModified":"2026-10-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["mTLS"]}
description: Set up mTLS authentication rules to require client certificates for API hosts. title: Configure mTLS image: https://developers.cloudflare.com/api-shield/security/mtls/configure/og.png?v=c33eefe4e6db8977
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/api-shield/llms.txt
Use this file to discover all available pages before exploring further.
Docs