# Archive newly issued origin certificates in R2

Sign a CSR for a configured origin hostname and save the signed PEM in R2 under its serial number.

[Use template](https://dashboard.fasthook.io/workflow/new?templateKey=origin-ca-issued-certificates-to-r2&templateName=Archive+newly+issued+origin+certificates+in+R2)

**Required accounts**

- Cloudflare Origin CA
- Cloudflare R2
- Http

## Archive newly issued origin certificates in R2

### 1. Trigger · Origin server requests a certificate

**Webhook**. Receive a JSON submission from your existing form backend at this Workflow's private webhook URL.

### 2. Action · Sign the origin server’s request

**Cloudflare Origin CA**. Sign a certificate signing request for the selected hostnames. Keep the private key on the origin server.

### 3. Action · Reserve the PEM archive location

**Cloudflare R2**. Create an expiring URL for one object.

### 4. Action · Save the signed PEM in R2

**Http**. Send an HTTP request and use the response in subsequent steps.

## Set up your workflow

1. **Set the certificate policy** Connect the zone and enter an explicit list of hostnames in the signing step. Select the certificate type and lifetime for your origin.
2. **Choose the archive** Connect R2 and select a private bucket. Each issuance creates a separate PEM object named after its serial number.
3. **Send a signing request** Keep the private key on the server. POST only the PEM signing request in the csr field to your private webhook. Compare the archived PEM with the issued certificate before installing it.

## Related integrations

- [Webhook trigger](https://www.fasthook.io/docs/triggers/webhook)
- [Cloudflare Origin CA integrations](https://www.fasthook.io/apps/cloudflare-origin-ca/integrations)
- [Cloudflare R2 integrations](https://www.fasthook.io/apps/cloudflare-r2/integrations)

## Related workflow templates

- [Revoke a retired origin certificate and notify Slack](https://www.fasthook.io/templates/origin-ca-retirement-receipts-to-slack.md): Match an approved retirement to a configured certificate, revoke it and post the Cloudflare receipt to the operations channel.
- [Record origin certificate details in D1](https://www.fasthook.io/templates/origin-ca-certificate-inventory-to-d1.md): Look up a certificate by serial number and refresh its hostname and expiry record in D1.
- [Archive published WordPress articles in R2](https://www.fasthook.io/templates/wordpress-published-snapshots-to-r2.md): Capture the published WordPress permalink and save its rendered Markdown and desktop screenshot together in an R2 bucket.
- [Share desktop and mobile deployment previews in Slack](https://www.fasthook.io/templates/webhook-deployment-screenshots-to-slack.md): Render the deployed page at two viewport sizes and attach both PNGs to one Slack message.
- [Archive an R2 object in Dropbox](https://www.fasthook.io/templates/cloudflare-r2-object-to-dropbox.md): Send a bucket, object key and Dropbox path to copy the original bytes.
