Create domain certificate
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'letsencrypt',
'enable' => false,
'letsencrypt' => [
'verification_method' => 'dns-01',
'key_type' => 'ecdsa',
'preferred_chain' => 'ISRG Root X1'
],
'existing' => [
'key' => '<string>',
'certificate' => '<string>'
],
'csr' => [
'domain' => '<string>',
'sans' => '<string>',
'country' => '<string>',
'state' => '<string>',
'city' => '<string>',
'organization' => '<string>',
'department' => '<string>'
],
'clone' => [
'certificate_id' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "letsencrypt",
"enable": false,
"letsencrypt": {
"verification_method": "dns-01",
"key_type": "ecdsa",
"preferred_chain": "ISRG Root X1"
},
"existing": {
"key": "<string>",
"certificate": "<string>"
},
"csr": {
"domain": "<string>",
"sans": "<string>",
"country": "<string>",
"state": "<string>",
"city": "<string>",
"organization": "<string>",
"department": "<string>"
},
"clone": {
"certificate_id": 123
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'letsencrypt',
enable: false,
letsencrypt: {
verification_method: 'dns-01',
key_type: 'ecdsa',
preferred_chain: 'ISRG Root X1'
},
existing: {key: '<string>', certificate: '<string>'},
csr: {
domain: '<string>',
sans: '<string>',
country: '<string>',
state: '<string>',
city: '<string>',
organization: '<string>',
department: '<string>'
},
clone: {certificate_id: 123}
})
};
fetch('https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates"
payload := strings.NewReader("{\n \"type\": \"letsencrypt\",\n \"enable\": false,\n \"letsencrypt\": {\n \"verification_method\": \"dns-01\",\n \"key_type\": \"ecdsa\",\n \"preferred_chain\": \"ISRG Root X1\"\n },\n \"existing\": {\n \"key\": \"<string>\",\n \"certificate\": \"<string>\"\n },\n \"csr\": {\n \"domain\": \"<string>\",\n \"sans\": \"<string>\",\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\",\n \"organization\": \"<string>\",\n \"department\": \"<string>\"\n },\n \"clone\": {\n \"certificate_id\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"id": "<string>",
"type": "certificates",
"attributes": {
"type": "letsencrypt",
"verification_method": "http-01",
"key_type": "ecdsa",
"preferred_chain": "ISRG Root X1",
"request_status": "'creating'",
"status": "'installed'",
"active": true,
"created_at": "2025-07-29T09:00:00Z",
"updated_at": "2025-07-30T09:00:00Z"
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Sites
Create domain certificate
Create a new certificate for a given domain.
Processing mode: async
POST
/
orgs
/
{organization}
/
servers
/
{server}
/
sites
/
{site}
/
domains
/
{domainRecord}
/
certificates
Create domain certificate
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'letsencrypt',
'enable' => false,
'letsencrypt' => [
'verification_method' => 'dns-01',
'key_type' => 'ecdsa',
'preferred_chain' => 'ISRG Root X1'
],
'existing' => [
'key' => '<string>',
'certificate' => '<string>'
],
'csr' => [
'domain' => '<string>',
'sans' => '<string>',
'country' => '<string>',
'state' => '<string>',
'city' => '<string>',
'organization' => '<string>',
'department' => '<string>'
],
'clone' => [
'certificate_id' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "letsencrypt",
"enable": false,
"letsencrypt": {
"verification_method": "dns-01",
"key_type": "ecdsa",
"preferred_chain": "ISRG Root X1"
},
"existing": {
"key": "<string>",
"certificate": "<string>"
},
"csr": {
"domain": "<string>",
"sans": "<string>",
"country": "<string>",
"state": "<string>",
"city": "<string>",
"organization": "<string>",
"department": "<string>"
},
"clone": {
"certificate_id": 123
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'letsencrypt',
enable: false,
letsencrypt: {
verification_method: 'dns-01',
key_type: 'ecdsa',
preferred_chain: 'ISRG Root X1'
},
existing: {key: '<string>', certificate: '<string>'},
csr: {
domain: '<string>',
sans: '<string>',
country: '<string>',
state: '<string>',
city: '<string>',
organization: '<string>',
department: '<string>'
},
clone: {certificate_id: 123}
})
};
fetch('https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates"
payload := strings.NewReader("{\n \"type\": \"letsencrypt\",\n \"enable\": false,\n \"letsencrypt\": {\n \"verification_method\": \"dns-01\",\n \"key_type\": \"ecdsa\",\n \"preferred_chain\": \"ISRG Root X1\"\n },\n \"existing\": {\n \"key\": \"<string>\",\n \"certificate\": \"<string>\"\n },\n \"csr\": {\n \"domain\": \"<string>\",\n \"sans\": \"<string>\",\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\",\n \"organization\": \"<string>\",\n \"department\": \"<string>\"\n },\n \"clone\": {\n \"certificate_id\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"id": "<string>",
"type": "certificates",
"attributes": {
"type": "letsencrypt",
"verification_method": "http-01",
"key_type": "ecdsa",
"preferred_chain": "ISRG Root X1",
"request_status": "'creating'",
"status": "'installed'",
"active": true,
"created_at": "2025-07-29T09:00:00Z",
"updated_at": "2025-07-30T09:00:00Z"
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The organization slug
The server ID
The site ID
The domain record ID
Body
application/json
The type of certificate to create.
Available options:
letsencrypt, csr, existing, clone Example:
"letsencrypt"
Whether to enable the certificate upon installation.
Example:
false
The configuration for a Let's Encrypt certificate.
Show child attributes
Show child attributes
The configuration for an existing certificate.
Show child attributes
Show child attributes
The configuration for a CSR (Certificate Signing Request).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
CertificateResource
Show child attributes
Show child attributes
Was this page helpful?