---
title: "Create or replace a secret set"
description: "Stores the complete secret set: keys omitted from values are deleted."
canonical: "https://www.cool.computer/docs/api-reference/secrets/create-or-replace-a-secret-set"
---
# Create or replace a secret set

> Stores the complete secret set: keys omitted from values are deleted.

```http
PUT https://api.cool.computer/api/secrets/{secret_set}
```

Stores the complete secret set: keys omitted from values are deleted. Values are write-only and never returned. A key listed in deliveries with delivery proxy is injected by the egress proxy into requests to its target host instead of being exposed to the computer. A value shaped like a Cool Computers credential (an API key, a user, agent or MCP access token, a session token, or a computer's own runtime token) is refused with 400, naming the key but never the value, and nothing is stored. Callers: an account bearer (API key or access token).

## Authorization

- A Cool Computers API key, user access token, or claimed agent access token in the Authorization header. Follow https://www.cool.computer/auth.md for agent registration and https://www.cool.computer/authentication.md for direct user credentials.

## Parameters

- `secret_set` (path, string, pattern `^[a-z0-9][a-z0-9:_-]{0,62}$`, required): The secret set's name.

## Request body

Required.

- `application/json` (object)
  - `values` (object, required): Every key of the set with its value; keys omitted here are deleted.
    - `*` (string): Each value, under a name of the caller's.
  - `deliveries` (object): Optional delivery per key; a key without one is delivered as an environment variable.
    - `*` (object): Each value, under a name of the caller's.
      - `delivery` ("env" or "proxy", required): env puts the value in the computer's environment; proxy injects it into matching outbound requests and never reveals it to the computer.
      - `stand_in_id` (string, pattern `^[0-9a-f]{32}$`): Stable stand-in identity, returned only for proxy keys.
      - `target_host` (string)
      - `header` (string)
      - `scheme` (string)
      - `methods` (array of string)
      - `paths` (array of string)

## Responses

- `200`: The saved secret set, key names and delivery metadata only.
  - `application/json` (object)
    - `state` ("pending" or "invalid"): Pending while host acknowledgement finishes; invalid in lists when stored metadata needs complete replacement or deletion.
    - `id` (integer, required)
    - `name` (string, required)
    - `keys` (array of string, required)
    - `deliveries` (object, required): Delivery metadata by key name.
      - `*` (object): Each value, under a name of the caller's.
        - `delivery` ("env" or "proxy", required): env puts the value in the computer's environment; proxy injects it into matching outbound requests and never reveals it to the computer.
        - `stand_in_id` (string, pattern `^[0-9a-f]{32}$`): Stable stand-in identity, returned only for proxy keys.
        - `target_host` (string)
        - `header` (string)
        - `scheme` (string)
        - `methods` (array of string)
        - `paths` (array of string)
    - `created_at` (string, date-time, required)
    - `updated_at` (string, date-time, required)
- `202`: The change committed; host acknowledgement is pending and finishes automatically. The response includes state: pending.
  - `application/json` (object)
    - `state` ("pending" or "invalid"): Pending while host acknowledgement finishes; invalid in lists when stored metadata needs complete replacement or deletion.
    - `id` (integer, required)
    - `name` (string, required)
    - `keys` (array of string, required)
    - `deliveries` (object, required): Delivery metadata by key name.
      - `*` (object): Each value, under a name of the caller's.
        - `delivery` ("env" or "proxy", required): env puts the value in the computer's environment; proxy injects it into matching outbound requests and never reveals it to the computer.
        - `stand_in_id` (string, pattern `^[0-9a-f]{32}$`): Stable stand-in identity, returned only for proxy keys.
        - `target_host` (string)
        - `header` (string)
        - `scheme` (string)
        - `methods` (array of string)
        - `paths` (array of string)
    - `created_at` (string, date-time, required)
    - `updated_at` (string, date-time, required)
- `400`: Bad Request.
- `401`: Unauthorized.
- `409`: Conflict.
- `413`: Payload Too Large.
- `429`: Too Many Requests. If the problem code is api_request_rate_exceeded, wait for Retry-After seconds; other problem codes describe a separate limit.
- `500`: Internal Server Error.
- `503`: Service Unavailable.
- `default`: A machine-readable API error with a stable code and recovery instruction.

An error is an `application/problem+json` document with a stable `code`; [API errors](/docs/api-reference/errors) says how to handle one.

## Example

```sh
curl -X PUT "https://api.cool.computer/api/secrets/$PARAM_SECRET_SET" \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  --data '{"values":{"STRIPE_KEY":"sk_live_..."}}'
```
