---
title: "updateSecret"
---

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

# updateSecret

Path: agenthold API › secrets

`PATCH /secrets/{secretId}`

URL: `/api/v1/secrets/{secretId}`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `secretId` (`updateSecret.path.secretId`; string, required)

## Request body

_Required._

- `name` (`updateSecret.name`; string, optional)
  - maxLength: `100` · minLength: `1`
- `value` (`updateSecret.value`; string, optional)
  - minLength: `1`
- `rule` (`updateSecret.rule`; object, optional)
  - `hosts` (`updateSecret.rule.hosts`; array of string, required) — Exact host names or "*.example.com".
  - `header` (`updateSecret.rule.header`; string, required)
  - `template` (`updateSecret.rule.template`; string, required) — Header value; {{.Value}} is the secret. Function: base64.

## Example request

```json
{
  "name": "string",
  "value": "string",
  "rule": {
    "hosts": [
      "string"
    ],
    "header": "string",
    "template": "string"
  }
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url '<base-url>/api/v1/secrets/<secretId>' \
  --header 'Content-Type: application/json' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data '
{
  "name": "string",
  "value": "string",
  "rule": {
    "hosts": [
      "string"
    ],
    "header": "string",
    "template": "string"
  }
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/secrets/<secretId>';
const options = {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: JSON.stringify({
    name: 'string',
    value: 'string',
    rule: {hosts: ['string'], header: 'string', template: 'string'}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/secrets/<secretId>"

payload = {
    "name": "string",
    "value": "string",
    "rule": {
        "hosts": ["string"],
        "header": "string",
        "template": "string"
    }
}
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Updated.

#### Example

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "rule": {
    "hosts": [
      "string"
    ],
    "header": "string",
    "template": "string"
  },
  "placeholder": "string",
  "owner": {
    "id": "string",
    "email": "string",
    "name": "string",
    "avatarUrl": "string"
  },
  "canManage": true,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
```

- `id` (`updateSecret.response.200.id`; string, required)
- `workspaceId` (`updateSecret.response.200.workspaceId`; string, required)
- `name` (`updateSecret.response.200.name`; string, required)
- `rule` (`updateSecret.response.200.rule`; object, required)
  - `hosts` (`updateSecret.response.200.rule.hosts`; array of string, required) — Exact host names or "*.example.com".
  - `header` (`updateSecret.response.200.rule.header`; string, required)
  - `template` (`updateSecret.response.200.rule.template`; string, required) — Header value; {{.Value}} is the secret. Function: base64.
- `placeholder` (`updateSecret.response.200.placeholder`; string, required) — What sandboxes see instead of the value.
- `owner` (`updateSecret.response.200.owner`; object, required)
  - `id` (`updateSecret.response.200.owner.id`; string, required)
  - `email` (`updateSecret.response.200.owner.email`; string, required)
  - `name` (`updateSecret.response.200.owner.name`; string, required)
  - `avatarUrl` (`updateSecret.response.200.owner.avatarUrl`; string, required)
- `canManage` (`updateSecret.response.200.canManage`; boolean, required)
- `createdAt` (`updateSecret.response.200.createdAt`; string, required)
  - format: `date-time`
- `updatedAt` (`updateSecret.response.200.updatedAt`; string, required)
  - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSecret.response.400.error`; string, required)

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSecret.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSecret.response.404.error`; string, required)


Source: https://agenthold.dev/api/secrets/update/index.md
