Imports an SSL certificate into the system.
- Endpoint:
/api/v1/certificates/import
- Method:
POST
- Request:
POST /api/v1/certificates/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/v1/certificates/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 |
Error message |
400 |
Missing extension parameter. |
401 |
Token expired. |
404 |
No token registered for the call. |
500 |
The certificate already exists. |
500 |
Invalid or empty certificate. |
500 |
Invalid private key. |
500 |
Empty private key. |