@adcp/client API Reference - v3.11.2
    Preparing search index...

    Function getOptionalAssets

    • Get only optional assets from a Format

      Note: When using deprecated assets_required, this will always return empty since assets_required only contained required assets.

      Parameters

      • format: Format

        The Format object

      Returns (
          | {
              item_type: "individual";
              asset_id: string;
              asset_type: AssetContentType;
              asset_role?: string;
              required: boolean;
              requirements?: { [k: string]: unknown };
          }
          | {
              item_type: "repeatable_group";
              asset_group_id: string;
              required: boolean;
              min_count: number;
              max_count: number;
              assets: {
                  asset_id: string;
                  asset_type: AssetContentType1;
                  asset_role?: string;
                  required: boolean;
                  requirements?: { [k: string]: unknown };
              }[];
          }
      )[]

      Array of optional assets only

      • {
            item_type: "individual";
            asset_id: string;
            asset_type: AssetContentType;
            asset_role?: string;
            required: boolean;
            requirements?: { [k: string]: unknown };
        }
        • item_type: "individual"

          Discriminator indicating this is an individual asset

        • asset_id: string

          Unique identifier for this asset. Creative manifests MUST use this exact value as the key in the assets object.

        • asset_type: AssetContentType
        • Optionalasset_role?: string

          Optional descriptive label for this asset's purpose (e.g., 'hero_image', 'logo', 'third_party_tracking'). Not used for referencing assets in manifests—use asset_id instead. This field is for human-readable documentation and UI display only.

        • required: boolean

          Whether this asset is required (true) or optional (false). Required assets must be provided for a valid creative. Optional assets enhance the creative but are not mandatory.

        • Optionalrequirements?: { [k: string]: unknown }

          Technical requirements for this asset (dimensions, file size, duration, etc.). For template formats, use parameters_from_format_id: true to indicate asset parameters must match the format_id parameters (width/height/unit and/or duration_ms).

      • {
            item_type: "repeatable_group";
            asset_group_id: string;
            required: boolean;
            min_count: number;
            max_count: number;
            assets: {
                asset_id: string;
                asset_type: AssetContentType1;
                asset_role?: string;
                required: boolean;
                requirements?: { [k: string]: unknown };
            }[];
        }
        • item_type: "repeatable_group"

          Discriminator indicating this is a repeatable asset group

        • asset_group_id: string

          Identifier for this asset group (e.g., 'product', 'slide', 'card')

        • required: boolean

          Whether this asset group is required. If true, at least min_count repetitions must be provided.

        • min_count: number

          Minimum number of repetitions required (if group is required) or allowed (if optional)

        • max_count: number

          Maximum number of repetitions allowed

        • assets: {
              asset_id: string;
              asset_type: AssetContentType1;
              asset_role?: string;
              required: boolean;
              requirements?: { [k: string]: unknown };
          }[]

          Assets within each repetition of this group

      const optionalAssets = getOptionalAssets(format);
      console.log(`Can optionally provide ${optionalAssets.length} additional assets`);