auto_write
ads

Declare an ad credit, or update one with credit_id. Platform promotional credit (for example a Google Ads promotion) is

Changed on

Declare an ad credit, or update one with credit_id. Platform promotional credit (for example a Google Ads promotion) is lost on its expiry date if it is not spent. The Google Ads API does not return promotions, so a credit is declared in Magistry from the Billing page and re-declared when Billing shows a new consumed amount. Without credit_id: amount, currency and expires_on are required; platform defaults to google, spent_at_declaration to 0 and declared_on to today. With credit_id: a new Billing reading (spent_at_declaration, with declared_on, which defaults to today), expires_on, max_daily (null clears it), finish_buffer_days, event_multipliers (keys bfcm, christmas or an ISO date), status or note. spent_at_declaration never exceeds amount. A spend-to-earn promotion ("spend 900 within 60 days, get 640, use it within 60 days") is declared with threshold_amount, earn_days (from redeemed_on, default today) or earn_deadline, amount (the credit) and use_days; its plan is then an earn phase with a daily floor the Brain may not plan under, and it switches to the credit phase when the threshold is met (from synced spend, or threshold_met_on). Re-declare the qualifying spend Billing shows as spent_toward_threshold (threshold_read_on defaults to today). Writes only Magistry's own record of the credit and who declared it; nothing is written to an ad platform and no budget changes. Executes at once and returns the credit with its plan summary.

post/api/v1/tools/ads_credit_declare

Request

  • Base URL
    https://app.magistry.io
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization codehttps://app.magistry.io/api/oauth/authorize
      Token URLhttps://app.magistry.io/api/oauth/token
      Scopesads:write

Headers

Idempotency-Key, string

Required, here or as idempotency_key in the body. A unique string you choose for this request; send the SAME key when retrying and the first answer is returned instead of writing twice (idempotent-replayed: true). The same key with other arguments is 409 idempotency_conflict. If the header and idempotency_key are both sent they must be equal.

Request body

object required
credit_id, string uuid

Update this credit: its id as the list of credits returns it.

platform, 'google' | 'meta' | 'microsoft' | 'reddit' | 'tiktok' | 'pinterest' | 'openai' | 'applovin' | 'taboola' | 'criteo' | 'amazon' | 'bol' | 'outbrain' | 'snapchat' | 'linkedin' | 'x' | 'stackadapt'

New credit only; default google.

promo_code, string

New credit only: the promotion code as Billing shows it.

amount, number

New credit only: the credit, in its currency (major units).

currency, string

New credit only: ISO 4217 code.

redeemed_on, string date

New credit only.

expires_on, string date

The day the platform takes back what is unspent.

spent_at_declaration, number

Consumed amount as Billing shows it on declared_on.

declared_on, string date

The day of that Billing reading; default today.

finish_buffer_days, integer

Days before expiry the plan aims to finish; default 4.

max_daily, number nullable

Cap on one day's target; null clears it.

event_multipliers, object

Weight overrides: 'bfcm' (default 1.35), 'christmas' (24-26 December, default 0.5) or an ISO date.

status, 'active' | 'exhausted' | 'expired' | 'withdrawn'
source, 'operator' | 'merchant' | 'agent' | 'platform_read'

New credit only; default from the caller (a person is operator, an app agent).

note, string nullable
threshold_amount, number

New promotion only: the spend that earns the credit.

earn_deadline, string date

Last day spend counts toward the threshold.

earn_days, integer

New promotion only: days from redeemed_on (default today) to earn it; sets earn_deadline.

spent_toward_threshold, number

Qualifying spend as Billing shows it on threshold_read_on.

threshold_read_on, string date

The day of that reading; default today.

threshold_met_on, string date nullable

Update only: the day Billing shows the credit was earned.

use_days, integer nullable

Days the earned credit stays usable; expires_on defaults to earn_deadline + use_days.

idempotency_key, string required

Required. A unique string you choose for this request. Send the SAME key when retrying after a timeout and Magistry returns the original outcome instead of performing the write twice. Reusing a key with different arguments is refused rather than replayed.

Response

Tool result

object required
ok, boolean required
result, unknown required

Changes

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    11 more changes in this revision