# Explicitly retire an unused preceding signing key

<div class="api-op" data-api-operation>
<div class="api-op__main">

<p class="api-endpoint"><span class="method method-post">POST</span> <code>/v1/connections/&#123;conn&#125;/sp_key_rotations/retire</code></p>

Mutations require a current project administrator using a CLI credential or dashboard session; secret API keys cannot authorize them.

<dl class="api-facts"><div><dt>Scope</dt><dd><code>connections:write</code></dd></div><div><dt>Auth</dt><dd>Access token</dd></div><div><dt>Since</dt><dd>1.0</dd></div></dl>

## Path parameters

<ul class="api-fields">
<li class="api-field">
<p class="api-field__head"><code class="api-field__name">conn</code> <span class="api-field__type">string</span> <span class="api-field__required">Required</span></p>
</li>
</ul>

## Headers

<ul class="api-fields">
<li class="api-field">
<p class="api-field__head"><code class="api-field__name">OhAuthCat-Version</code> <span class="api-field__type">string</span></p>
Minor version; defaults to the environment's pin.
</li>
</ul>

## Request body

<ul class="api-fields">
<li class="api-field">
<p class="api-field__head"><code class="api-field__name">generation</code> <span class="api-field__type">string</span> <span class="api-field__required">Required</span></p>
Canonical decimal signed 64-bit generation; strings preserve precision in every client.
</li>
</ul>

## Responses

<ul class="api-responses">
<li class="api-response"><span class="api-status api-status--ok">200</span> <span>Current rotation progress <span class="api-field__type">SPKeyRotation</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">400</span> <span>Invalid request. Codes: <a href="/errors/parameter_invalid/">parameter_invalid</a>, <a href="/errors/parameter_missing/">parameter_missing</a>, <a href="/errors/version_unsupported/">version_unsupported</a> and resource-specific codes from the catalogue. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">401</span> <span>Codes: <a href="/errors/authentication_required/">authentication_required</a>, <a href="/errors/api_key_invalid/">api_key_invalid</a>. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">403</span> <span>Codes: <a href="/errors/api_key_scope_missing/">api_key_scope_missing</a>, <a href="/errors/ip_not_allowed/">ip_not_allowed</a>, <a href="/errors/plan_limit_reached/">plan_limit_reached</a>. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">404</span> <span>Code: <a href="/errors/resource_not_found/">resource_not_found</a> (also returned for other tenants' IDs); a path no endpoint serves answers <a href="/errors/route_not_found/">route_not_found</a>. A browser GET or HEAD of an unknown path whose Accept ranks text/html above JSON gets an HTML 404 page instead, with the same status; every other client gets this JSON body. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">409</span> <span>Codes: <a href="/errors/idempotency_key_reused/">idempotency_key_reused</a> and resource-specific conflicts. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">429</span> <span>Code: <a href="/errors/rate_limited/">rate_limited</a>. Retry-After is set. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--bad">503</span> <span>Code: <a href="/errors/service_unavailable/">service_unavailable</a>. Retry-After is set; writes are paused. <span class="api-field__type">Error</span></span></li>
<li class="api-response"><span class="api-status api-status--neutral">default</span> <span>Any other error, including <a href="/errors/internal_error/">internal_error</a>. Every code is in the error catalogue. <span class="api-field__type">Error</span></span></li>
</ul>

Errors share one shape; see the [error code catalogue](/errors/).

</div>
<div class="api-op__code">

**curl**

```sh wrap
curl -X POST \
  "https://api.ohauthcat.com/v1/connections/conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/sp_key_rotations/retire" \
  -H "Authorization: Bearer $OHAUTHCAT_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "generation": "1"
}'
```

**Node**

```javascript wrap
const response = await fetch(
  "https://api.ohauthcat.com/v1/connections/conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/sp_key_rotations/retire",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OHAUTHCAT_ACCESS_TOKEN}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      generation: "1",
    }),
  },
);
const data = await response.json();
```

**Python**

```python wrap
import os
import requests

response = requests.post(
    "https://api.ohauthcat.com/v1/connections/conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/sp_key_rotations/retire",
    headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_ACCESS_TOKEN']}"},
    json={
        "generation": "1",
    },
)
data = response.json()
```

```json title="Response 200" wrap
{
  "object": "sp_key_rotation",
  "connection": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
  "generation": "1",
  "state": "staged",
  "current_key": {
    "id": "spk_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
    "key_id": "key_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
    "certificate": "MIIC8DCCAdigAwIBAgIQ...base64 PEM body..."
  },
  "previous_key": {
    "id": "spk_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
    "key_id": "key_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
    "certificate": "MIIC8DCCAdigAwIBAgIQ...base64 PEM body..."
  },
  "next_key": {
    "id": "spk_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
    "key_id": "key_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
    "certificate": "MIIC8DCCAdigAwIBAgIQ...base64 PEM body..."
  },
  "pending_reasons": ["notice_required"],
  "doctor": {
    "error_code": "saml_signature_invalid",
    "idp": "okta",
    "cause": "The IdP signed the response with an unexpected certificate.",
    "it_admin_message": "The IdP signed the response with an unexpected certificate.",
    "fix_guide_id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
    "steps": ["acs"]
  },
  "test": {
    "sign_in_id": "sgn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
    "generation": "1",
    "sp_key_id": "spk_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
    "verified_at": "2026-01-15T09:30:00Z"
  },
  "acknowledged_at": "2026-01-15T09:30:00Z",
  "test_eligible_at": "2026-01-15T09:30:00Z",
  "submission": {
    "requested": 0,
    "pending": 0,
    "submitted": 0,
    "uncertain": 0,
    "skipped": 0
  },
  "confirmed_at": "2026-01-15T09:30:00Z",
  "activated_at": "2026-01-15T09:30:00Z",
  "rolled_back_at": "2026-01-15T09:30:00Z",
  "retired_at": "2026-01-15T09:30:00Z",
  "created_at": "2026-01-15T09:30:00Z",
  "updated_at": "2026-01-15T09:30:00Z"
}
```

</div>
</div>
