---
title: "Create a New Certificate"
method: POST
path: "/v2/certificates"
tags: ["DigitalOcean-public.v2-new_Certificates"]
---

# Create a New Certificate

`POST /v2/certificates`

To upload new SSL certificate which you have previously generated, send a POST
request to `/v2/certificates`.

When uploading a user-generated certificate, the `private_key`,
`leaf_certificate`, and optionally the `certificate_chain` attributes should
be provided. The type must be set to `custom`.

When using Let's Encrypt to create a certificate, the `dns_names` attribute
must be provided, and the type must be set to `lets_encrypt`.

## Request body

- union
  - CertificateRequestLetsEncrypt
    - `name` string, required — A unique human-readable name referring to a certificate.
    - `type` 'custom' | 'lets_encrypt' — A string representing the type of the certificate. The value will be `custom` for a user-uploaded certificate or `lets_encrypt` for one automatically generated with Let's Encrypt.
    - `dns_names` string[], required — An array of fully qualified domain names (FQDNs) for which the certificate was issued. A certificate covering all subdomains can be issued using a wildcard (e.g. `*.example.com`).
  - CertificateRequestCustom
    - `name` string, required — A unique human-readable name referring to a certificate.
    - `type` 'custom' | 'lets_encrypt' — A string representing the type of the certificate. The value will be `custom` for a user-uploaded certificate or `lets_encrypt` for one automatically generated with Let's Encrypt.
    - `private_key` string, required — The contents of a PEM-formatted private-key corresponding to the SSL certificate.
    - `leaf_certificate` string, required — The contents of a PEM-formatted public SSL certificate.
    - `certificate_chain` string — The full PEM-formatted trust chain between the certificate authority's certificate and your domain's SSL certificate.

## Response `201`

The response will be a JSON object with a key called `certificate`. The value of this will be an object that contains the standard attributes associated with a certificate.
When using Let's Encrypt, the initial value of the certificate's `state` attribute will be `pending`. When the certificate has been successfully issued by Let's Encrypt, this will transition to `verified` and be ready for use.

- object
  - `certificate` Certificate
    - `id` string, uuid — A unique ID that can be used to identify and reference a certificate.
    - `name` string — A unique human-readable name referring to a certificate.
    - `not_after` string, date-time — A time value given in ISO8601 combined date and time format that represents the certificate's expiration date.
    - `sha1_fingerprint` string — A unique identifier generated from the SHA-1 fingerprint of the certificate.
    - `created_at` string, date-time — A time value given in ISO8601 combined date and time format that represents when the certificate was created.
    - `dns_names` string[] — An array of fully qualified domain names (FQDNs) for which the certificate was issued.
    - `state` 'pending' | 'verified' | 'error' — A string representing the current state of the certificate. It may be `pending`, `verified`, or `error`.
    - `type` 'custom' | 'lets_encrypt' — A string representing the type of the certificate. The value will be `custom` for a user-uploaded certificate or `lets_encrypt` for one automatically generated with Let's Encrypt.

## Other responses

- `401` — Authentication failed due to invalid credentials.
- `429` — The API rate limit has been exceeded.
- `500` — There was a server error.
- `default` — There was an unexpected error.

## Changes

- **2025-10-16** `cb3bf9b21459` — 2 info
  - api tag `DigitalOcean-public.v2-new_Certificates` added
  - api tag `Certificates` removed
- **2025-07-18** `f8e8c290636c` — 1 info
  - endpoint added
- **2025-07-17** `5fc9af728e82` — 1 breaking
  - api path removed without deprecation
- **2025-07-17** `f8e8c290636c` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/digitalocean/apis/digitalocean-api/changes/v2/certificates/post.md)

---

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