Skip to main content
PUT
/
v1
/
agents
/
{agentId}
/
secrets
/
{key}
Set Secret
curl --request PUT \
  --url https://app.opencomputer.dev/v1/agents/{agentId}/secrets/{key} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "value": "<string>",
  "allowed_hosts": [
    "<string>"
  ]
}
'
{
  "key": "ANTHROPIC_API_KEY",
  "allowed_hosts": ["api.anthropic.com"],
  "set_at": "2026-04-09T10:30:00Z"
}
Set or update a secret on an agent. The first call auto-creates a backing secret store. Values are AES-256-GCM encrypted at rest and never returned via API. CLI equivalent: oc agent create --secret KEY=VALUE (at creation time only)
agentId
string
required
Agent ID
key
string
required
Secret key name
value
string
required
Secret value
allowed_hosts
string[]
Restrict which outbound hosts can receive the decrypted value
{
  "key": "ANTHROPIC_API_KEY",
  "allowed_hosts": ["api.anthropic.com"],
  "set_at": "2026-04-09T10:30:00Z"
}