{
  "info": {
    "name": "cms-ai-forge",
    "_postman_id": "b3f9c1a2-4d6e-47a8-9c11-cms-ai-forge0001",
    "description": "Import-and-run collection for the cms-ai-forge control plane (epic AISD-148). One POST /jobs request per intent with a realistic example spec, plus GET /jobs/{{job_id}} and the operator task-retry endpoint.\n\nWARNING: Against a deployed environment (stage/prd) providers generate FOR REAL by default -- real content, images, logo, and favicon. Real jobs REQUIRE an account_id (3468 on stage) and COST MONEY. Set FORGE_PROVIDER_STUBS=1 on the service for a no-cost deterministic run. content_refresh is normally fired by Celery beat on a schedule; the request here is a manual one-off.\n\nVariables default to the stage host and the FRDEV dev site (site_id 207, account_id 3468). job_id is captured automatically by each POST /jobs test script.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://cms-ai-forge-stg.skyneto.com",
      "type": "string"
    },
    {
      "key": "site",
      "value": "FRDEV",
      "type": "string"
    },
    {
      "key": "site_id",
      "value": "207",
      "type": "string"
    },
    {
      "key": "account_id",
      "value": "3468",
      "type": "string"
    },
    {
      "key": "author_id",
      "value": "1",
      "type": "string"
    },
    {
      "key": "job_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "task_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "control_plane_token",
      "value": "",
      "type": "string"
    },
    {
      "key": "regenerated_job_id",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Health",
      "item": [
        {
          "name": "GET /api/status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/api/status",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "status"
              ]
            },
            "description": "Health probe: DB + broker reachability. Always returns 200."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Jobs by intent",
      "item": [
        {
          "name": "POST /jobs - site_scaffold",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Generate a site's renderable shell in dependency order (settings -> logo -> taxonomy -> style -> template -> page_type). Real logo image + settings/taxonomy text; needs account_id. style/template ASSIGN an existing style/template.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"site_scaffold\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"domain\": \"frdev.wantskicks.com\",\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"categories\": [\"Releases\", \"Guides\", \"Trends\", \"Reviews\"],\n    \"style_slug\": \"default\",\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - article_batch",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Fill a scaffolded shell with content: categories x articles_per_category article tasks (capped 50), each fanning out featured/inline image children. Real text + images; needs account_id. images_per_article is capped by the generator (featured <= 1, inline <= 4).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"article_batch\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}},\n    \"categories\": [\"Releases\", \"Guides\"],\n    \"articles_per_category\": 2,\n    \"topic_seed\": \"2026 spring sneaker trends\",\n    \"images_per_article\": { \"featured\": 1, \"inline\": 3 }\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - single_article",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Generate exactly one article (on-demand). Real text + images; needs account_id. source defaults to ai_generate.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"single_article\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}},\n    \"category\": \"Releases\"\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - wp_import",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Import existing WordPress posts (WordPress -> CMS). One article task per entry in spec.posts (capped 50). Images carry source_url and are FETCHED, not generated, so no text account_id is needed.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"wp_import\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"posts\": [1234, 1235, \"some-post-slug\"]\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - cms_copy",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Copy content between CMS sites (CMS -> CMS). One article task per entry in spec.sources (capped 50); each source read via GET /admin/v1/content/{id}, images fetched by source_url.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"cms_copy\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"sources\": [98, 99, 100]\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - seo_enrich",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Phase 4. Populate SEO/OpenGraph/canonical/schema metadata on EXISTING published rows that are missing it. The planner discovers the rows (list_content, capped 50) -- no per-row input. Real text; needs account_id. canonical_url is re-derived from the existing title.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"seo_enrich\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - settings_tune",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Phase 4 (deterministic, no AI calls). Derive navigation from the site's REAL cms-api taxonomy (fixes the hardcoded-default-nav bug) and apply ads_txt / robots_txt / default_og_image ONLY when supplied (verbatim passthrough). No account_id needed.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"settings_tune\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"ads_txt\": \"google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0\",\n    \"robots_txt\": \"User-agent: *\\nAllow: /\\nSitemap: https://frdev.wantskicks.com/sitemap.xml\"\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - content_refresh (manual one-off)",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Phase 4. Normally NOT posted by hand -- a Celery-beat task fires it on a schedule (FORGE_CONTENT_REFRESH_* env). Expands exactly like article_batch, so the content_ledger + (site_id, slug) dedup make each tick idempotent. This request is a manual one-off refresh. Real text + images; needs account_id.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"content_refresh\",\n  \"defaults\": { \"publish_status\": \"draft\", \"author_id\": {{author_id}} },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}},\n    \"categories\": [\"Releases\"],\n    \"articles_per_category\": 1\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - wp_site_import",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Import a WHOLE WordPress site (AISD-250). Discovery pages the WP REST API; a job plans one 50-task window and queues a continuation job carrying spec.pending_posts. Prefer POST /migrate_from_wp, which builds this spec for you.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"wp_site_import\",\n  \"defaults\": {\n    \"publish_status\": \"draft\",\n    \"author_id\": {{author_id}}\n  },\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"wp_base_url\": \"https://wantskicks.com\",\n    \"type\": \"editorial\",\n    \"max_posts\": 20\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - template_variant",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Assign an existing curated template_styles pairing to the site (AISD-153). No CSS/HTML generation, no block-override writes.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"template_variant\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"template_style_id\": 12\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - page_type_variant",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Add or replace thin page_types rows (AISD-153). Named variants: gallery, long_form, landing. replace=true keeps scaffold home/category/article plus the requested variants and deletes orphans.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"page_type_variant\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"variants\": [\n      \"gallery\",\n      \"landing\"\n    ]\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /migrate_from_wp",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/migrate_from_wp",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "migrate_from_wp"
              ]
            },
            "description": "Submit a whole-site WordPress import by website name (AISD-250). Builds a wp_site_import job: type = editorial (default) | trending | all. Optional: wp_base_url (defaults to https://<website>.com), max_posts, force_refetch, idempotency_key, submitted_by.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"website\": \"wantskicks\",\n  \"type\": \"trending\",\n  \"max_posts\": 20\n}"
            }
          },
          "response": []
        }
      ],
      "description": "One POST /jobs request per intent. Each captures the returned job_id into the collection variable so GET /jobs/{{job_id}} and the retry request target the last-submitted job."
    },
    {
      "name": "Jobs - generate_* granulars",
      "item": [
        {
          "name": "POST /jobs - generate_settings",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Targeted re-run of a single scaffold entity (settings) without the whole chain. Publishes via PATCH /admin/v1/sites/{id}/settings.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_settings\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"domain\": \"frdev.wantskicks.com\",\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - generate_logo",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Targeted re-run of the logo entity. Generates a real horizontal wordmark logo + square monogram favicon via gpt-image (openai_image); needs account_id. Publishes icon_url/default_favicon media paths through upsert_settings.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_logo\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - generate_taxonomy",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Targeted re-run of the taxonomy entity. Publishes via POST /admin/v1/sites/{id}/categories. Real text; needs account_id.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_taxonomy\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"categories\": [\"Releases\", \"Guides\", \"Trends\", \"Reviews\"],\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - generate_style",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Assign an EXISTING style to the site (no model call). Publishes via PATCH .../style (points style_slug at an existing style).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_style\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"style_slug\": \"default\"\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - generate_template",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Assign an EXISTING template to the site (no model call). Publishes via PATCH /admin/v1/sites/{id} (binds Site.template_id).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_template\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"template_id\": -1\n  }\n}"
            }
          },
          "response": []
        },
        {
          "name": "POST /jobs - generate_page_types",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('job_id', body.job_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs"
              ]
            },
            "description": "Targeted re-run of the page_type entity. Publishes via POST /admin/v1/sites/{id}/page-types. Real text; needs account_id.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"site\": \"{{site}}\",\n  \"intent\": \"generate_page_types\",\n  \"spec\": {\n    \"site_id\": {{site_id}},\n    \"site_title\": \"Front Story Dev\",\n    \"niche\": \"sneaker culture\",\n    \"account_id\": {{account_id}}\n  }\n}"
            }
          },
          "response": []
        }
      ],
      "description": "generate_<entity> granulars: targeted re-run of a single scaffold entity without running the whole chain."
    },
    {
      "name": "Job status & control",
      "item": [
        {
          "name": "GET /jobs/{{job_id}}",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('200 ok', function () { pm.expect(pm.response.code).to.eql(200); });",
                  "var body = pm.response.json();",
                  "if (body && body.tasks && body.tasks.length && body.tasks[0].task_id) { pm.collectionVariables.set('task_id', body.tasks[0].task_id); }"
                ]
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}"
              ]
            },
            "description": "Fetch the job + its task tree (state, attempts, result_ref, error per task). Captures the first task_id into task_id for the retry request."
          },
          "response": []
        },
        {
          "name": "GET /jobs/{{job_id}}/events (SSE)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/events",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "events"
              ]
            },
            "description": "Server-Sent-Events stream of generation_events progress rows until the job is terminal. Postman does not render SSE well; use curl for a live tail."
          },
          "response": []
        },
        {
          "name": "POST /jobs/{{job_id}}/tasks/{{task_id}}/retry",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/tasks/{{task_id}}/retry",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "tasks",
                "{{task_id}}",
                "retry"
              ]
            },
            "description": "Operator re-drive: reset a dead/failed task to retrying and re-enqueue it. task_id is captured by the GET /jobs/{{job_id}} request; a non-retryable task returns task_not_retryable."
          },
          "response": []
        },
        {
          "name": "GET /jobs (list)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs?limit=20",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs?limit=20"
              ]
            },
            "description": "List jobs newest-first with per-state task counts. Keyset pagination: pass the returned next_cursor as ?cursor=. Filters: site_id, site_ref, intent, state (repeatable), submitted_by, created_after, created_before, limit."
          },
          "response": []
        },
        {
          "name": "GET /jobs?state=partial (lost work)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs?state=partial&limit=20",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs?state=partial&limit=20"
              ]
            },
            "description": "Jobs that finished WITH failures. failed_tasks on each row is the count that never published -- a partial job looks identical to a done one without it."
          },
          "response": []
        },
        {
          "name": "GET /jobs/{{job_id}}/tasks/{{task_id}}",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/tasks/{{task_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "tasks",
                "{{task_id}}"
              ]
            },
            "description": "One task plus its ordered transition log (reasons verbatim -- this is where a dead-lettered task explains itself), its events, and the registry step that produced it. step is null when the task carries no _step_slug or the registry is unreachable."
          },
          "response": []
        },
        {
          "name": "POST /jobs/{{job_id}}/retry-failed",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/retry-failed",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "retry-failed"
              ]
            },
            "description": "Re-drive every failed/dead task in the job. Reports requeued vs skipped; re-opens a partial/failed job to running when anything was requeued."
          },
          "response": []
        },
        {
          "name": "POST /jobs/{{job_id}}/cancel",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/cancel",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "cancel"
              ]
            },
            "description": "Stop a non-terminal job AND every wp_site_import continuation descending from it. Idempotent: a second cancel reports cancelled=false with the current state rather than erroring."
          },
          "response": []
        },
        {
          "name": "POST /jobs/{{job_id}}/tasks/{{task_id}}/regenerate",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{control_plane_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/tasks/{{task_id}}/regenerate",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "jobs",
                "{{job_id}}",
                "tasks",
                "{{task_id}}",
                "regenerate"
              ]
            },
            "description": "Re-generate a TERMINAL task's entity. Creates a NEW single-entity job (done is terminal by design) and returns its job_id; the original task stays done. Repeating it returns the same job -- the idempotency key is derived from the origin."
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('201 created', function () { pm.expect(pm.response.code).to.eql(201); });",
                  "var body = pm.response.json();",
                  "if (body && body.job_id) { pm.collectionVariables.set('regenerated_job_id', body.job_id); }"
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}
