---
# @generated by sylphx-gen. Do not edit.
title: "Update egress credentials on a lease"
description: "`sandboxes.leases.update_egress_credentials` (POST /v1/{name}:updateEgressCredentials): Atomically adds and removes bindings on a running proxy-backed lease, without restarting the guest."
type: reference
product: sandboxes
summary: "Atomically adds and removes bindings on a running proxy-backed lease, without restarting the guest."
nav: false
---

Atomically adds and removes bindings on a running proxy-backed lease, without restarting the guest. The proxy uses the new revision for all subsequent substitutions. This never changes the lease's network policy.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:updateEgressCredentials`
- **Scope** `sandboxes:write`
- **Effect** `write` — a successful call changes state.
- **Collection** [leases](/docs/api/leases)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | The running lease, originally created with the credential proxy enabled. Required. |
| `expected_revision` | `int64` | Revision from the previous call; 0 is the revision at creation. Required when changing bindings. Omit it and both change lists to read the revision. |
| `add` | `EgressCredentialBinding[]` | New bindings. Requires secrets:access on each named SecretVersion. |
| `remove_sentinels` | `string[]` | Sentinels to revoke, not secret values. To change a binding, remove its sentinel and add a new binding in the same call. |

### EgressCredentialBinding

| Field | Type | What it is |
| --- | --- | --- |
| `sentinel` | `string` | Opaque placeholder, unique within the lease. Supply it to the guest in its ordinary environment or application configuration, not as a secret. Required. |
| `allowed_hosts` | `string[]` | Exact DNS names or one leading wildcard label, such as `*.example.com`. A wildcard matches exactly one label, not the apex or nested names. List the apex explicitly if needed. IP literals are refused. Required. |
| `allowed_ports` | `int32[]` | Approved HTTPS ports. Empty means 443. |
| `secret_version` | `string` | SecretVersion resource name in the lease's org, project and environment. Required. Never returned again. |
| `header` | `string` | Case-insensitive HTTP header name. One of the `target` group. |
| `query_param` | `string` | Case-sensitive query parameter name. One of the `target` group. |
| `request_body` | `bool` | Replace literal placeholder bytes in an uncompressed request body; the proxy recalculates its length. Set to true to select this target. One of the `target` group. |
| `expire_time` | `timestamp` | Required absolute cutoff for substitution. A request at or after this instant, after removal, or after the underlying authority is revoked is refused. Renewal never extends a binding's lifetime. Required. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `revision` | `int64` | The committed revision, initially zero. Output only. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.
- [`ETAG_MISMATCH`](/docs/api/errors/ETAG_MISMATCH) — The etag sent does not match the Resource's current etag.
- [`UNAVAILABLE`](/docs/api/errors/UNAVAILABLE) — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:updateEgressCredentials" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**TypeScript**

```ts
const response = await sylphx.sandboxes.leases.updateEgressCredentials({ name: 'orgs/acme/projects/shop/envs/production/leases/lease' })
```

**Rust**

```rust
let mut req = sylphx::sandboxes::UpdateLeaseEgressCredentialsRequest::default();
req.name = "orgs/acme/projects/shop/envs/production/leases/lease".to_string();
let response = sx.sandboxes().leases().update_egress_credentials(req).await?;
```

**CLI**

```bash
sylphx sandboxes leases update-egress-credentials orgs/acme/projects/shop/envs/production/leases/lease
```

**MCP**

```json
{ "method_id": "sandboxes.leases.update_egress_credentials", "args": {"name":"orgs/acme/projects/shop/envs/production/leases/lease"} }
```
