---
title: "Create Secret"
method: POST
path: "/api/v1/secrets/"
tags: ["Secrets"]
---

# Create Secret

`POST /api/v1/secrets/`

Create a new global secret.

The secret will be encrypted and stored securely. If teamId is provided,
the secret will be associated with that team (requires team membership).

## Request body

- SecretCreateRequest
  - `name` string, required — Name of the secret (must start with uppercase, only uppercase, numbers, underscores)
  - `description` string, nullable — Optional description of the secret
  - `value` string, required — The secret value to store (will be encrypted)
  - `teamId` string, nullable — Optional team ID for team-level secrets
  - `isFile` boolean — Whether this secret represents a file (max 64KB base64 encoded)

## Response `200`

Successful Response

- GenericResponseSecretResponse
  - `data` SecretResponse
    - `id` string, required — Unique identifier of the secret
    - `name` string, required — Name of the secret
    - `description` string, nullable — Description of the secret
    - `isFile` boolean — Whether this secret is a file
    - `userId` string, nullable — ID of the owning user
    - `teamId` string, nullable — ID of the owning team
    - `createdAt` string, date-time, required — When the secret was created
    - `updatedAt` string, date-time, required — When the secret was last updated
  - `status` string, nullable — Response status

## Other responses

- `401` — Authorization failed
- `422` — Invalid request data

---

[API](https://skmtc.net/primeintellect/apis/pi-api.md) · [All operations](https://skmtc.net/primeintellect/apis/pi-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/primeintellect/pi-api/revisions/3d3868828a78/schema)
