Spend guardrails (GraphQL)

Related queries and mutations in Performance and cost. Each has its own section.

Queries

getNewMonitorSpendGuardrail (query)

getNewMonitorSpendGuardrail is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

The reached spend guardrail that would save a new monitor created in the UI as a draft. Null when it would save live.

Arguments

ArgumentTypeDescription
domainUuidUUIDThe domain the new monitor would be in. Leave it out to check only the account guardrail.

Returns

NewMonitorSpendGuardrail

Example

query GetNewMonitorSpendGuardrail {
  getNewMonitorSpendGuardrail {
    scope
    domainUuid
    resetTime
    onlyBilledMonitors
  }
}

Types used only by getNewMonitorSpendGuardrail

NewMonitorSpendGuardrail

Object type. A reached spend guardrail that would save a new monitor as a draft, and when its period starts over.

FieldTypeDescription
scopeSpendGuardrailScope!
domainUuidUUIDThe domain at its guardrail. Null for the account.
resetTimeDateTime!When the period ends and new monitors save live again.
onlyBilledMonitorsBoolean!True on V1 (dollar) pricing, where only a new monitor that adds to the bill is held: a table monitor on a table no running monitor covers, or an agent monitor the contract prices. Every other monitor saves live.

Related types

DateTime, SpendGuardrailScope, UUID

getSpendGuardrailRecommendations (query)

getSpendGuardrailRecommendations is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Recommended spend guardrails for the account and its domains.

Returns

SpendGuardrailRecommendations!

Example

query GetSpendGuardrailRecommendations {
  getSpendGuardrailRecommendations {
    unit
  }
}

Types used only by getSpendGuardrailRecommendations

AccountRecommendation

Object type.

FieldTypeDescription
amountIntThe recommended monthly guardrail in unit. Null when there isn't enough history or commit data to recommend one.
ruleAccountRecommendationRuleNull when amount is null.
AccountRecommendationRule

Enum type. What the account recommendation follows.

ValueDescription
COMMIT
AVERAGE
DomainRecommendation

Object type.

FieldTypeDescription
domainUuidUUID!
amountIntThe recommended daily guardrail in unit. The floor when the domain was first charged less than 30 days ago, or had no spend in the last 30 days. Null when the domain has an active Bayes teammate, because it can't have a guardrail.
SpendGuardrailRecommendations

Object type.

FieldTypeDescription
unitSpendUnit!
accountAccountRecommendationNull unless the caller has account-wide billing access.
domains[DomainRecommendation!]!The domains the caller may see.

Related types

SpendUnit, UUID

getSpendHistory (query)

getSpendHistory is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Spend per day or per month, split into Monitoring, Bayes and sources.

Arguments

ArgumentTypeDescription
periodSpendPeriod!
domainUuidUUIDThe domain to read. Leave it out for the whole account, which needs billing access for every domain.

Returns

SpendHistory!

Example

query GetSpendHistory($period: SpendPeriod!) {
  getSpendHistory(period: $period) {
    unit
    period
  }
}

Types used only by getSpendHistory

SpendHistory

Object type.

FieldTypeDescription
unitSpendUnit!
periodSpendPeriod!
points[SpendHistoryPoint!]!One point per period, oldest first. Quiet periods are zero. Today, and so the current month, include today's estimate, as getSpendSummary does.
SpendHistoryPoint

Object type.

FieldTypeDescription
startDate!The first day (UTC) of the point's period.
spendSpendByKind!
bySource[SpendBySource!]!The spend per source. Sources with no spend are left out. Deprecated: Use spend.bySource..
SpendPeriod

Enum type. How spend history is bucketed.

ValueDescription
DAYOne point per day (UTC) over the last 30 days, today included.
MONTHOne point per calendar month (UTC) over the last 6 months, this month included.

Related types

Date, SpendByKind, SpendBySource, SpendUnit, UUID

getSpendSummary (query)

getSpendSummary is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Spend and spend guardrails for the account and its domains: today, month to date and the last 30 days.

Arguments

ArgumentTypeDescription
domainUuidUUIDReturn only this domain.

Returns

SpendSummary!

Example

query GetSpendSummary {
  getSpendSummary {
    day
    unit
    guardrailsAvailable
  }
}

Types used only by getSpendSummary

AccountSpend

Object type.

FieldTypeDescription
spendSpendTotals!
guardrailSpendGuardrailThe monthly account guardrail, if set.
paceSpendPace!
DomainSpend

Object type.

FieldTypeDescription
domainUuidUUIDThe domain. Null for Unassigned: spend that landed in no domain.
spendSpendTotals!
guardrailSpendGuardrailThe domain's daily guardrail, if set. Null for Unassigned.
SpendPace

Object type. The account's month at the average of its last 7 full days. The amounts are null while
unavailableReason is set.

FieldTypeDescription
projectedMonthEndFloatThe account's spend at the end of this calendar month (UTC) if it keeps this pace.
reachesGuardrailOnDateThe day (UTC) this pace reaches the account guardrail. Null without a guardrail, once month to date has reached it, or when this pace stays under it this month.
unavailableReasonSpendPaceUnavailableReasonWhy there is no pace yet. Null when there is.
availableOnDateThe first day (UTC) the pace will be available. Set only for NOT_ENOUGH_HISTORY.
SpendPaceUnavailableReason

Enum type. Why the account has no pace yet.

ValueDescription
NO_SPEND_YETNo full day of spend in the account's current unit yet.
NOT_ENOUGH_HISTORYFewer than 7 full days of spend in the account's current unit.
SpendSummary

Object type.

FieldTypeDescription
dayDate!The UTC day the summary is for.
unitSpendUnit!
guardrailsAvailableBoolean!Whether the account's billing plan has spend guardrails. False on a subscription plan, which isn't charged for agents: guardrails can't be set, and nothing is recorded as spend.
accountAccountSpendThe whole account's spend and guardrail. Null unless the caller has billing access for every domain and asked for no single domain.
domains[DomainSpend!]!The domains the caller may see. Unassigned comes last, and only with account.
SpendTotals

Object type.

FieldTypeDescription
todaySpendByKind!Spend today (UTC). Sources charged by the day count at their current daily rate, and the others at what was spent so far today.
monthToDateSpendByKind!Spend this calendar month (UTC), today included.
last30DaysSpendByKind!Spend over the last 30 days, today included.

Related types

Date, SpendByKind, SpendGuardrail, SpendUnit, UUID

Mutations

clearSpendGuardrail (mutation)

clearSpendGuardrail is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Clear the account's or a domain's spend guardrail.

Arguments

ArgumentTypeDescription
domainUuidUUIDThe domain. Required for a domain guardrail.
scopeSpendGuardrailScope!

Returns

ClearSpendGuardrail

Example

mutation ClearSpendGuardrail($scope: SpendGuardrailScope!) {
  clearSpendGuardrail(scope: $scope) {
    cleared
  }
}

Types used only by clearSpendGuardrail

ClearSpendGuardrail

Object type. Clear a spend guardrail.

FieldTypeDescription
clearedBoolean!Whether there was a guardrail to clear.

Related types

SpendGuardrailScope, UUID

requestSpendGuardrailRaise (mutation)

requestSpendGuardrailRaise is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Ask the Account Owners to raise a spend guardrail.

Arguments

ArgumentTypeDescription
domainUuidUUIDThe domain. Required for a domain guardrail. The caller must see the domain's alerts or monitors.
metadataSpendGuardrailRaiseRequestMetadataWhere the request came from, for analytics. Not stored.
originString!Where the request comes from, as free text, such as app or chat. At most 64 characters.
scopeSpendGuardrailScope!

Returns

RequestSpendGuardrailRaise

Example

mutation RequestSpendGuardrailRaise($origin: String!, $scope: SpendGuardrailScope!) {
  requestSpendGuardrailRaise(origin: $origin, scope: $scope) {
    success
  }
}

Types used only by requestSpendGuardrailRaise

RequestSpendGuardrailRaise

Object type. Ask the Account Owners to raise a spend guardrail.

FieldTypeDescription
successBoolean!
SpendGuardrailRaiseRequestMetadata

Input object type. Where a request to raise a guardrail came from. Every field is optional.

FieldTypeDescription
pageUrlStringThe page the request came from, at most 2048 characters. Its query string and fragment are dropped.
alertUuidUUIDThe alert the person was blocked on.
blockedActionStringWhat was blocked, such as troubleshoot, at most 64 characters.

Related types

SpendGuardrailScope, UUID

setSpendGuardrail (mutation)

setSpendGuardrail is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Set or change the account's and domains' spend guardrails, all or none.

Arguments

ArgumentTypeDescription
confirmBelowCurrentSpendBooleanSet the guardrails even when some are below current spend: month to date for the account, today for a domain. Without it, such a request sets nothing and is refused with the SPEND_GUARDRAIL_BELOW_CURRENT_SPEND error. Its extensions carry unit and guardrails: the scope, domainUuid and currentSpend of each guardrail below current spend. Default: false.
guardrails[SpendGuardrailInput!]!The guardrails to set, at most one each.

Returns

SetSpendGuardrail

Example

mutation SetSpendGuardrail($guardrails: [SpendGuardrailInput!]!) {
  setSpendGuardrail(guardrails: $guardrails) {
    guardrails {
      uuid
      scope
      domainUuid
      amount
      unit
      origin
      setBy
      setTime
    }
  }
}

Types used only by setSpendGuardrail

SetSpendGuardrail

Object type. Set or change spend guardrails: the account's, any number of domains', or both. Either
all of them are set or none are.

FieldTypeDescription
guardrails[SpendGuardrail!]!The guardrails set.
SpendGuardrailInput

Input object type.

FieldTypeDescription
scopeSpendGuardrailScope!
domainUuidUUIDThe domain. Required for a domain guardrail.
amountInt!The limit in the account's unit, at least 1.

Related types

SpendGuardrail, SpendGuardrailScope, UUID

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.