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

# Create a new secret

`POST /secrets`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/secrets`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/secrets/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new secret in SecureStore.

## Request body

- object
  - `secret_id` string, required: The ID (name) of the secret
  - `secret_value` object, required: The secret data
  - `secret_type` 's3' | 'gcs' | 'azure_key' | 'azure_sas': The type of the secret (e.g., s3, gcs, azure_blob)

## Response `201`

Secret created successfully

- object
  - `id` string: The ID of the created secret

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `403`: Forbidden
- `409`: Conflict
- `500`: Internal server error
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
