{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tokportal-com/json-schema/tokportal-com-create-bulk-bundles-request-schema.json",
  "title": "CreateBulkBundlesRequest",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tokportal-com-openapi.json#/components/schemas/CreateBulkBundlesRequest",
  "type": "object",
  "required": [
    "platforms",
    "country",
    "accounts_count"
  ],
  "properties": {
    "platforms": {
      "type": "array",
      "minItems": 1,
      "maxItems": 3,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "tiktok",
          "instagram"
        ]
      },
      "description": "TikTok and/or Instagram. accounts_count accounts are created on EACH listed platform, so the batch total is accounts_count x platforms.length. YouTube cannot be ordered (YOUTUBE_DELAYED)."
    },
    "country": {
      "type": "string",
      "minLength": 2,
      "maxLength": 5,
      "description": "Country code exactly as returned by listCountries. Most are ISO-3166-1 alpha-2 (FR, DE, BR), but two are not: the United States is \"USA\" and the United Kingdom is \"UK\". The aliases \"US\" and \"GB\" are accepted and resolved to those. A full country name such as \"United States\" is rejected. videos_only_countries is never valid here."
    },
    "accounts_count": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Accounts to create per platform. Each one is a separate bundle with its own account, and every credit below is charged per account."
    },
    "upload_accounts_count": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "default": 0
    },
    "videos_per_account": {
      "type": "integer",
      "minimum": 0,
      "maximum": 500,
      "default": 0
    },
    "wants_niche_warming": {
      "type": "boolean",
      "default": false,
      "deprecated": true,
      "description": "Legacy — kept only for accounts being re-created after a refund; use Advanced Niche Warming (wants_advanced_warming)."
    },
    "wants_deep_warming": {
      "type": "boolean",
      "default": false,
      "deprecated": true,
      "description": "Legacy — kept only for accounts being re-created after a refund; use Advanced Niche Warming (wants_advanced_warming)."
    },
    "wants_advanced_warming": {
      "type": "boolean",
      "default": false,
      "description": "Advanced Niche Warming, the warming product: niche-target (search-term) based warming with recorded proof and a data report. MANDATORY whenever you send advanced_warming_terms or advanced_warming_terms_count — TokPortal never infers it, and sending targets without it is rejected with ADVANCED_WARMING_FLAG_REQUIRED rather than charged and dropped. The standard rate is 5 credits per target (per target, never per day), charged per account; GET /credit-costs returns the effective rate. TikTok and Instagram only. Provide advanced_warming_terms now, or advanced_warming_terms_count to configure the targets later."
    },
    "advanced_warming_terms": {
      "type": "array",
      "minItems": 3,
      "maxItems": 30,
      "x-item-count-multiple-of": 3,
      "items": {
        "type": "string",
        "minLength": 2,
        "maxLength": 50
      },
      "description": "3-30 niche targets (search terms), count a multiple of 3, each 2-50 characters, applied identically to every account of the batch. REQUIRES wants_advanced_warming: true in the same body (ADVANCED_WARMING_FLAG_REQUIRED otherwise). Every term must survive cleanup intact: entries are trimmed and compared case-insensitively, and if any is dropped as a duplicate or for its length the call fails with ADVANCED_WARMING_TERMS_REJECTED listing what was dropped. Send this list OR advanced_warming_terms_count, not both: a count that disagrees with the list length fails with ADVANCED_WARMING_COUNT_MISMATCH."
    },
    "advanced_warming_terms_count": {
      "type": "integer",
      "minimum": 3,
      "maximum": 30,
      "multipleOf": 3,
      "x-value-multiple-of": 3,
      "description": "Number of niche targets purchased PER ACCOUNT (3-30, multiples of 3; standard rate 5 credits each; GET /credit-costs returns the effective rate); the alternative to advanced_warming_terms when the targets are not decided yet. REQUIRES wants_advanced_warming: true in the same body (ADVANCED_WARMING_FLAG_REQUIRED otherwise). Do not send it alongside advanced_warming_terms unless it equals that list's length — a disagreement fails with ADVANCED_WARMING_COUNT_MISMATCH. Configure each bundle's targets later via PUT /bundles/{id}/warming-terms — but BEFORE publishing: publishBundle refuses a bundle whose warming has no targets (ADVANCED_WARMING_NOT_CONFIGURED). A purchase left unconfigured is not refunded."
    },
    "niche_warming_instructions": {
      "type": "string",
      "maxLength": 2000,
      "deprecated": true,
      "description": "Legacy — kept only for accounts being re-created after a refund; use Advanced Niche Warming (wants_advanced_warming)."
    },
    "auto_finalize_videos": {
      "type": "boolean",
      "default": true,
      "description": "Defaults to true: delivered videos are approved automatically and count as final. Set false to hold each delivered video for your manual review (approve or request corrections). Changeable later via updateBundle."
    },
    "external_ref": {
      "type": "string",
      "maxLength": 200,
      "description": "Optional batch-level client reference copied to every bundle created by this call. It is not unique per resulting bundle and is not an idempotency key. Use the returned bundle IDs for per-bundle identity and Idempotency-Key for retry/replay."
    },
    "partner_client": {
      "type": "object",
      "required": [
        "client_ref"
      ],
      "properties": {
        "client_ref": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "The partner's own stable identifier for its end client."
        },
        "client_email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "maxLength": 320
        },
        "client_name": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200
        },
        "order_ref": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "The partner's order identifier (may be shared by several bundles)."
        },
        "account_ref": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "The partner's identifier for the account this bundle produces."
        }
      },
      "additionalProperties": false,
      "description": "Partner platforms only (resellers registered with TokPortal). Records which of the partner's own clients this order is for; returned as partner_client on getBundle and listBundles. Ignored, and reported in meta.ignored_fields, for every other API key. Recorded identically on every bundle of the batch."
    }
  },
  "dependentRequired": {
    "advanced_warming_terms": [
      "wants_advanced_warming"
    ],
    "advanced_warming_terms_count": [
      "wants_advanced_warming"
    ]
  },
  "not": {
    "required": [
      "wants_niche_warming",
      "wants_advanced_warming"
    ],
    "properties": {
      "wants_niche_warming": {
        "const": true
      },
      "wants_advanced_warming": {
        "const": true
      }
    }
  },
  "additionalProperties": false
}