Set a secret

Add a secret, or replace it.

PUT /v1/tenants/{tenant}/secrets/{name}

curl -X PUT "https://api.shako.dev/v1/tenants/acme/secrets/GH_TOKEN" \
  -H "Authorization: Bearer $SHAKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"ghp_...","hosts":["github.com","api.github.com"]}'

200 (excerpt)

{
  "name": "GH_TOKEN",
  "hosts": [
    "github.com",
    "api.github.com"
  ],
  "hint": "x9Qz",
  "updated": 1793491200
}

Authenticate with Authorization: Bearer <API key> on https://api.shako.dev. Role: contributor or owner.

Path parameters

tenantstringrequired
The tenant's name, from GET /v1/tenants.
namestringrequired
The secret's name. It is also the name of the variable in the VMs: A-Z, 0-9 and _, not first a digit, at most 64 characters.

Request body

valuestringrequired
The value, at most 4096 characters. It never goes into a VM.
hostsstring[]required
The hosts that get the value, at most 10. Only the requests to these hosts get it, for example ["github.com", "api.github.com"].

Response

200 with the secret object.

Behavior

Only the headers of the requests to the hosts get the value.

The errors. All the endpoints of Secrets.