CLI commands

Structure Templates commands

The 5 koast CLI commands for the Structure Templates operations.

Every command is one API operation, named by its operationId. Global flags such as --output and --api-url work on all of them, see CLI commands.

author-structure-template

Create structure template. POST /v1/brands/{brandId}/structure-templates, API reference.

koast author-structure-template --brand <brand> --name <name> --config <config> --audiences <audiences> [--json <file|->] [flags]
FlagTypeRequiredDescription
--brandintegerYesThe brand the request acts on. Every brand-scoped resource lives under its brand.
--namestringYesTemplate name. At most 191 characters.
--configJSON objectYes
--audiencesJSON object, repeatableYesTemplate-level audiences (targetingSet | customAudience | savedAudience). At least one is required to save or apply.
--settingsJSON objectNoStep-2 settings (objective, CBO+budget, attribution, performance goal, isAdCategorized), required to apply.
--scopestringNoOne of single, multiple.
--accountsJSON object, repeatableNo

Required scope: write. Accepts --idempotency-key. The CLI sends a key only when you give one. --json <file|-> supplies the whole body. Body flags are applied over it.

Example:

koast author-structure-template --brand 123 --json body.json

With body.json:

{
  "name": "string",
  "config": {
    "countMode": "dynamic",
    "n": 1,
    "adsets": "fixed",
    "k": 1,
    "per": 1,
    "placement": "broadcast",
    "splitMode": "even",
    "weights": [
      12.5
    ],
    "name": "string",
    "ops": [
      {}
    ],
    "remainderPolicy": "frontload",
    "minPerSet": 1,
    "maxPerSet": 1
  },
  "audiences": [
    {}
  ],
  "settings": {},
  "scope": "single",
  "accounts": [
    {
      "adAccountId": "string",
      "settings": {},
      "status": "string"
    }
  ]
}

delete-structure-template

Delete structure template. DELETE /v1/brands/{brandId}/structure-templates/{templateId}, API reference.

koast delete-structure-template --brand <brand> --template-id <template-id>
FlagTypeRequiredDescription
--brandintegerYesThe brand the request acts on. Every brand-scoped resource lives under its brand.
--template-idstringYesThe structure template id, from listStructureTemplates.

Required scope: write.

Example:

koast delete-structure-template --brand 123 --template-id TEMPLATE_ID

edit-structure-template-rules

Edit structure template rules. PATCH /v1/brands/{brandId}/structure-templates/{templateId}, API reference.

koast edit-structure-template-rules --brand <brand> --template-id <template-id> [--json <file|->] [flags]
FlagTypeRequiredDescription
--brandintegerYesThe brand the request acts on. Every brand-scoped resource lives under its brand.
--template-idstringYesStructure template ID. Omit to read the template currently open in the builder from the Current Context block. Pass an explicit id only when acting on a different template than the one in scope.
--namestringNo
--configJSON objectNo
--audiencesJSON object, repeatableNoTemplate-level audiences (targetingSet | customAudience | savedAudience). At least one is required to save or apply.
--settingsJSON objectNo
--scopestringNoOne of single, multiple.
--statusstringNoOne of DRAFT, READY, NEEDS_ATTENTION.
--accountsJSON object, repeatableNo

Required scope: write. --json <file|-> supplies the whole body. Body flags are applied over it.

Example:

koast edit-structure-template-rules --brand 123 --template-id TEMPLATE_ID

get-structure-template

Get structure template. GET /v1/brands/{brandId}/structure-templates/{templateId}, API reference.

koast get-structure-template --brand <brand> --template-id <template-id>
FlagTypeRequiredDescription
--brandintegerYesThe brand the request acts on. Every brand-scoped resource lives under its brand.
--template-idstringYesStructure template ID. Omit to read the template currently open in the builder from the Current Context block. Pass an explicit id only when acting on a different template than the one in scope.

Required scope: read.

Example:

koast get-structure-template --brand 123 --template-id TEMPLATE_ID

list-structure-templates

List structure templates. GET /v1/brands/{brandId}/structure-templates, API reference.

koast list-structure-templates --brand <brand> [flags]
FlagTypeRequiredDescription
--brandintegerYesThe brand the request acts on. Every brand-scoped resource lives under its brand.
--cursorstringNoOpaque cursor from the previous page's nextCursor. Omit for the first page.
--limitintegerNoPage size. Default 50. Minimum 1, maximum 100.

Required scope: read. Paged. --all follows nextCursor to the end and prints one JSON line per item.

Example:

koast list-structure-templates --brand 123

On this page