Create certificate

Create an SSL certificate for your site.


POST/api/servers/{server}/sites/{site}/certificates

Create certificate

This endpoint allows you to create an SSL certificate for your site.

Required parameters

  • Name
    type
    Type
    string
    Description

    The certificate type. Options: letsencrypt, custom.

  • Name
    certificate
    Type
    string
    Description

    For Let's Encrypt: the domain to request SSL for. For custom: the certificate contents.

Optional parameters

  • Name
    private
    Type
    string
    Description

    Required when type is custom. The private key for the certificate.

  • Name
    force
    Type
    boolean
    Description

    Force the request, bypassing validation from Ploi.

  • Name
    additional
    Type
    object
    Description

    Additional data for SSL request (DNS validation, wildcard certificates).

Request

POST
/api/servers/{server}/sites/{site}/certificates
curl -X POST "https://ploi.io/api/servers/{server}/sites/{site}/certificates" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"certificate": "domain.com", "type": "letsencrypt"}'

Wildcard certificate

curl -X POST "https://ploi.io/api/servers/{server}/sites/{site}/certificates" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "type": "letsencrypt",
    "certificate": "domain.com,*.domain.com",
    "additional": {
      "provider": "cloudflare",
      "key": "KEY",
      "secret": "SECRET"
    }
  }'

Response

{
  "data": {
    "id": 1,
    "status": "created",
    "domain": "domain.com",
    "type": "letsencrypt",
    "site_id": 1,
    "server_id": 1,
    "expires_at": null,
    "created_at": "2019-07-31 08:34:25"
  }
}