Skip to main content

One endpoint to rule them all

The Optimize and Deploy API lets you run a multi-stage pipeline that audits your pages, optimizes their content for AI search visibility, and optionally deploys the results to AXP β€” all from a single API call. One endpoint to bind your audit, optimization, and deployment workflows together. Each pipeline is asynchronous. You submit URLs, receive tracking tokens, and then poll for status or receive webhook callbacks as each stage completes.
The Optimize and Deploy API is currently in early access and available on request. Contact your Customer Success representative to get access enabled for your organization.

How it works

The pipeline chains three Scrunch products together. Each stage is optional β€” use only what you need.
ProductPipeline stageWhat it doesRequired?
Site AuditauditEvaluates AI discoverability: robots.txt, bot access, content quality, content deliveryAlways runs
Content OptimizeroptimizingRewrites page content to improve AI visibility for target prompts and personasSet optimize: true
AXP (stage)optimizingStages optimized content to AXP for review without publishing liveSet stage_axp: true + site_id
AXP (deploy)deployingPublishes optimized content to your AXP site as a new versionSet deploy_axp: true + site_id

Configuration per product

Each product in the pipeline has its own configuration:
  • Site Audit β€” runs automatically on each URL, no extra config needed
  • Content Optimizer β€” optionally configure target_prompts, target_personas, target_sources, override_suggestions, and per-URL custom_instructions
  • AXP β€” requires a site_id (the RegisteredSite ULID). All URLs must belong to the site’s domain. Per-URL retain_schema_types controls which JSON-LD schema types are kept (omit to retain all)

Pipeline stages

Every URL you submit moves through these stages in order:
Stageorchestration_statusWhat happens
AuditauditPage is fetched and evaluated for AI discoverability (robots.txt, content quality, bot access)
OptimizeoptimizingContent is analyzed and rewritten to improve AI visibility for your target prompts and personas
DeploydeployingOptimized content is published to AXP as a new version
DonecompletedAll stages finished successfully
ErrorfailedPipeline stopped at the failing stage
The optimize and deploy stages only run if you set optimize: true and deploy_axp: true in the request. With defaults, only the audit stage runs. To stage content for review without publishing live, set stage_axp: true instead of deploy_axp β€” see the orchestration lifecycle guide for the stage-only flow.

When to use it

  • You want to audit, optimize, and deploy pages without multiple API calls
  • You need batch processing across many URLs
  • You want webhook notifications when stages complete
  • You’re building automated content optimization pipelines

When not to use it

  • You only need audit results β€” use the Site Audit API directly
  • You want to query existing visibility data β€” use the Query API
  • You need manual control over each optimization β€” use the Scrunch dashboard

Request patterns

Simple: list of URLs

Pass urls when every URL should use the same optimization configuration:
curl -X POST "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/1234" \
  -H "Authorization: Bearer $SCRUNCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://example.com/page-a",
      "https://example.com/page-b"
    ],
    "optimize": true,
    "deploy_axp": true,
    "site_id": "01JEXAMPLE00000000000000"
  }'

Detailed: per-URL overrides

Pass requests when individual URLs need different prompts, personas, or sources:
curl -X POST "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/1234" \
  -H "Authorization: Bearer $SCRUNCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      {
        "url": "https://example.com/page-a",
        "target_prompts": ["best budget airlines"],
        "target_personas": [{"name": "Budget Traveler"}]
      },
      {
        "url": "https://example.com/page-b",
        "target_prompts": ["luxury travel options"]
      }
    ],
    "optimize": true,
    "deploy_axp": true,
    "site_id": "01JEXAMPLE00000000000000"
  }'
Provide either urls or requests, not both. The API will reject requests that include both fields.

Tracking progress

Each URL gets its own tracking token. Use it to poll for status:
curl "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/1234/01JABCTOKEN00000000000" \
  -H "Authorization: Bearer $SCRUNCH_API_KEY"
The response includes the current orchestration_status, timestamps, and result data as it becomes available. For real-time updates without polling, configure webhooks to receive callbacks at each stage transition.

Set up webhooks

Get notified when audits, optimizations, and deployments complete.

Error codes

When a pipeline fails, the response includes a structured error code. Use these to identify what went wrong and where:
PrefixStageExample codes
ORCH-INITInitializationInvalid URL, missing site_id, domain mismatch, quota exceeded
ORCH-AUDITAuditFetch failed, timeout, page not found
ORCH-OPTOptimizationNo content to optimize, LLM failure, source fetch failed
ORCH-DEPLOYDeploymentSite not found, AXP publish failed
ORCH-HOOKWebhook deliveryDelivery failed, SSRF blocked, timeout
Each error includes a human-readable message and a short error_hash you can reference when contacting support.

Relationship to other Scrunch products

The Optimize and Deploy API is a composition layer that chains together three standalone Scrunch products:
  • Site Audit is always the first stage. It runs the same checks as POST /{brand_id}/page-audits.
  • Content Optimizer uses audit results plus your target prompts and personas to generate optimized content.
  • AXP deploys the optimized content as a new version to your registered site.
Each product can also be used independently outside of this pipeline.

Dashboard visibility

Everything the pipeline does is fully visible in the Scrunch dashboard β€” audit results, optimization runs, and AXP deployments all appear in their respective pages exactly as if they had been performed manually. AXP deployments are tracked in the Version History with full change tracking, and you can compare original vs. optimized content side by side.

Run your first pipeline

Go to the Optimize and Deploy Quickstart