Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Upload certificate

client.admin.organization.certificates.create(body, options?): Certificate { id, certificate_details, created_at, 3 more }
POST
/organization/certificates

Upload a certificate to the organization. This does not automatically activate the certificate.

Organizations can upload up to 50 certificates.

Parameters
body: CertificateCreateParams { certificate, name }
certificate: string

The certificate content in PEM format

name?: string

An optional name for the certificate

Returns
Certificate { id, certificate_details, created_at, 3 more }

Represents an individual certificate uploaded to the organization.

id: string

The identifier, which can be referenced in API endpoints

certificate_details: CertificateDetails { content, expires_at, valid_at }
created_at: number

The Unix timestamp (in seconds) of when the certificate was uploaded.

formatunixtime
name: string | null

The name of the certificate.

object: "certificate" | "organization.certificate" | "organization.project.certificate"

The object type.

  • If creating, updating, or getting a specific certificate, the object type is certificate.
  • If listing, activating, or deactivating certificates for the organization, the object type is organization.certificate.
  • If listing, activating, or deactivating certificates for a project, the object type is organization.project.certificate.
active?: boolean

Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate.

Upload certificate

import OpenAI from 'openai';

const client = new OpenAI({
  adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
});

const certificate = await client.admin.organization.certificates.create({
  certificate: 'certificate',
});

console.log(certificate.id);
{
  "object": "certificate",
  "id": "cert_abc",
  "name": "My Example Certificate",
  "created_at": 1234567,
  "certificate_details": {
    "valid_at": 12345667,
    "expires_at": 12345678
  }
}
Returns Examples
{
  "object": "certificate",
  "id": "cert_abc",
  "name": "My Example Certificate",
  "created_at": 1234567,
  "certificate_details": {
    "valid_at": 12345667,
    "expires_at": 12345678
  }
}