The v0/certificates
endpoint lets you view and create SSL certificates for your organization's domains via the API.
Create a certificate
You can create an SSL certificate for an array of domains with the POST
method using the v0/certificates
endpoint. The SSL certificate you create will be identical across all domains included in the API call.
Call Parameters
Parameter | Value Type | Description |
---|---|---|
domains | array | An array of domain names (e.g. ["example.com"], ["www.example.com"] ) |
label | string | An identification label for this certificate (Optional) |
Call Example
POST https://api.speedyrails.com/v0/certificates
401 Unauthorized
error.JSON Curl Request Example
curl "https://api.speedyrails.com/v0/certificates"
-X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer {API_TOKEN}" \
-d '{"domains": ["example.com"], "label": "LABEL_NAME"}'
Example Response
{
"certificate": {
"id": "42f071a091c101e3",
"label": "label-sample",
"domains": [
"example.com"
],
"certificate": "Your certificate will show here",
"chain": "Your chain will show here",
"private_key": "Your RSA private key will show here",
"expires_at": "2017-04-16T21:07:00.000+00:00",
"created_at": "2017-01-16T21:07:00.000+00:00"
}
}
List Certificates
You can use the API to show a list of your current SSL certificates in JSON format. You can scope the request by organization or by using the label
parameter, which you can set when creating a certificate.
Call Parameters
Parameter | Value Type | Description |
---|---|---|
label | string | A custom name for a group of certificates (Optional) |
Call Example
To view a list of your certificates by label, include a label parameter and replace LABEL_NAME
with your label name. To view a complete list of an organization's certificates, do not include the label parameter.
GET https://api.speedyrails.com/v0/certificates?label=LABEL_NAME
GET https://api.speedyrails.com/v0/certificates
JSON Curl Request Example
curl "https://api.speedyrails.com/v0/certificates" \
-X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer {API_TOKEN}"
curl "https://api.speedyrails.com/v0/certificates?label=LABEL_NAME" \
-X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer {API_TOKEN}"
Example Response
{
"certificate": {
"id": "42f071a091c101e3",
"label": "LABEL_NAME",
"domains": [
"yourdomain1.com"
],
"certificate": "Your certificate will show here",
"chain": "Your chain will show here",
"private_key": "Your RSA private key will show here",
"expires_at": "2017-04-16T21:07:00.000+00:00",
"created_at": "2017-01-16T21:07:00.000+00:00"
}
},
{
"certificate": {
"id": "42f688a091c1238f3",
"label": "LABEL_NAME",
"domains": [
"yourdomain2.com"
],
"certificate": "Your certificate will show here",
"chain": "Your chain will show here",
"private_key": "Your RSA private key will show here",
"expires_at": "2017-04-16T21:07:00.000+00:00",
"created_at": "2017-01-16T21:07:00.000+00:00"
}
}
View a Single Certificate
You can use the API to show a specific SSL certificate in JSON format by requesting its ID. All Certificates have a unique ID assigned upon creation.
Call Parameters
Parameter | Value Type | Description |
---|---|---|
id | integer | Certificate ID |
Call Example
To view a specific certificate, use the following API request, replacing 1234
with your certificate's ID.
GET https://api.speedyrails.com/v0/certificates/1234
JSON Curl Request Example
curl "https://api.speedyrails.com/v0/certificates/1234" \
-X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer {API_TOKEN}"
Example Response
{
"certificate": {
"id": "1234",
"label": "label-sample",
"domains": [
"yourdomain4.com"
],
"certificate": "Your certificate will show here",
"chain": "Your chain will show here",
"private_key": "Your RSA private key will show here",
"expires_at": "2017-04-16T21:07:00.000+00:00",
"created_at": "2017-01-16T21:07:00.000+00:00"
}
}
Comments
0 comments
Please sign in to leave a comment.