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

# Generate or clear a demo key for a sage

> Generates a unique 16-character hex demo key for the given sage
(creating the `/screen/demo/{key}` URL), or clears an existing
key. If `action_type` is `clear`, deletes the key. Otherwise
toggles: generates if none exists, clears if one does.

Requires `ss_admin_all` or `power_user` capability.




## OpenAPI

````yaml /openapi/private/specs/wp/wp-ajax-misc.yml post /wp-admin/admin-ajax.php?action=sagescreen_toggle_demo_key
openapi: 3.1.0
info:
  title: SageScreen — Misc AJAX Modules (User · Council · Billing · Splash · Demo)
  version: 1.0.0
servers:
  - url: https://{domain}/wp-json/sagescreen/v1
    description: WordPress REST API
    variables:
      domain:
        default: api.sagescreen.app
security: []
tags:
  - name: User – REST
    description: Zapier-facing REST endpoints
  - name: User – AJAX
    description: Council user management AJAX endpoints
  - name: User – Profile
    description: Self-service profile updates
  - name: Council – REST
    description: Zapier-facing REST endpoints for council data sync
  - name: Council – AJAX
    description: Council user and sage management AJAX endpoints
  - name: Billing – Stripe
    description: Stripe webhook and subscription endpoints
  - name: Billing – Broadcast
    description: Postmark broadcast unsubscribe endpoint
  - name: Billing – Pipedrive
    description: Pipedrive CRM ID set-* webhook endpoints (called by Zapier)
  - name: Billing – AJAX
    description: Credit ledger, reactivation, and portal AJAX endpoints
  - name: Splash
    description: Splash banner AJAX endpoints
  - name: Demo
    description: Demo signup and management AJAX endpoints
  - name: CSV Upload
    description: Bulk candidate CSV upload
paths:
  /wp-admin/admin-ajax.php?action=sagescreen_toggle_demo_key:
    post:
      tags:
        - Demo
      summary: Generate or clear a demo key for a sage
      description: |
        Generates a unique 16-character hex demo key for the given sage
        (creating the `/screen/demo/{key}` URL), or clears an existing
        key. If `action_type` is `clear`, deletes the key. Otherwise
        toggles: generates if none exists, clears if one does.

        Requires `ss_admin_all` or `power_user` capability.
      operationId: ajaxToggleDemoKey
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ToggleDemoKeyRequest'
      responses:
        '200':
          description: Toggle result
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ToggleDemoKeySuccess'
                  - $ref: '#/components/schemas/DemoInternalAjaxErrorResponse'
              examples:
                generated:
                  summary: New key generated
                  value:
                    success: true
                    message: Demo key generated
                    demo_key: a1b2c3d4e5f67890
                    demo_url: https://api.sagescreen.app/screen/demo/a1b2c3d4e5f67890
                cleared:
                  summary: Key cleared
                  value:
                    success: true
                    message: Demo key cleared
                    demo_key: ''
                    demo_url: ''
                noPermission:
                  summary: Insufficient permissions
                  value:
                    success: false
                    message: Insufficient permissions to manage demo keys
                invalidSage:
                  summary: Sage not found
                  value:
                    success: false
                    message: Invalid sage
      security:
        - wpAjaxNonce: []
components:
  schemas:
    ToggleDemoKeyRequest:
      type: object
      required:
        - action
        - nonce
        - sage_id
      properties:
        action:
          type: string
          const: sagescreen_toggle_demo_key
        nonce:
          type: string
          description: WP nonce for `sagescreen_admin_nonce` or `sagescreen_frontend_nonce`
        sage_id:
          type: integer
          description: Post ID of `ss_council_sage`
          examples:
            - 101
        action_type:
          type: string
          enum:
            - toggle
            - clear
          description: '''clear'' to delete key, ''toggle'' (default) to generate or clear'
          examples:
            - toggle
    ToggleDemoKeySuccess:
      type: object
      properties:
        success:
          type: boolean
          const: true
        message:
          type: string
          examples:
            - Demo key generated
        demo_key:
          type: string
          description: 16-char hex key or empty string
          examples:
            - a1b2c3d4e5f67890
        demo_url:
          type: string
          description: Full demo URL or empty string
          examples:
            - https://api.sagescreen.app/screen/demo/a1b2c3d4e5f67890
    DemoInternalAjaxErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
          examples:
            - Invalid security token
  securitySchemes:
    wpAjaxNonce:
      type: apiKey
      in: query
      name: nonce
      description: WordPress AJAX nonce (passed as form field, verified per-action)

````