---
title: "Generate a certificate"
method: POST
path: "/certificates/generate"
tags: ["certificates"]
---

# Generate a certificate

`POST /certificates/generate`

Generate a new SSL keypair and certificate signing request (CSR). Since Spreedly is not a certificate authority we cannot issue trusted certificates. Instead, it is intended that you will get the certificate signed by your certificate authority (or sign it yourself) and update the certificate record at Spreedly with the final and signed cert.

## Request body

- GenerateCertificate
  - `certificate` object
    - `algorithm` string, required — The encryption algorithm to use when creating the key pair. Currently, the only supported options are `ec-prime256v1` representing the X9.62/SECG curve over a 256 bit prime field, or `rsa-2048`, which uses a 2048-bit RSA key.
    - `cn` string, required — The certificate common name
    - `o` string — The organization
    - `ou` string — The organization unit
    - `c` string — The country
    - `st` string — The state
    - `l` string — The locality or city
    - `email_address` string — The email address

## Response `201`

Created

- GenerateCertificateResponse
  - `certificate` object
    - `algorithm` string — The encryption algorithm to use when creating the key pair. Currently, the only supported options are ec-prime256v1 representing the X9.62/SECG curve over a 256 bit prime field, or rsa-2048, which uses a 2048-bit RSA key.
    - `cn` string — The certificate common name
    - `o` string — The organization
    - `ou` string — The organization unit
    - `c` string — The country
    - `st` string — The state
    - `l` string — The locality or city
    - `email_address` string — The email address
    - `public_key` string — PEM-formatted public key of the certificate
    - `public_key_hash` string — The base64 encoded, SHA256 hash, of the public key
    - `csr` string — PEM formatted certificate signing request (CSR)
    - `pem` string — The signed certificate in PEM format. This value will be empty on initial certificate generation.

## Other responses

- `401` — Unauthorized

---

[API](https://skmtc.dev/spreedly/apis/spreedly-api-v1.md) · [All operations](https://skmtc.dev/spreedly/apis/spreedly-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/spreedly/spreedly-api-v1/revisions/72ba4e23e65c/schema)
