SSL API
The SSL API provides endpoints for managing SSL certificates.
Base URL
https://your-domain.com/api/ssl
Endpoints
List SSL Certificates
Get a list of all SSL certificates.
Endpoint: GET /
Headers: Authorization: Bearer <token>
Query Parameters:
page
(number): Page number (default: 1)limit
(number): Items per page (default: 20)search
(string): Search term
Response:
{
"success": true,
"data": {
"certificates": [
{
"id": 1,
"domainId": 1,
"domainName": "example.com",
"provider": "letsencrypt",
"status": "active",
"issuedAt": "2023-01-01T00:00:00Z",
"expiresAt": "2023-04-01T00:00:00Z",
"autoRenew": true,
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1,
"pages": 1
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Get SSL Certificate
Get a specific SSL certificate by ID.
Endpoint: GET /:id
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"data": {
"id": 1,
"domainId": 1,
"domainName": "example.com",
"provider": "letsencrypt",
"status": "active",
"issuedAt": "2023-01-01T00:00:00Z",
"expiresAt": "2023-04-01T00:00:00Z",
"autoRenew": true,
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"privateKey": "-----BEGIN PRIVATE KEY-----\n...",
"certificateChain": "-----BEGIN CERTIFICATE-----\n...",
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Issue SSL Certificate
Issue a new SSL certificate.
Endpoint: POST /issue
Headers: Authorization: Bearer <token>
Request Body:
{
"domainId": 1,
"provider": "letsencrypt",
"email": "admin@example.com",
"autoRenew": true
}
2
3
4
5
6
Response:
{
"success": true,
"data": {
"id": 1,
"domainId": 1,
"domainName": "example.com",
"provider": "letsencrypt",
"status": "pending",
"issuedAt": null,
"expiresAt": null,
"autoRenew": true,
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Renew SSL Certificate
Renew an SSL certificate.
Endpoint: POST /:id/renew
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"message": "Certificate renewal initiated"
}
2
3
4
Revoke SSL Certificate
Revoke an SSL certificate.
Endpoint: POST /:id/revoke
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"message": "Certificate revoked successfully"
}
2
3
4
Upload Custom Certificate
Upload a custom SSL certificate.
Endpoint: POST /upload
Headers: Authorization: Bearer <token>
Request Body:
{
"domainId": 1,
"certificate": "-----BEGIN CERTIFICATE-----\n...",
"privateKey": "-----BEGIN PRIVATE KEY-----\n...",
"certificateChain": "-----BEGIN CERTIFICATE-----\n...",
"autoRenew": false
}
2
3
4
5
6
7
Response:
{
"success": true,
"data": {
"id": 1,
"domainId": 1,
"domainName": "example.com",
"provider": "custom",
"status": "active",
"issuedAt": "2023-01-01T00:00:00Z",
"expiresAt": "2023-04-01T00:00:00Z",
"autoRenew": false,
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Error Responses
All endpoints may return the following error responses:
404 Not Found
{
"success": false,
"error": "Certificate not found"
}
2
3
4
422 Validation Error
{
"success": false,
"error": "Validation failed",
"details": {
"domainId": "Domain ID is required",
"certificate": "Certificate is required"
}
}
2
3
4
5
6
7
8