Skip to main content
POST
/
orchestration
/
optimize-and-deploy
/
{brand_id}
Create Optimize And Deploy Pipeline
curl --request POST \
  --url https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "urls": [
    "<string>"
  ],
  "requests": [
    {
      "url": "<string>",
      "target_prompts": [
        "<string>"
      ],
      "target_personas": [
        {
          "name": "<string>",
          "description": "<string>"
        }
      ],
      "target_sources": [
        "<string>"
      ],
      "custom_instructions": "<string>",
      "override_suggestions": true,
      "retain_schema_types": [
        "<string>"
      ]
    }
  ],
  "optimize": false,
  "deploy_axp": false,
  "stage_axp": false,
  "site_id": "<string>",
  "target_prompts": [
    "<string>"
  ],
  "target_personas": [
    {
      "name": "<string>",
      "description": "<string>"
    }
  ],
  "target_sources": [
    "<string>"
  ],
  "override_suggestions": false,
  "webhook_url_override": "<string>"
}
'
import requests

url = "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}"

payload = {
"urls": ["<string>"],
"requests": [
{
"url": "<string>",
"target_prompts": ["<string>"],
"target_personas": [
{
"name": "<string>",
"description": "<string>"
}
],
"target_sources": ["<string>"],
"custom_instructions": "<string>",
"override_suggestions": True,
"retain_schema_types": ["<string>"]
}
],
"optimize": False,
"deploy_axp": False,
"stage_axp": False,
"site_id": "<string>",
"target_prompts": ["<string>"],
"target_personas": [
{
"name": "<string>",
"description": "<string>"
}
],
"target_sources": ["<string>"],
"override_suggestions": False,
"webhook_url_override": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['<string>'],
requests: [
{
url: '<string>',
target_prompts: ['<string>'],
target_personas: [{name: '<string>', description: '<string>'}],
target_sources: ['<string>'],
custom_instructions: '<string>',
override_suggestions: true,
retain_schema_types: ['<string>']
}
],
optimize: false,
deploy_axp: false,
stage_axp: false,
site_id: '<string>',
target_prompts: ['<string>'],
target_personas: [{name: '<string>', description: '<string>'}],
target_sources: ['<string>'],
override_suggestions: false,
webhook_url_override: '<string>'
})
};

fetch('https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'<string>'
],
'requests' => [
[
'url' => '<string>',
'target_prompts' => [
'<string>'
],
'target_personas' => [
[
'name' => '<string>',
'description' => '<string>'
]
],
'target_sources' => [
'<string>'
],
'custom_instructions' => '<string>',
'override_suggestions' => true,
'retain_schema_types' => [
'<string>'
]
]
],
'optimize' => false,
'deploy_axp' => false,
'stage_axp' => false,
'site_id' => '<string>',
'target_prompts' => [
'<string>'
],
'target_personas' => [
[
'name' => '<string>',
'description' => '<string>'
]
],
'target_sources' => [
'<string>'
],
'override_suggestions' => false,
'webhook_url_override' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}"

payload := strings.NewReader("{\n \"urls\": [\n \"<string>\"\n ],\n \"requests\": [\n {\n \"url\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"custom_instructions\": \"<string>\",\n \"override_suggestions\": true,\n \"retain_schema_types\": [\n \"<string>\"\n ]\n }\n ],\n \"optimize\": false,\n \"deploy_axp\": false,\n \"stage_axp\": false,\n \"site_id\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"override_suggestions\": false,\n \"webhook_url_override\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"<string>\"\n ],\n \"requests\": [\n {\n \"url\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"custom_instructions\": \"<string>\",\n \"override_suggestions\": true,\n \"retain_schema_types\": [\n \"<string>\"\n ]\n }\n ],\n \"optimize\": false,\n \"deploy_axp\": false,\n \"stage_axp\": false,\n \"site_id\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"override_suggestions\": false,\n \"webhook_url_override\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrunchai.com/v2/orchestration/optimize-and-deploy/{brand_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"<string>\"\n ],\n \"requests\": [\n {\n \"url\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"custom_instructions\": \"<string>\",\n \"override_suggestions\": true,\n \"retain_schema_types\": [\n \"<string>\"\n ]\n }\n ],\n \"optimize\": false,\n \"deploy_axp\": false,\n \"stage_axp\": false,\n \"site_id\": \"<string>\",\n \"target_prompts\": [\n \"<string>\"\n ],\n \"target_personas\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n }\n ],\n \"target_sources\": [\n \"<string>\"\n ],\n \"override_suggestions\": false,\n \"webhook_url_override\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "tokens": [
    {
      "token": "<string>",
      "url": "<string>",
      "status": "<string>"
    }
  ],
  "pipeline_id": "<string>",
  "status": "pending"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

brand_id
integer
required

Body

application/json

Request to create an orchestrated site audit pipeline.

urls
string[] | null

Simple list of URLs to audit (use this OR requests, not both)

requests
URLRequest · object[] | null

URL requests with per-URL optimization params (use this OR urls, not both)

optimize
boolean
default:false

Run content optimization after audit

deploy_axp
boolean
default:false

Deploy optimized content to AXP (requires optimize=true and site_id)

stage_axp
boolean
default:false

Audit + optimize + stage content without deploying live (requires optimize=true and site_id; mutually exclusive with deploy_axp)

site_id
string | null

RegisteredSite ID for AXP staging/deployment (required if deploy_axp or stage_axp)

target_prompts
string[] | null

Prompts for optimization (optional - if omitted, we infer from page content)

target_personas
PersonaTargetInput · object[] | null

Personas for optimization (optional - if omitted, we use defaults)

target_sources
string[] | null

Source URLs for optimization (optional)

override_suggestions
boolean
default:false

Skip AI suggestions, use only provided prompts/sources

webhook_url_override
string<uri> | null

Webhook URL override for this pipeline (uses brand default if not set)

Required string length: 1 - 2083

Response

Successful Response

Response when creating an orchestration pipeline.

tokens
OrchestrationRecord · object[]
required

Individual audit tokens

pipeline_id
string | null

Pipeline ID for batched AXP deployment (only set if deploy_axp=true)

status
string
default:pending

Pipeline status