---
title: "Create certificate"
method: POST
path: "/api/certificates"
tags: ["Certificates"]
---

# Create certificate

`POST /api/certificates`

Creates a new certificate with the provided details

## Request body

- CertificateCommandDTO — Command DTO for creating or updating a certificate. Used as the request body for certificate creation/update endpoints.
  - `name` string, required — The name of the certificate.
  - `description` string, required — A description of the certificate's purpose or usage.
  - `regenerateCertificate` boolean, required — Whether to regenerate the certificate.
  - `options` CertificateOptions, required — Options for generating a certificate. Used to specify details for certificate generation.
    - `commonName` string, required — The common name (e.g., domain name) for the certificate.
    - `countryName` string, required — The country name for the certificate.
    - `stateOrProvinceName` string, required — The state or province name for the certificate.
    - `localityName` string, required — The locality (e.g., city) name for the certificate.
    - `organizationName` string, required — The organization name for the certificate.
    - `keySize` number, double, required — The key size in bits for the certificate.
    - `daysBeforeExpiry` number, double, required — The number of days before the certificate expires.

## Response `201`

Certificate created successfully

- CertificateDTO — Data Transfer Object for a certificate. Represents a certificate with its metadata, public key, and expiry information.
  - `id` string, required — The unique identifier of the entity.
  - `creationDate` string — Represents an instant in time as an ISO 8601 string.
  - `lastEditInstant` string — Represents an instant in time as an ISO 8601 string.
  - `name` string, required — The name of the certificate.
  - `description` string, required — A description of the certificate's purpose or usage.
  - `publicKey` string, required — The public key of the certificate in PEM format.
  - `certificate` string, required — The certificate in PEM format.
  - `expiry` string, required — Represents an instant in time as an ISO 8601 string.

## Changes

- **2026-01-06** `d8e7a58e006a` — 4 breaking, 2 info
  - removed the required property `createdAt` from the response with the `201` status
  - removed the required property `createdBy` from the response with the `201` status
  - removed the required property `updatedAt` from the response with the `201` status
  - removed the required property `updatedBy` from the response with the `201` status
  - …2 more

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

---

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