> ## 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…

> With EDI_AS2_PERSIST_IDENTITY=true the rotation is written to the state backend first (all-or-nothing) and every replica converges on it within a minute…

With `EDI_AS2_PERSIST_IDENTITY=true` the rotation is written to the state
backend first (all-or-nothing) and every replica converges on it within a
minute; without it the swap is this-replica-only and lost on restart —
the response's `persisted` field says which happened.

### Request body

`RotateAs2IdentityBody`

**cert\_pem** `string` *required*

X.509 certificate PEM.

**key\_pem** `string` *required*

PKCS#8 private key PEM.

### Response

No response body. Identity rotated.

### Status codes

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

### Using this contract

Read the [source OpenAPI document](https://docs.stateset.com/spec/edi.json) for declared schemas and alternatives.
This page also includes documented corrections from the [spec overlays](https://github.com/stateset/docs/tree/main/spec/overlays).
Example IDs and values are illustrative; replace them with records from your workspace.

```bash cURL theme={null}
curl --silent --show-error --fail-with-body --request POST \
  --url 'https://api.edi.stateset.com/v1/as2/identity' \
  --header "Authorization: Bearer $EDI_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "cert_pem": "string",
  "key_pem": "string"
}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.