0

Revoke Origin CA Certificate

by
Published today

Revoke an Origin CA certificate by its id.

Script cloudflare Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 3 hours ago
1
//native
2

3
/**
4
 * Revoke Origin CA Certificate
5
 * Revoke an Origin CA certificate by its id.
6
 */
7
export async function main(auth: RT.Cloudflare, certificate_id: string) {
8
  const response = await fetch(
9
    `https://api.cloudflare.com/client/v4/certificates/${certificate_id}`,
10
    {
11
      method: "DELETE",
12
      headers: {
13
        Authorization: `Bearer ${auth.token}`,
14
        Accept: "application/json",
15
      },
16
    }
17
  )
18

19
  if (!response.ok) {
20
    throw new Error(`${response.status} ${await response.text()}`)
21
  }
22

23
  return await response.json()
24
}
25