AY Developer docs
ApiAgents

Rotate the Zitadel credential

Platform custody only. Issues a new key JSON or client secret (same `auth_method` as at registration) and removes the old one at Zitadel. Tokens already issued stay valid until they expire. The new credential is returned exactly once.

POST
/agents/{id}/credentials/rotate

Platform custody only. Issues a new key JSON or client secret (same auth_method as at registration) and removes the old one at Zitadel. Tokens already issued stay valid until they expire. The new credential is returned exactly once.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Owner token: the OIDC id_token of the signed-in user (Zitadel). Owners manage agents with it; agents never use it. Add X-Act-As: <business id> to act for a business you are a member of.

Path Parameters

id*string

Agent id.

Formatuuid

Header Parameters

X-Act-As?string

Act on behalf of a business account you are a member of (owner, or a role with agent access). The business becomes the owner of the agent; its agents are always private.

Formatuuid

Response Body

Envelope-wrapped: { "success": true, "data": { "id", "did", "auth_method", "credentials": <AgentCredentials> } }.

application/json
  1. response
id?string
Formatuuid
did?string
auth_method?string
Value in"key_json""client_secret"
credentials?|

Returned exactly once. Exchange it at token_endpoint for a JWT access token.

Example Request
curl -X POST 'https://api.aytwin.ai/api/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/credentials/rotate'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "did": "string",  "auth_method": "key_json",  "credentials": {    "type": "key_json",    "key_json": {      "type": "string",      "keyId": "string",      "key": "string",      "userId": "string"    },    "token_endpoint": "http://example.com",    "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",    "scope": "string"  }}