Private Keys
A private key is used to sign a Certificate. A key can be used to sign multiple certificates.
Fields
field | type | description |
---|---|---|
created_at | string | Time-stamp (GMT) when the private key was created. Read Only. |
name | string | A customizable name for your private key. Optional. |
key | string | The contents of the private key. Must be a PEM-formatted key. Not returned in response body. Required. |
key_length | integer | The key length used to generate the private key. Read Only. |
key_type | string | The algorithm used to generate the private key. Must be |
replace | boolean | A recommendation from Fastly to replace this private key and all associated certificates. Read Only. |
Actions
GET /tls/private_keys
List all private keys.
Authentication
API token with at least TLS management permissions.
Parameters
parameter | type | description |
---|---|---|
filter[in_use] | string | Limit the returned keys to those without any matching TLS certificates. The only valid value is |
page[number] | integer | The page index for pagination. |
page[size] | integer | The number of keys per page. |
Request Example
GET /tls/private_keys HTTP/1.1
Fastly-Key: YOUR_FASTLY_TOKEN
Accept: application/vnd.api+json
Response Example
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "PRIVATE_KEY_ID",
"type" : "tls_private_key",
"attributes": {
"created_at": "2018-06-06T18:14:32+00:00",
"key_length": 2048,
"key_type": "RSA",
"name": "My private key",
"replace": false
}
}
]
}
GET /tls/private_keys/id
List one private key.
Authentication
API token with at least TLS management permissions.
Request Example
GET /tls/private_keys/:id HTTP/1.1
Fastly-Key: YOUR_FASTLY_TOKEN
Accept: application/vnd.api+json
Response Example
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"data": {
"id": "PRIVATE_KEY_ID",
"type" : "tls_private_key",
"attributes": {
"created_at": "2018-06-06T18:14:32+00:00",
"key_length": 2048,
"key_type": "RSA",
"name": "My private key",
"replace": false
}
}
}
POST /tls/private_keys
Upload a private key.
Authentication
API token with at least TLS management permissions.
Request Example
POST /tls/private_keys HTTP/1.1
Fastly-Key: YOUR_FASTLY_TOKEN
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
"data": {
"type": "tls_private_key",
"attributes": {
"key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"name": "My private key"
}
}
}
Response Example
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
"data": {
"id": "PRIVATE_KEY_ID",
"type": "tls_private_key",
"attributes": {
"created_at": "2018-06-06T18:14:32+00:00",
"key_length": 2048,
"key_type": "RSA",
"name": "My private key",
"replace": false
}
}
}
DELETE /tls/private_keys/id
Destroy a private key. Only private keys not already matched to any certificates can be deleted.
Authentication
API token with at least TLS management permissions.
Request Example
DELETE /tls/private_keys/PRIVATE_KEY_ID HTTP/1.1
Fastly-Key: YOUR_FASTLY_TOKEN
Accept: application/vnd.api+json
Response Example
HTTP/1.1 204 No Content
Content-Type: application/vnd.api+json