Laravel Forge JavaScript SDK

SSL Certificates

SSL Certificates

Create a certificate

Method

forge.ssl.create(server_id, site_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const certificate = await forge.ssl.create(server_id, site_id, payload);

Payload

1{
2 type: 'new',
3 domain: 'domain.com',
4 country: 'US',
5 state: 'NY',
6 city: 'New York',
7 organization: 'Company Name',
8 department: 'IT'
9}

Example Response

1{
2 "certificate": {
3 "domain": "domain.com",
4 "request_status": "creating",
5 "created_at": "2016-12-17 07:02:35",
6 "id": 3,
7 "existing": false,
8 "active": false
9 }
10}

Installing an existing certificate

Method

forge.ssl.installExisting(server_id, site_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const certificate = await forge.ssl.installExisting(
4 server_id,
5 site_id,
6 payload,
7);

Payload

1{
2 type: 'existing',
3 key: 'PRIVATE_KEY_HERE',
4 certificate: 'CERTIFICATE_HERE'
5}

Example Response

1{
2 "certificate": {
3 "domain": "domain.com",
4 "request_status": "creating",
5 "created_at": "2016-12-17 07:02:35",
6 "id": 3,
7 "existing": false,
8 "active": false
9 }
10}

Cloning an existing certificate

Method

forge.ssl.clone(server_id, site_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const clonedCertificate = await forge.ssl.clone(server_id, site_id, payload);

Payload

1{
2 type: 'clone',
3 certificate_id: 1
4}

Example Response

1{
2 "certificate": {
3 "domain": "domain.com",
4 "request_status": "creating",
5 "created_at": "2016-12-17 07:02:35",
6 "id": 3,
7 "existing": false,
8 "active": false
9 }
10}

Obtain a LetsEncrypt Certificate

Method

forge.ssl.letsencrypt(server_id, site_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3const letsEncrypt = await forge.ssl.letsencrypt(server_id, site_id, payload);

Payload

1{
2 domains: ['www.site.com'],
3 dns_provider: {
4 type: 'xxx',
5 cloudflare_api_token: 'xxx',
6 route53_key: 'xxx',
7 route53_secret: 'xxx',
8 digitalocean_token: 'xxx',
9 dnssimple_token: 'xxx',
10 linode_token: 'xxx',
11 ovh_endpoint: 'xxx',
12 ovh_app_key: 'xxx',
13 ovh_app_secret: 'xxx',
14 ovh_consumer_key: 'xxx',
15 google_credentials_file: 'xxx',
16 }
17}

The dns_provider object is only required for wildcard sub-domains.

DNS Provider Types

TypeExtra Fields
cloudflarecloudflare_api_token
route53route53_key and route53_secret
digitaloceandigitalocean_token
dnssimplednssimple_token
linodelinode_token
ovhovh_endpoint, ovh_app_key, ovh_app_secret and ovh_consumer_key
googlegoogle_credentials_file

Example Response

1{
2 "certificate": {
3 "domain": "www.test.com",
4 "type": "letsencrypt",
5 "request_status": "created",
6 "status": "installing",
7 "created_at": "2017-02-09 17:14:34",
8 "id": 1,
9 "existing": true,
10 "active": false
11 }
12}

List certificates

Method

forge.ssl.list(server_id, site_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const certificates = await forge.ssl.list(server_id, site_id);

Example Response

1{
2 "certificates": [
3 {
4 "domain": "domain.com",
5 "request_status": "creating",
6 "created_at": "2016-12-17 07:02:35",
7 "id": 3,
8 "existing": false,
9 "active": false
10 }
11 ]
12}

Get a certificate

Method

forge.ssl.get(server_id, site_id, certificate_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const certificate = await forge.ssl.get(server_id, site_id, certificate_id);

Example Response

1{
2 "certificate": {
3 "domain": "domain.com",
4 "request_status": "creating",
5 "created_at": "2016-12-17 07:02:35",
6 "id": 3,
7 "existing": false,
8 "active": false
9 }
10}

Get signing request

Method

forge.ssl.csr(server_id, site_id, certificate_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3const csr = await forge.ssl.csr(server_id, site_id, certificate_id);

Install a certificate

This endpoint may be used to get the full certificate signing request content.

Method

forge.ssl.install(server_id, site_id, cert_id, payload)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.ssl.install(server_id, site_id, cert_id, payload);

Payload

1{
2 certificate: 'certificate content',
3 add_intermediates: false
4}

Activate certificate

Method

forge.ssl.activate(server_id, site_id, certificate_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.ssl.activate(server_id, site_id, certificate_id);

Delete certificate

Method

forge.ssl.delete(server_id, site_id, certificate_id)

Usage

1const forge = new Forge('API_TOKEN');
2
3await forge.ssl.delete(server_id, site_id, certificate_id);

Edit this page on GitHub