---
title: "Upsert Secret"
method: PUT
path: "/compute/script/{id}/secrets"
tags: ["Secret"]
---

# Upsert Secret

`PUT /compute/script/{id}/secrets`

## Request

- Base URL: `https://api.bunny.net`
- URL: `https://api.bunny.net/compute/script/{id}/secrets`
- Auth: one of:
  - API key in header `AccessKey`
  - API key in header `Authorization`

## Path parameters

- `id` integer, required

## Request body

- EdgeScriptUpsertSecretModel
  - `Name` string, nullable
  - `Secret` string, nullable

## Response `200`

A new secret was created

- EdgeScriptSecretModel
  - `Id` integer
  - `Name` string, nullable
  - `LastModified` string, date-time

## Other responses

- `204`: The secret with existing name was updated
- `400`: The request validation failed
- `401`: The request authorization failed
- `404`: The script with the requested ID does not exist.
- `500`: Internal Server Error

## Changes

- **2026-08-07** `9b732b27538a`: 2 info
  - the security scope `ScopedApiKey` was added to the endpoint's security scheme `AccessKey`
  - the security scope `ScopedApiKey` was added to the endpoint's security scheme `bearer`

[Operation history](https://skmtc.dev/bunny/apis/bunny-net-compute-api/changes/compute/script/:id/secrets/put.md)

---

[API](https://skmtc.dev/bunny/apis/bunny-net-compute-api.md) - [All operations](https://skmtc.dev/bunny/apis/bunny-net-compute-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bunny/apis/bunny-net-compute-api/revisions/9b167ce43695?raw)
