> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotates the AS2 signing/decryption identity without a restart. The new

> key + certificate are validated (parseable, not expired) before the atomic swap; in-flight requests finish with the identity they started with…

key + certificate are validated (parseable, not expired) before the
atomic swap; in-flight requests finish with the identity they started
with. The cert-expiry monitor tracks the new certificate immediately.

### Request body

`RotateAs2IdentityBody`

<ParamField body="cert_pem" type="string" required>
  X.509 certificate PEM.
</ParamField>

<ParamField body="key_pem" type="string" required>
  PKCS#8 private key PEM.
</ParamField>

### Response

No response body. Identity rotated.

### Status codes

| Code  | Meaning                            |
| ----- | ---------------------------------- |
| `200` | Identity rotated                   |
| `403` | Platform-admin credential required |
| `422` | Key/certificate invalid or expired |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://edi.stateset.com/v1/as2/identity' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "cert_pem": "string",
    "key_pem": "string"
  }'
  ```
</RequestExample>
