---
schema_version: "1"
id: 24b21dbb975ff9990bceb025dd6b68d65b93c6619ba9e6bfa76bc1b8eb675f7c
title: Using Certificates with HTTP Requests
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_callouts_client_certs_http.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_client_certs_http.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 34e49b09383584cf8042e569d1a0a0ab4480b54616f6976f98fe2d48eeb8474c
---
# Using Certificates with HTTP Requests

After you have generated a certificate in Salesforce, you can use it to support two-way authentication for a callout to an HTTP request.

To integrate the certificate with your Apex:

1. [Generate a certificate](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_client_certs_generate.htm). Note the Unique Name of the certificate.
2. In your Apex, use the setClientCertificateName method of the HttpRequest class. The value used for the argument for this method must match the Unique Name of the certificate that you generated in the previous step.

The following example illustrates the last step of the previous procedure. This example assumes that you previously generated a certificate with a Unique Name of DocSampleCert.

HttpRequest req = new HttpRequest();
req.setClientCertificateName('DocSampleCert');

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_client_certs_soap.htm "Using Certificates with SOAP Services")