GET Certificates CSV

The GET /Certificates/CSV method is used to create output, in a CSV format, of certificates from Keyfactor Command that match the query criteria provided in the request. The content will display in the response body and can be copied from there for use in a file, as needed. This method returns HTTP 200 OK on a success with a comma-delimited list of certificates plus a header line that can be copied to a CSV file.

Tip:  The following permissions (see Security Roles and Claims) are required to use this feature:
/certificates/collections/read/
OR
/certificates/collections/read/#/ (where # is a reference to a specific certificate collection ID—see CollectionID, below)

Permissions for certificates can be configured at multiple levels. You can apply them system-wide—for all certificates—or use fine-grained control by assigning permissions at the certificate collectionClosed The certificate search function allows you to query the Keyfactor Command database for certificates from any available source based on any criteria of the certificates and save the results as a collection that will be availble in other places in the Management Portal (e.g. expiration alerts and certain reports). level. The appropriate level depends on how the certificates are accessed. See Certificate Collection Permissions for more information about system-wide versus more targeted permission models.

Important:  Selecting a large number of certificates to retrieve in CSV format can result in timeouts when attempting to download. Certificate queries can be used to limit the results to a management amount of data.

Table 323: GET Certificates CSV Input Parameters

Name In Description
SortName Query A string containing the property by which the results should be sorted. Fields available for sorting through the API for the most part match those that appear as sortable columns in the Keyfactor Command Management Portal. The default sort field is Import Date.
SortOrder Query An integer that sets the sort order on the returned results. A value of 0 sorts results in ascending order while a value of 1 sorts results in descending order. The default is ascending.
Query Query A string query, to limit the requested set of certificates, in the form:
CN –contains "mycertificate.keyexample.com"

See Certificate Search Page for querying guidelines to build your body query.

CollectionId Query

An optional integer that specifies the certificate collection (CollectionId) to validate whether the user has sufficient permissions to perform the action. If a CollectionId is not provided, the user must have appropriate permissions granted system-wide or via certificate store containers.

Providing a CollectionId allows the system to check the user's permissions at the certificate collection level. Permissions are evaluated in the following order:

  1. System-wide certificate permissions
  2. Granular certificate permissions

Use either ContainerId or CollectionId, not both. If both are specified, CollectionId takes precedence, and the ContainerId is ignored (defaults to 0).

See Certificate Collection Permissions for more information.

Table 324: GET Certificates CSV Response Data

Name Description
Content

A comma-delimited string of certificate data as per the criteria supplied. The following fields are included:

  • Issued DN

  • Import Date

  • Effective Date

  • Expiration Date

  • Issued CN

  • Certificate Authority Name

  • Template Display Name

  • Principal

  • Requester

  • Key Type

  • Key Size

  • Certificate State

  • Thumbprint

  • Serial Number

For example:

Copy
"Issued DN,Import Date,Effective Date,Expiration Date,Issued CN,Certificate Authority Name,Template Display Name,Principal,Requester,Key Type,Key Size,Certificate State,Thumbprint\r\n\
"CN=Root CA,DC=keyexample,DC=com\",\"2022-11-17T19:52:00.8900000Z\",\"2020-04-14T23:39:28.0000000Z\",\"2035-04-14T23:49:28.0000000Z\",\"Root CA\",\"CN=Root CA,DC=keyexample,DC=com\",\"\",\"\",\"KEYEXAMPLE\\SQL241$\",\"RSA\",\"2048\",\"CertificateAuthority\",\"6DEA35B694F008B7DD69AE88B349B2FFD8AFF503\",\r\n\
"CN=dc240.keyexample.com\",\"2022-11-17T19:52:01.2230000Z\",\"2020-04-15T03:58:35.0000000Z\",\"2021-04-15T03:58:35.0000000Z\",\"dc240.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"DomainController\",\"\",\"KEYEXAMPLE\\DC240$\",\"RSA\",\"2048\",\"Active\",\"2F2407C5329C646AC75834EAACE65DBF70F8FB1B\",\r\n\
"CN=sql241.keyexample.com\",\"2022-11-17T19:52:01.2530000Z\",\"2020-04-15T14:50:52.0000000Z\",\"2022-04-15T14:50:52.0000000Z\",\"sql241.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"EnterpriseWebServer\",\"\",\"KEYEXAMPLE\\SQL241$\",\"RSA\",\"2048\",\"Active\",\"FEB56E1F076CFD2AEFE6969885F1CD59CBC839DB\",\r\n\
"CN=appsrvr09.keyexample.com\",\"2022-11-17T19:52:01.3000000Z\",\"2020-04-15T16:57:06.0000000Z\",\"2020-05-27T16:57:06.0000000Z\",\"appsrvr09.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"EnterpriseWebServer-ShortLifetime\",\"\",\"KEYEXAMPLE\\jsmith\",\"RSA\",\"2048\",\"Active\",\"D60EC19B68589885DC8BD60BAD7EC7E81BAC256B\",\r\n\
"CN=keyfactor243.keyexample.com\",\"2022-11-17T19:52:01.3330000Z\",\"2020-04-15T17:42:51.0000000Z\",\"2022-04-15T17:42:51.0000000Z\",\"keyfactor243.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"EnterpriseWebServer\",\"\",\"KEYEXAMPLE\\SRVR243$\",\"RSA\",\"2048\",\"Active\",\"BFA679661A7F40A507F9C518BE2A8CFF6D364AA0\",\r\n\
"CN=appsrvr25.keyexample.com,L=Independence,ST=OH,C=US\",\"2022-11-17T19:52:01.3630000Z\",\"2020-09-14T22:07:52.0000000Z\",\"2020-10-26T22:07:52.0000000Z\",\"appsrvr25.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"EnterpriseWebServer\",\"\",\"KEYEXAMPLE\\ggant\",\"RSA\",\"2048\",\"Active\",\"D48DAE96497B4995D27B10EBC4EA571DAE80E6C8\",\r\n\
"CN=appsrvr25.keyexample.com,L=Independence,ST=OH,C=US\",\"2022-11-17T19:52:01.3900000Z\",\"2020-09-14T22:23:51.0000000Z\",\"2020-10-26T22:23:51.0000000Z\",\"appsrvr25.keyexample.com\",\"CN=Root CA,DC=keyexample,DC=com\",\"EnterpriseWebServer\",\"\",\"KEYEXAMPLE\\jsmith\",\"RSA\",\"2048\",\"Active\",\"D3E5CC1A4DBEFF0CE14F2ADAF9B811B9B9306A1C\",\r\n\
Tip:  See the Keyfactor API Reference and Utility which provides a utility through which the Keyfactor APIClosed An API is a set of functions to allow creation of applications. Keyfactor offers the Keyfactor API, which allows third-party software to integrate with the advanced certificate enrollment and management features of Keyfactor Command. endpoints can be called and results returned. It is intended to be used primarily for validation, testing and workflowClosed A workflow is a series of steps necessary to complete a process. In Keyfactor Command, it refers to the workflow builder, which allows you to automate event-driven tasks such as when a certificate is requested, revoked or found in a certificate store. development. It also serves secondarily as documentation for the API. The link to the Keyfactor API Reference and Utility is in the dropdown from the help icon () at the top of the Management Portal page next to the Log Out button.