---
id: crypto-certificatekeypairs-generate-create
title: "crypto_certificatekeypairs_generate_create"
description: "Generate a new, self-signed certificate-key pair"
sidebar_label: "crypto_certificatekeypairs_generate_create"
hide_title: true
hide_table_of_contents: true
api: eJy1V21v2zYQ/iuEvmwDVCtJ02HIp6VF0AZNliBOPwyFYdDSSWJDkRpJOVEN//fdkVKsyEqKtd0XWy/He+6ee9Um0jUY7oRW51l0EqWmrZ1epmCcyEXKHdxBW3Nh7LIARZKwTA3gXxRHGdjUiJoO49H33XvGmYL7mFmQ+SsrCgUZG+h7hQoZaUQFjhc2OvncoUaLODLwTwPWvdVZG51solQrB8rRJa9rSQoQLPliCXET2bSEitOVa2tAG/TqC6Ruz7R3O3jWuYEv0ArDK3BgLJ6oDTHhBNgAXFVaLRW+H6i3zghVoHAl1AWowpXRyeE2jmzjcZdcumeOoNCaS5EJ1y4z3tqBhEAXCzAkwmXhXZXyKkdeNhGopiKCjOWICmmG/8jS2BwnnKQHp7I4oxPbBTGQ80Yidf7wdhu4FQYyz/jAv7Fpi53CAXHvH3m7CTFCnU+UOtMAcQFpY1CXt583rsT4iTu8W2x9fG2tlQ0kHx0c/D9B/gjtNWYYm4MR6NpXMHsBru+m4pprU3HirGlEFpG5PLtSsg3e7Xj5WDMvgf4+G+8c/8HUeOuWtuRHb36fQlSNlHxFSgPCuKbcsHbYB25L9uv8wylq+23Pvn3Qw58IeTgJSKJLeKiFaV8kNKPSd8Kn238zoFP+HHZXez/uaKeIcctyPMhMnh6/OTyeAkZ+19QJsZUt+ZqLDuXRgpXWErjaS9F5qe+ZyJkrhWVdY2UlAnLWqaSnDAsiF0WDVcW0YUq7b9kQYL+HACzPIfQvlpGOmIy0MIk7oGyZ6XslNc+WjZFT+Pt4n24umNOsPzgMwLec/HGwgaNTYBVXvKBOtq973AfGxPZ94TKoYKuW7Vrf2LQrn2fIdMkx2wywauLUjN2WYIHpTpjkwuDNGFcZa+osXDdOY4Uhg1K2dAgzK5e8YBrNZUJlntseTHX6WIqXK9S+BnOP3Rr7L6FXoggt3s7Y37rxUtYJLIZKZyJvfbr0Fq0F9/en1+cxWzWOCtWrLjn2IEvMjxCEwkSXaI7pzJ/tz6VBOxkV+AupN9H3JvvvLsZd345pDjxXzy+k30T5TU/NbhKFWfk0DWhGHIcJ+PTFW0xV089Yknn9E6ekH+MipaixM2P0/mTMwCEDkyMt1dnUrBvFsFMwIKQDDXiTVFD5gSs17aC1tmR3zWm9ipKwHCYTK2nSr6RJRHuHWdMmR2uH7xBRwmuRrF8nfh3q15I58RQcHSwnjy6VztWkzEtRJwcsPOPtI6Zvduvp2QOv6tD1nyyLu6axvxXu3o2WwYNu9wu7Wow7Ya69VR2Bw2ZCXgbajg6Ojmd/zI72gnzJ7xDmsZmEVGFWkMEzKiTMJR5mJiYNBTsqQUr9Z6F3DUhosgQTDXBfI9HOh8vzW1QRKCa67EmSFMKVzWqGRCQDFcnuaiX1KkEolVycvzv7a37mKaVIY0UOlIdgs4lg94t73wbHTg8q5Ls+RUL8HTy4pJZoKDnfTZqQiY+fKU8aUW8ePu0NxEtK/pLSGE9tNitu4ZOR2y09xgSiVenzgpIA11M/RXA5xgM4ZDDXKIFpQmEfCQ69uiXbfM40PhnG5b+N+xOnaQq1e1F2Mai066s5xXLVfW1Vvrwjw+9p5OEvVmaMH4h+IpCAf7aJJDb4Btsovg86KZYU6+EKFAon7i/Iq+4VV+3AQqTHS9zqO1BIUdy54ugezUXl/wKpdCSK
sidebar_class_name: "post api-method"
info_path: docs/developer-docs/api/reference/authentik
custom_edit_url: null
hide_send_button: true
---

import ApiTabs from "@theme/ApiTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import Heading from "@theme/Heading";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"crypto_certificatekeypairs_generate_create"}
>
</Heading>

<MethodEndpoint
  method={"post"}
  path={"/crypto/certificatekeypairs/generate/"}
>
  
</MethodEndpoint>



Generate a new, self-signed certificate-key pair

<Heading
  id={"request"}
  as={"h2"}
  className={"openapi-tabs__heading"}
  children={"Request"}
>
</Heading>

<MimeTabs
  className={"openapi-tabs__mime"}
>
  <TabItem
    label={"application/json"}
    value={"application/json-schema"}
  >
    <details
      style={{}}
      className={"openapi-markdown__details mime"}
      data-collapsed={false}
      open={true}
    >
      <summary
        style={{}}
        className={"openapi-markdown__details-summary-mime"}
      >
        <h3
          className={"openapi-markdown__details-summary-header-body"}
        >
          Body
        </h3><strong
          className={"openapi-schema__required"}
        >
          required
        </strong>
      </summary><div
        style={{"textAlign":"left","marginLeft":"1rem"}}
      >
        
      </div><ul
        style={{"marginLeft":"1rem"}}
      >
        <SchemaItem
          collapsible={false}
          name={"common_name"}
          required={true}
          schemaName={"string"}
          qualifierMessage={"**Possible values:** `non-empty`"}
          schema={{"type":"string","minLength":1}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={false}
          name={"subject_alt_name"}
          required={false}
          schemaName={"string"}
          qualifierMessage={undefined}
          schema={{"type":"string"}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={false}
          name={"validity_days"}
          required={true}
          schemaName={"integer"}
          qualifierMessage={undefined}
          schema={{"type":"integer"}}
        >
          
        </SchemaItem><SchemaItem
          collapsible={false}
          name={"alg"}
          required={false}
          schemaName={"AlgEnum (string)"}
          qualifierMessage={"**Possible values:** [`rsa`, `ecdsa`]"}
          schema={{"enum":["rsa","ecdsa"],"type":"string","title":"AlgEnum"}}
        >
          
        </SchemaItem>
      </ul>
    </details>
  </TabItem>
</MimeTabs><div>
  <div>
    <ApiTabs
      label={undefined}
      id={undefined}
    >
      <TabItem
        label={"200"}
        value={"200"}
      >
        <div>
          
          
          
          
          
        </div><div>
          <MimeTabs
            className={"openapi-tabs__mime"}
            schemaType={"response"}
          >
            <TabItem
              label={"application/json"}
              value={"application/json"}
            >
              <SchemaTabs
                className={"openapi-tabs__schema"}
              >
                <TabItem
                  label={"Schema"}
                  value={"Schema"}
                >
                  <details
                    style={{}}
                    className={"openapi-markdown__details response"}
                    data-collapsed={false}
                    open={true}
                  >
                    <summary
                      style={{}}
                      className={"openapi-markdown__details-summary-response"}
                    >
                      <strong>
                        Schema
                      </strong>
                    </summary><div
                      style={{"textAlign":"left","marginLeft":"1rem"}}
                    >
                      
                    </div><ul
                      style={{"marginLeft":"1rem"}}
                    >
                      <SchemaItem
                        collapsible={false}
                        name={"pk"}
                        required={true}
                        schemaName={"uuid"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","format":"uuid","readOnly":true,"title":"Kp uuid"}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"name"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string"}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"fingerprint_sha256"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","nullable":true,"description":"Get certificate Hash (SHA256)","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"fingerprint_sha1"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","nullable":true,"description":"Get certificate Hash (SHA1)","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"cert_expiry"}
                        required={true}
                        schemaName={"date-time"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","format":"date-time","nullable":true,"description":"Get certificate expiry","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"cert_subject"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","nullable":true,"description":"Get certificate subject as full rfc4514","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"private_key_available"}
                        required={true}
                        schemaName={"boolean"}
                        qualifierMessage={undefined}
                        schema={{"type":"boolean","description":"Show if this keypair has a private key configured or not","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"private_key_type"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","nullable":true,"description":"Get the private key's type, if set","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"certificate_download_url"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","description":"Get URL to download certificate","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"private_key_download_url"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","description":"Get URL to download private key","readOnly":true}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"managed"}
                        required={true}
                        schemaName={"Managed by authentik (string)"}
                        qualifierMessage={undefined}
                        schema={{"type":"string","readOnly":true,"nullable":true,"title":"Managed by authentik","description":"Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update."}}
                      >
                        
                      </SchemaItem>
                    </ul>
                  </details>
                </TabItem><TabItem
                  label={"Example (from schema)"}
                  value={"Example (from schema)"}
                >
                  <ResponseSamples
                    responseExample={"{\n  \"pk\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"name\": \"string\",\n  \"fingerprint_sha256\": \"string\",\n  \"fingerprint_sha1\": \"string\",\n  \"cert_expiry\": \"2024-07-29T15:51:28.071Z\",\n  \"cert_subject\": \"string\",\n  \"private_key_available\": true,\n  \"private_key_type\": \"string\",\n  \"certificate_download_url\": \"string\",\n  \"private_key_download_url\": \"string\",\n  \"managed\": \"string\"\n}"}
                    language={"json"}
                  >
                    
                  </ResponseSamples>
                </TabItem>
              </SchemaTabs>
            </TabItem>
          </MimeTabs>
        </div>
      </TabItem><TabItem
        label={"400"}
        value={"400"}
      >
        <div>
          
          
          Bad request
          
          
        </div><div>
          
        </div>
      </TabItem><TabItem
        label={"403"}
        value={"403"}
      >
        <div>
          
          
          
          
          
        </div><div>
          <MimeTabs
            className={"openapi-tabs__mime"}
            schemaType={"response"}
          >
            <TabItem
              label={"application/json"}
              value={"application/json"}
            >
              <SchemaTabs
                className={"openapi-tabs__schema"}
              >
                <TabItem
                  label={"Schema"}
                  value={"Schema"}
                >
                  <details
                    style={{}}
                    className={"openapi-markdown__details response"}
                    data-collapsed={false}
                    open={true}
                  >
                    <summary
                      style={{}}
                      className={"openapi-markdown__details-summary-response"}
                    >
                      <strong>
                        Schema
                      </strong>
                    </summary><div
                      style={{"textAlign":"left","marginLeft":"1rem"}}
                    >
                      
                    </div><ul
                      style={{"marginLeft":"1rem"}}
                    >
                      <SchemaItem
                        collapsible={false}
                        name={"detail"}
                        required={true}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string"}}
                      >
                        
                      </SchemaItem><SchemaItem
                        collapsible={false}
                        name={"code"}
                        required={false}
                        schemaName={"string"}
                        qualifierMessage={undefined}
                        schema={{"type":"string"}}
                      >
                        
                      </SchemaItem>
                    </ul>
                  </details>
                </TabItem><TabItem
                  label={"Example (from schema)"}
                  value={"Example (from schema)"}
                >
                  <ResponseSamples
                    responseExample={"{\n  \"detail\": \"string\",\n  \"code\": \"string\"\n}"}
                    language={"json"}
                  >
                    
                  </ResponseSamples>
                </TabItem>
              </SchemaTabs>
            </TabItem>
          </MimeTabs>
        </div>
      </TabItem>
    </ApiTabs>
  </div>
</div>
      