Import certificates

POST
https://one.digicert.com/iot/api/v1/certificate-import/{{enrollment_profile_id}}

Use this endpoint to import one or more certificates for an enrollment profile that uses the Certificate Import enrollment method.

Before you import certificates, you must set up source fields mapping in the enrollment profile. Then, when you import certificates, the files with your certificate data must use the same file type extension (.pem or .xml) as the file that you used to set up source fields mapping.

The request uses a content type of multipart/form-data. The body of the request is a compressed .zip file that contains one of the following:

  • One or more .pem certificate files for each certificate to upload.
  • An .xml file with the PEM-encoded certificate data for each certificate to upload. PEM-encoded data should not include line breaks or certificate headers and footers.

The XML data structure for importing certificates is as follows:

xml
<?xml version="1.0" encoding="UTF-8"?>

<certificates>
  <certificate>
    <pem>{{pem_data}}</pem>
  </certificate>
  <certificate>
    <pem>{{pem_data}}</pem>
  </certificate>
</certificates>

Example requests and responses

cURL
curl -X POST \ 
https://one.digicert.com/iot/api/v1/certificate-import/{{enrollment_profile_id}} \
-H 'x-api-key: {{api_key}}' \
-H 'content-type: multipart/form-data'
-F 'file=@/Users/path/to/file/certificates.xml.zip'
200 OK
{
    "id": "67a3957e-0a29-4470-b694-c03ce42ed449",
    "random_id": "687338079509",
    "enrollment_profile": {
        "id": "{{enrollment_profile_id}}",
        "name": "Enrollment Profile Cert Import"
    },
    "original_file_name": "certificates.xml.zip",
    "format": "XML",
    "original_size": 1042,
    "stored_file_name": "certificate-import-687338079509.zip",
    "created_at": "2020-08-11T20:25:31.943335Z",
    "status": "PENDING",
    "enrollment_context": {
        "enrollment_method": "CERTIFICATE_IMPORT",
        "ip_address": "10.42.1.190",
        "authorization": "",
        "auth_type": "BASIC"
    },
    "total_certificates": 3,
    "failed_certificates": 0,
    "processing_time": 0
}

Endpoint path parameters

Name Description
enrollment_profile_id ID of the enrollment profile to use for configuring the imported certificates. The enrollment profile must use the Certificate Import enrollment method.

Request parameters

Name Req/Opt Type Description
file required file Compressed .zip file that contains data for the certificates to import.

Response parameters

Name Type Description
id string Unique ID for the certificate import job.
random_id string Random ID associated with the certificate import job.
enrollment_profile object Details about the enrollment profile used for the imported certificates.
.. id string Enrollment profile ID.
.. name string Enrollment profile name.
original_file_name string Name of the uploaded file.
format string Format of the imported files.
Possible values: XML or PEM
original_size int Size of the uploaded file, in bytes.
stored_file_name string Name of the file after it is uploaded.
created_at string Timestamp for the beginning of the import job.
Format: ISO 8601 UTC (YYYY-MM-DDThh:mm:ss.ssssssZ)
status string Status of the import job.
Possible values: PENDING or COMPLETED
enrollment_context object Enrollment details for the imported certificates.
.. enrollment_method string Enrollment method for the imported certificates.
For imported certificates, enrollment method is always CERTIFICATE_IMPORT.
.. ip_address string IP address the client used for the certificate import job.
.. authorization string Authorization used for the certificate import job.
.. auth_type string Type of authorization used for the certificate import job.
total_certificates int Total number of certificates processed.
failed_certificates int Number of certificates that failed to import.
processing_time int Processing time of the import job, in milliseconds.