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

# Add a new secret

> Create a new encrypted secret for use in edge applications.
Secrets are encrypted with AES-256-GCM and can have multiple time-based slots for rotation.



## OpenAPI

````yaml /api-reference/services_documented/fastedge_api.yaml post /fastedge/v1/secrets
openapi: 3.1.0
info:
  title: Gcore OpenAPI – FastEdge API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-07T20:33:46.548242+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - description: Application templates
    name: FastEdge Templates
    x-displayName: Templates
  - description: Client-level settings and limits
    name: FastEdge Clients
    x-displayName: Clients
  - description: >-
      Apps are descriptions of edge apps, that reference the binary and may
      contain app-specific settings, such as environment variables.
    name: Apps
    x-displayName: Apps
  - description: >-
      Binaries are WebAssembly executables that are actually executed when app
      is ran.
    name: Binaries
    x-displayName: Binaries
  - description: Statistics of edge app use
    name: Stats
    x-displayName: Stats
  - description: Secret values that can be used in apps
    name: FastEdge Secrets
    x-displayName: Secrets
  - description: Key-value edge storage for apps
    name: Edge Storage
    x-displayName: Edge Storage
paths:
  /fastedge/v1/secrets:
    post:
      tags:
        - FastEdge Secrets
      summary: Add a new secret
      description: >-
        Create a new encrypted secret for use in edge applications.

        Secrets are encrypted with AES-256-GCM and can have multiple time-based
        slots for rotation.
      operationId: addSecret
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/secret'
                - required:
                    - name
        description: Secret details
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/secret'
                  - properties:
                      id:
                        type: integer
                        format: int64
                        description: The unique identifier of the secret.
                    type: object
          description: Secret created successfully, returns secret metadata with unique ID
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
          description: Bad request
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
          description: Service unavailable
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            secret = client.fastedge.secrets.create(
                name="name",
            )
            print(secret)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/fastedge\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tsecret, err := client.Fastedge.Secrets.New(context.TODO(), fastedge.SecretNewParams{\n\t\tSecret: fastedge.SecretParam{\n\t\t\tName: gcore.String(\"name\"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", secret)\n}\n"
components:
  schemas:
    secret:
      type: object
      properties:
        name:
          type: string
          description: The unique name of the secret.
          minLength: 1
          maxLength: 128
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]*[a-zA-Z0-9]$
        comment:
          type: string
          description: A description or comment about the secret.
          maxLength: 1024
        app_count:
          type: integer
          format: int
          description: The number of applications that use this secret.
          readOnly: true
        secret_slots:
          type: array
          description: A list of secret slots associated with this secret.
          items:
            $ref: '#/components/schemas/secret_slot'
          x-stainless-collection-type: set
    error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
    secret_slot:
      type: object
      properties:
        slot:
          type: integer
          format: int64
          description: >-
            Unix timestamp (seconds since epoch) indicating when this secret
            version becomes active. Use for time-based secret rotation.
          example: 1704067200
        value:
          type: string
          description: >-
            The plaintext secret value. Will be encrypted with AES-256-GCM
            before storage.
          writeOnly: true
          maxLength: 4096
          example: P@ssw0rd123!
        checksum:
          type: string
          description: >-
            SHA-256 hash of the decrypted value for integrity verification
            (auto-generated)
          readOnly: true
          example: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
      required:
        - slot
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````