> ## 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.

# Admin post handler for creating custom sages

> Admin post handler for initiating custom sage creation from
the admin panel. Checks council credits and redirects to
the sage training workflow or JIT credit purchase page.

Registered as both `admin_post_create_custom_sage` and
`admin_post_nopriv_create_custom_sage` — **public**.




## OpenAPI

````yaml /openapi/private/specs/wp/sage-internal.yml post /wp-admin/admin-post.php?action=create_custom_sage
openapi: 3.1.0
info:
  title: SageScreen — Sage Module
  description: >
    Council sage management. Sages are AI screening assistants customized

    per council. Each council can have system sages (non-customizable,

    auto-attached) and custom sages (built through a multi-step workflow).


    **CPT:** `ss_council_sage`

    **Custom statuses:** `ss_draft`, `ss_building`, `ss_active`, `ss_inactive`,
    `ss_paused`


    ## Build Workflow


    Custom sages go through a 6-step creation workflow:

    1. **Context** — Define role, level, and job description

    2. **Culture** — Configure tone, scoring, intro question, evaluation
    guidelines

    3. **Build** — Automated build via Python service (8 sub-steps)

    4. **Test** — Optional test screen to verify sage behavior

    5. **Finalize** — Review and confirm build

    6. **Deploy** — Set email config and activate sage


    Build sub-steps (step 3) run sequentially in the Python service:

    `starting` → `creating_sage` → `sage_generation` → `test_shu` →

    `test_ha` → `test_ri` → `transcending_training` → `enlightenment`
  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: Sage – REST
    description: REST API endpoints for sage operations and Python callbacks
  - name: Sage – CRUD
    description: AJAX endpoints for sage creation, editing, and status management
  - name: Sage – Build Workflow
    description: AJAX endpoints for the multi-step sage build process
paths:
  /wp-admin/admin-post.php?action=create_custom_sage:
    post:
      tags:
        - Sage – CRUD
      summary: Admin post handler for creating custom sages
      description: |
        Admin post handler for initiating custom sage creation from
        the admin panel. Checks council credits and redirects to
        the sage training workflow or JIT credit purchase page.

        Registered as both `admin_post_create_custom_sage` and
        `admin_post_nopriv_create_custom_sage` — **public**.
      operationId: adminPostCreateCustomSage
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - action
                - council_id
              properties:
                action:
                  type: string
                  const: create_custom_sage
                council_id:
                  type: string
                  format: uuid
                  description: Council UUID
                  examples:
                    - c9d8e7f6-5a4b-3c2d-1e0f-a1b2c3d4e5f6
      responses:
        '302':
          description: |
            Redirect to sage training step 1 (sufficient credits) or
            JIT credit purchase page (insufficient credits).
          headers:
            Location:
              schema:
                type: string
                examples:
                  - /sage-training-step-1
      security: []

````