> ## Documentation Index
> Fetch the complete documentation index at: https://beta-docs-prod.indices.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create secret

> <p>Create a new secret. Credentials are stored securely in 1Password.</p>



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/indices/openapi.documented.yml post /v1beta/secrets
openapi: 3.1.0
info:
  title: Indices API
  description: 'The Indices REST API. See docs for details: https://docs.indices.io'
  version: 0.0.1
servers:
  - url: https://api.indices.io
security:
  - ApiKeyAuth: []
tags:
  - name: Tasks
    description: Create a task to repeatedly perform an action on an external website.
  - name: Runs
    description: Execute a task.
  - name: Secrets
    description: Manage secrets like login credentials and API keys.
paths:
  /v1beta/secrets:
    post:
      tags:
        - Secrets
      summary: Create secret
      description: >-
        <p>Create a new secret. Credentials are stored securely in
        1Password.</p>
      operationId: create_secret_v1beta_secrets_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSecretRequest'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Secret'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Indices from 'indicesio';


            const client = new Indices({
              apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
            });


            const secret = await client.secrets.create({ name: 'name',
            secret_type: 'login' });


            console.log(secret.id);
        - lang: Python
          source: |-
            import os
            from indices import Indices

            client = Indices(
                api_key=os.environ.get("INDICES_API_KEY"),  # This is the default and can be omitted
            )
            secret = client.secrets.create(
                name="name",
                secret_type="login",
            )
            print(secret.id)
components:
  schemas:
    CreateSecretRequest:
      properties:
        name:
          type: string
          description: Human-readable name for the secret.
        secret_type:
          $ref: '#/components/schemas/SecretType'
          description: 'Type of secret: ''login'' for credentials, ''string'' for simple values.'
        username:
          anyOf:
            - type: string
            - type: 'null'
          description: Login username. Required for 'login' type.
        password:
          anyOf:
            - type: string
            - type: 'null'
          description: Login password. Required for 'login' type.
        totp_secret:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional TOTP secret (base32 encoded). Only for 'login' type.
        value:
          anyOf:
            - type: string
            - type: 'null'
          description: Secret value. Required for 'string' type.
        website:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional website URL for context.
      type: object
      required:
        - name
        - secret_type
      title: CreateSecretRequest
    Secret:
      properties:
        id:
          type: string
          description: Unique identifier for the secret.
        name:
          type: string
          description: Human-readable name for the secret.
        secret_type:
          $ref: '#/components/schemas/SecretType'
          description: 'Type of secret: ''login'' or ''string''.'
        website:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional website URL.
        has_totp:
          type: boolean
          description: >-
            Whether the secret has a TOTP configured (only applicable for login
            type).
        created_at:
          type: string
          format: date-time
          description: Timestamp when the secret was created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the secret was last updated.
      type: object
      required:
        - id
        - name
        - secret_type
        - website
        - has_totp
        - created_at
        - updated_at
      title: Secret
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SecretType:
      type: string
      enum:
        - login
        - string
      title: SecretType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Enter your API key as the bearer token. Set header: `Authorization` to
        `Bearer <api_key>`

````