---
title: "Create secret"
method: POST
path: "/v1beta/secrets"
tags: ["Secrets"]
---

# Create secret

`POST /v1beta/secrets`

## Request

- Base URL: `https://api.indices.io`
- URL: `https://api.indices.io/v1beta/secrets`
- Auth: HTTP bearer

Create a new secret. Credentials are stored securely in 1Password.

## Request body

- CreateSecretRequest
  - `name` string, required: Human-readable name for the secret.
  - `secret_type` 'login' | 'string', required
  - `username` string, nullable: Login username. Required for 'login' type.
  - `password` string, nullable: Login password. Required for 'login' type.
  - `totp_secret` string, nullable: Optional TOTP secret (base32 encoded). Only for 'login' type.
  - `value` string, nullable: Secret value. Required for 'string' type.

## Response `200`

Successful response

- Secret
  - `id` string, required: Unique identifier for the secret.
  - `name` string, required: Human-readable name for the secret.
  - `secret_type` 'login' | 'string', required
  - `has_totp` boolean, required: Whether the secret has a TOTP configured (only applicable for login type).
  - `created_at` string, date-time, required: Timestamp when the secret was created.
  - `updated_at` string, date-time, required: Timestamp when the secret was last updated.

## Other responses

- `422`: Validation error

---

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