{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nautilinks-co/json-schema/nautilinks-co-create-order-request-schema.json",
  "title": "CreateOrderRequest",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nautilinks-co-openapi.json#/components/schemas/CreateOrderRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": {
        "$ref": "#/$defs/OrderItemInput"
      }
    },
    "promo_code": {
      "type": "string",
      "maxLength": 80
    },
    "sandbox_credit_cents": {
      "type": "integer",
      "minimum": 0,
      "description": "Sandbox keys only: simulated prepaid balance used to test payment branches."
    }
  },
  "$defs": {
    "AnchorType": {
      "type": "string",
      "enum": [
        "exact",
        "partial",
        "branded",
        "generic",
        "naked"
      ]
    },
    "LinkFormat": {
      "type": "string",
      "enum": [
        "article_unitaire",
        "lien_insere"
      ]
    },
    "OrderItemInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "site_id",
        "target_url",
        "anchor_text"
      ],
      "properties": {
        "site_id": {
          "type": "integer",
          "minimum": 1
        },
        "target_url": {
          "type": "string",
          "format": "uri",
          "maxLength": 500
        },
        "anchor_text": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "anchor_type": {
          "$ref": "#/$defs/AnchorType"
        },
        "content_brief": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 2000
        },
        "format": {
          "$ref": "#/$defs/LinkFormat"
        },
        "article_id": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "description": "Required when format is lien_insere."
        },
        "tier2_pack_size": {
          "type": "integer",
          "enum": [
            0,
            1,
            3,
            5
          ],
          "default": 0
        },
        "project_id": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        }
      }
    }
  }
}