POST | Import SSL certificate

Prev Next

Imports an SSL certificate into the system.

  • Endpoint: /api/certificate/import
  • Method: POST
  • Request: POST /api/certificate/import

Request parameters

Parameter Type Required Description
certificate string Yes Base64-encoded certificate file.
private_key string No Base64-encoded private key file. If empty, the key won't be available in the system, limiting certificate use, publication, and device association. Note: .pfx extension already includes a private key.
password string No Password to retrieve the corresponding certificate.
revoke_password string No Password to revoke the associated SSL certificate.
extension string Yes Certificate file extension.

Example using cURL

curl -X POST https://[segura_vault_url]/api/certificate/import \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "certificate": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVCVENDQW...",
    "private_key": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2UUlCQU...",
    "password": "certpass123",
    "revoke_password": "revokepass456",
    "extension": "crt"
  }'

Response

{
  "status": 200,
  "message": "Certificate imported successfully",
  "error": false,
  "code_certificate": 789,
  "common_name": "api.example.com",
  "issuer": "GlobalSign",
  "validity_start": "2024-01-15",
  "validity_end": "2025-01-15"
}

Error responses

HTTP Status Code Description
400 Bad Request Invalid parameters provided.
401 Unauthorized Unauthorized access.
403 Forbidden Forbidden access.
404 Not Found Resource not found.
500 Internal Server Error Internal server error. For example: invalid or empty certificate or private key.