Skip to content
Primary navigation

Get certificate

admin.organization.certificates.retrieve(certificate_id, **kwargs) -> Certificate { id, certificate_details, created_at, 3 more }
GET/organization/certificates/{certificate_id}

Get a certificate that has been uploaded to the organization.

You can get a certificate regardless of whether it is active or not.

ParametersExpand Collapse
certificate_id: String
include: Array[:content]

A list of additional fields to include in the response. Currently the only supported value is content to fetch the PEM content of the certificate.

ReturnsExpand Collapse
class 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}
content: String

The content of the certificate in PEM format.

expires_at: Integer

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

formatunixtime
valid_at: Integer

The Unix timestamp (in seconds) of when the certificate becomes valid.

formatunixtime
created_at: Integer

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

formatunixtime
name: String

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.
One of the following:
:certificate
:"organization.certificate"
:"organization.project.certificate"
active: bool

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

Get certificate

require "openai"

openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

certificate = openai.admin.organization.certificates.retrieve("certificate_id")

puts(certificate)
{
  "object": "certificate",
  "id": "cert_abc",
  "name": "My Example Certificate",
  "created_at": 1234567,
  "certificate_details": {
    "valid_at": 1234567,
    "expires_at": 12345678,
    "content": "-----BEGIN CERTIFICATE-----MIIDeT...-----END CERTIFICATE-----"
  }
}
Returns Examples
{
  "object": "certificate",
  "id": "cert_abc",
  "name": "My Example Certificate",
  "created_at": 1234567,
  "certificate_details": {
    "valid_at": 1234567,
    "expires_at": 12345678,
    "content": "-----BEGIN CERTIFICATE-----MIIDeT...-----END CERTIFICATE-----"
  }
}