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

# Set an app secret

> Declare a secret and set the app’s value. The platform injects the value into the app’s outbound HTTPS requests to the hosts its routes name; app code never holds it. The running app uses it from its next request. Other secrets are unchanged. Requires `build`; safe to repeat.

Alpha: this operation may change or be removed without notice.



## OpenAPI

````yaml /openapi.json put /apps/secrets/{name}
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.effectiveai.app/api/v2
    description: Production
security:
  - bearerAuth: []
paths:
  /apps/secrets/{name}:
    put:
      tags:
        - Apps
      summary: Set an app secret
      description: >-
        Declare a secret and set the app’s value. The platform injects the value
        into the app’s outbound HTTPS requests to the hosts its routes name; app
        code never holds it. The running app uses it from its next request.
        Other secrets are unchanged. Requires `build`; safe to repeat.


        Alpha: this operation may change or be removed without notice.
      operationId: setAppSecret
      parameters:
        - schema:
            type: string
            pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$
            description: >-
              Secret name: letters, digits, `_`, `.` and `-`, starting with a
              letter or digit, at most 100 characters.
          required: true
          description: >-
            Secret name: letters, digits, `_`, `.` and `-`, starting with a
            letter or digit, at most 100 characters.
          name: name
          in: path
        - schema:
            type: string
            maxLength: 63
            pattern: ^app-[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$
            description: The app the secrets belong to.
          required: true
          description: The app the secrets belong to.
          name: appId
          in: query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V2AppSecretSet'
      responses:
        '200':
          description: The secret, without its value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AppSecret'
        '400':
          description: Invalid configuration.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: App permission or secret reference denied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: App or capability not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '409':
          description: The app’s secrets kept changing; retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '413':
          description: JSON request body exceeds 64 KiB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '503':
          description: Configuration unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2AppSecretSet:
      type: object
      properties:
        routes:
          type: array
          items:
            $ref: '#/components/schemas/V2AppSecretRoute'
          minItems: 1
          maxItems: 50
          description: >-
            HTTPS injection destinations. A reference cannot widen the
            credential’s destinations.
        value:
          type: string
          minLength: 1
          maxLength: 16000
          description: Write-only replacement value. Mutually exclusive with secretId.
        secretId:
          type: string
          nullable: true
          format: uuid
          description: >-
            Authorized app/shared network secret. Null clears the default; omit
            both value and secretId to preserve it.
      required:
        - routes
      additionalProperties: false
      description: >-
        Routes, and a write-only `value` or the `secretId` of a workspace secret
        you may use. Omit both to keep the current value and change only the
        routes; a null `secretId` clears it.
    V2AppSecret:
      type: object
      properties:
        name:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$
          description: Secret name, unique within the app.
        routes:
          type: array
          items:
            $ref: '#/components/schemas/V2AppSecretRouteView'
          description: Where the app’s outbound HTTPS requests carry the value.
        configured:
          type: boolean
          description: True when the app has a value for the secret.
        secretId:
          type: string
          nullable: true
          format: uuid
          description: >-
            The workspace secret the value comes from, or null for a value set
            here.
        updatedAt:
          type: string
          format: date-time
          description: When the secret last changed.
      required:
        - name
        - routes
        - configured
        - secretId
        - updatedAt
      additionalProperties: false
    V2CodedError:
      allOf:
        - $ref: '#/components/schemas/V2Error'
        - type: object
          properties:
            code:
              type: string
              minLength: 1
              description: Stable error code. Clients must tolerate unknown future codes.
            details:
              type: array
              items:
                type: object
                properties:
                  location:
                    type: string
                    enum:
                      - path
                      - query
                      - header
                      - body
                  path:
                    type: array
                    items:
                      type: string
                      maxLength: 64
                    maxItems: 12
                  code:
                    type: string
                    enum:
                      - required
                      - invalid_type
                      - invalid_value
                      - unknown_field
                  message:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - location
                  - path
                  - code
                  - message
              minItems: 1
              maxItems: 20
              description: Bounded safe validation issues; may omit some invalid fields.
            requestId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                Existing server correlation for this HTTP attempt, when
                available.
            dataset:
              type: string
              enum:
                - naic
                - osha
              description: Dataset needed for dataset_not_enabled.
            businessCode:
              type: string
              description: The rater’s own refusal code, for business_rejection.
            violations:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: Authored or built-in constraint code
                  message:
                    type: string
                    description: Authored message for the failed constraint
                  path:
                    type: string
                    description: Input path of the offending value; empty for the request
                  value:
                    nullable: true
                    description: Offending input value, size-bounded by the runtime
                  constraint:
                    type: string
                    description: The constraint the value failed, as text
                  cite:
                    type: string
                    nullable: true
                    description: >-
                      Filing citation of the constraint, when the source cites
                      one
                required:
                  - code
                  - message
                  - path
                  - value
                  - constraint
                  - cite
                additionalProperties: false
              maxItems: 256
              description: >-
                Each input constraint the submission failed, for invalid_inputs
                and business_rejection.
            violationsTruncated:
              type: boolean
              description: >-
                True when the rater reported more violations than violations
                holds.
            executionId:
              type: string
              description: >-
                The recorded execution of a failed rating, for rater rating
                failures.
            accessUrl:
              type: string
              nullable: true
              format: uri
              description: Not currently returned.
          required:
            - code
    V2AppSecretRoute:
      type: object
      properties:
        host:
          type: string
          minLength: 1
          maxLength: 253
          pattern: ^[a-z0-9.-]+$
        port:
          type: integer
          minimum: 1
          maximum: 65535
          default: 443
        headerName:
          type: string
          minLength: 1
          maxLength: 128
          pattern: ^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$
          default: Authorization
        scheme:
          type: string
          nullable: true
          minLength: 1
          maxLength: 128
          pattern: ^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$
          default: null
        valueTemplate:
          type: string
          nullable: true
          minLength: 1
          maxLength: 256
          default: null
      required:
        - host
      additionalProperties: false
    V2AppSecretRouteView:
      allOf:
        - $ref: '#/components/schemas/V2AppSecretRoute'
        - type: object
          properties:
            port:
              type: integer
              minimum: 1
              maximum: 65535
            headerName:
              type: string
              minLength: 1
              maxLength: 128
              pattern: ^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$
            scheme:
              type: string
              nullable: true
              minLength: 1
              maxLength: 128
              pattern: ^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$
            valueTemplate:
              type: string
              nullable: true
              minLength: 1
              maxLength: 256
          required:
            - port
            - headerName
            - scheme
            - valueTemplate
          additionalProperties: false
    V2Error:
      type: object
      properties:
        error:
          type: string
          minLength: 1
          description: Human-readable explanation of the failure.
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.