{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/placementapi-com/json-schema/placementapi-com-standing-order-schema.json",
  "title": "StandingOrder",
  "description": "A plan that re-runs on a cadence. 'approve' mode emails a held quote with an approval link each run. 'auto' places only when the account owner has enabled auto placement from the dashboard (POST /v1/customers/me/auto, session only) and the caps and per-run budget clear; otherwise it emails an approval link and says why.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/placementapi-com-account-api-openapi.yml#/components/schemas/StandingOrder",
  "type": "object",
  "properties": {
    "standing_order_id": {
      "type": "string"
    },
    "target_url": {
      "type": "string"
    },
    "brief": {
      "type": "object",
      "description": "The plan_links brief to re-run; links and budget are overridden by links_per_run and budget_credits_per_run."
    },
    "cadence": {
      "type": "string",
      "enum": [
        "weekly",
        "biweekly",
        "monthly"
      ]
    },
    "links_per_run": {
      "type": "integer"
    },
    "budget_credits_per_run": {
      "type": "integer"
    },
    "mode": {
      "type": "string",
      "enum": [
        "approve",
        "auto"
      ]
    },
    "anchor_plan": {
      "oneOf": [
        {
          "$ref": "#/$defs/AnchorPlan"
        },
        {
          "type": "null"
        }
      ]
    },
    "if_no_content": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "convert_to_service",
        "cancel",
        null
      ]
    },
    "content_mode": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "publisher",
        "service",
        "supplied",
        "papi_written",
        null
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused"
      ]
    },
    "next_run_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_run_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_quote_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_outcome": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_outcome_detail": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string"
    }
  },
  "$defs": {
    "AnchorPlan": {
      "type": "object",
      "description": "Anchor text is a DISTRIBUTION, not a string. Many links with one exact-match anchor is the classic over-optimisation footprint. Mix branded, topical, generic and naked_url anchors.",
      "required": [
        "anchors"
      ],
      "properties": {
        "anchors": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "text",
              "type"
            ],
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "type": {
                "type": "string",
                "enum": [
                  "branded",
                  "naked_url",
                  "generic",
                  "topical",
                  "partial_match",
                  "exact_match"
                ]
              },
              "weight": {
                "type": "number",
                "exclusiveMinimum": 0,
                "default": 1,
                "description": "Relative weight; normalised across the plan."
              }
            }
          }
        }
      }
    }
  }
}