---
title: "Create or update a secret key"
method: POST
path: "/v1/apps/{app_name}/secretkeys/{secret_name}"
tags: ["Secrets"]
---

# Create or update a secret key

`POST /v1/apps/{app_name}/secretkeys/{secret_name}`

## Request

- Base URL: `https://api.machines.dev`
- URL: `https://api.machines.dev/v1/apps/{app_name}/secretkeys/{secret_name}`
- Auth: HTTP bearer

## Path parameters

- `app_name` string, required
- `secret_name` string, required

## Request body

- SetSecretkeyRequest
  - `type` string
  - `value` integer[]

## Response `201`

Created

- SetSecretkeyResponse
  - `Version` integer: DEPRECATED
  - `created_at` string
  - `name` string
  - `public_key` integer[]
  - `type` string
  - `updated_at` string
  - `version` integer

## Other responses

- `400`: Bad Request

## Changes

- **2026-09-01** `fc09da744e5d`: 1 warning
  - added the new `volume_placement_capacity` enum value to the `status` response property for the response status `400`
- **2026-08-20** `9e6a180c40a3`: 1 warning
  - added the new `name_taken` enum value to the `status` response property for the response status `400`
- **2026-08-12** `f54480c4ce7f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/machines/apis/machines-api/changes/v1/apps/:app_name/secretkeys/:secret_name/post.md)

---

[API](https://skmtc.dev/machines/apis/machines-api.md) - [All operations](https://skmtc.dev/machines/apis/machines-api/llms.txt) - [OpenAPI document](https://skmtc.dev/machines/apis/machines-api/revisions/0e800519539e?raw)
