πŸ‘

Only available in API version 2024-04

The app_subscription_operations object is only available in API version 2024-04 and later.

Monetization by monday offers two different types of app pricing models: feature-based and seat-based. When using feature-based pricing, it's vital to track the number of operations an app completes so they don't exceed their allotted usage.

The app_subscription_operations object and its associated queries and mutations allow you to do just that by counting usage per operation type (kind) and per account. For annual and monthly subscriptions, the counter resets monthly based on the renewal date. For example, if a subscription renews annually on the 15th of the month, the counter will reset on the 15th of each month.

Using the increase_app_subscription_operations mutation, you can increase the operation counter based on an account's usage and then query app_subscription_operations to read the updated values. These queries and mutations will only work with access tokens generated for the app, and the account must have an active app subscription. Developer access tokens will not work.

As a developer working with monday.com, it is important to familiarize yourself with the app_subscription_operations API so you know how to access usage data for your app. This document will walk you through the available queries to read and update the app_subscription_operations object via the API.

Queries

Querying app_subscription_operations will return an operation count for feature-based apps. This method accepts one argument and returns an object.

You can only query app_subscription_operations at the root, so it can't be nested within another query.

 query {
  app_subscription_operations (kind: "image_scan") {
    counter_value
    period_key
   }
 }
let query = "query { app_subscription_operations (kind: \"image_scan\") { counter_value period_key }}";

fetch ("https://api.monday.com/v2", {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE',
    'API-version' : '2024-01'
   },
   body: JSON.stringify({
     query : query
   })
  })
   .then(res => res.json())
   .then(res => console.log(JSON.stringify(res, null, 2)));

Arguments

You can use the following argument(s) to reduce the number of app subscription operations returned.

ArgumentDescription
kind StringThe operation's name.

Fields

You can use the following field(s) to specify what information your app subscription operations query will return.

FieldDescriptionSupported fields
app_subscription [AppSubscription]The account's app subscription details.
  • billing_period String
  • days_left Int
  • is_trial Boolean
  • plan_id String!
  • pricing_version Int
  • renewal_date Date!
  • counter_value IntThe new counter value. Please note that the counter will restart each time a new app subscription period begins.
    kind String!The operation's name.
    period_key StringThe unique window key (related to subscription periods).

    Mutations

    Increase app subscription operations

    The increase_app_subscription_operations mutation will increase the counter for a specific operation. You can also specify what field(s) to query back when you run the mutation.

    It will return an error if no active subscription exists for the supplied token.

     mutation {
       increase_app_subscription_operations(kind: "image_scan", increment_by: 2){
          counter_value
       }
     }
    
    let query = "mutation { increase_app_subscription_operations (kind: \"image_scan\", increment_by: 2) { counter_value }}";
    
    fetch ("https://api.monday.com/v2", {
      method: 'post',
      headers: {
        'Content-Type': 'application/json',
        'Authorization' : 'YOUR_API_KEY_HERE'
       },
       body: JSON.stringify({
         query : query
       })
      })
       .then(res => res.json())
       .then(res => console.log(JSON.stringify(res, null, 2)));
    

    Arguments

    You can use the following argument(s) to specify which operation to increase and by how much. If you omit these arguments, it will default to a global kind and increment by 1.

    ArgumentDescription
    increment_by IntThe amount to increase the counter by. Must be a positive number.
    kind StringThis can be an alphanumeric string of up to 14 characters, including the - and _ symbols.

    πŸ“˜

    Join our developer community!

    We've created a community specifically for our devs where you can search through previous topics to find solutions, ask new questions, hear about new features and updates, and learn tips and tricks from other devs. Come join in on the fun! 😎