Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Marketplace
    • Getting started
    • Access management
      • Getting started with the API
    • Getting started
    • Access management
    • Audit Trails events

In this article:

  • Getting started
  • Test metric submission
  • Submit a metric
  1. Partners
  2. Metering API reference
  3. Getting started with the API

How to get started with Marketplace Metering API

Written by
Yandex Cloud
Updated at July 8, 2025
View in Markdown
  • Getting started
  • Test metric submission
  • Submit a metric

In this section, you will learn how to send consumption metrics for your product in Marketplace Metering API.

Getting startedGetting started

To get started with Marketplace Metering API:

  1. Get your product's IDs (productId) and SKU (skuId). You can find the IDs on the product page in the Marketplace partner dashboard.
  2. Assign the marketplace.meteringAgent role for your folder to the service account you will use to authenticate with Marketplace Metering API and submit metrics. To learn more, see Access management.
  3. Get an IAM token for the same service account.

To use the examples, install the following:

  • cURL
  • gRPCurl (when using gRPC API)
  • uuidgen

Test metric submissionTest metric submission

Test submitting metrics to Marketplace Metering API. A test metric submission request is the same as a real one except for the validate_only parameter set to true.

Test by running this command:

REST API
gRPC API
curl \
  --request POST \
  --url 'https://marketplace.api.cloud.yandex.net/marketplace/metering/v1/imageProductUsage/write' \
  --header 'Authorization: Bearer <IAM_token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "validate_only": true,
    "product_id": "<product_ID>",
    "usage_records": [
      {
        "uuid": "<record_ID>",
        "sku_id": "<SKU_ID>",
        "quantity": <number_of_units>,
        "timestamp": "<timestamp>"
      }
    ]
  }'

Where:

  • <IAM_token>: IAM token you got before you started.
  • product_id: Product ID.
  • uuid: Unique record ID. You can also generate your password using uuidgen.
  • sku_id: SKU ID.
  • quantity: Number of units consumed. The value must be an integer greater than 0, e.g., 1.
  • timestamp: Timestamp in ISO 8601 format, e.g., 2024-09-16T19:01:10.591128Z.
grpcurl \
  -rpc-header "Authorization: Bearer <IAM_token>" \
  -d '{
    "validate_only": true,
    "product_id": "<product_ID>",
    "usage_records": [
      {
        "uuid": "<record_ID>",
        "sku_id": "<SKU_ID>",
        "quantity": <number_of_units>,
        "timestamp": <timestamp>
      }
    ]
  }' \
  marketplace.api.cloud.yandex.net:443 yandex.cloud.marketplace.metering.v1.ImageProductUsageService/Write

Where:

  • <IAM_token>: IAM token you got before you started.
  • product_id: Product ID.
  • uuid: Unique record ID. You can also generate your password using uuidgen.
  • sku_id: SKU ID.
  • quantity: Number of units consumed. The value must be an integer greater than 0, e.g., 1.
  • timestamp: Timestamp in ISO 8601 format, e.g., 2024-09-16T19:01:10.591128Z.

Submit a metricSubmit a metric

To submit a metric, run this command:

REST API
gRPC API
curl \
  --request POST \
  --url 'https://marketplace.api.cloud.yandex.net/marketplace/metering/v1/imageProductUsage/write' \
  --header 'Authorization: Bearer <IAM_token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "product_id": "<product_ID>",
    "usage_records": [
      {
        "uuid": "<record_ID>",
        "sku_id": "<SKU_ID>",
        "quantity": <number_of_units>,
        "timestamp": "<timestamp>"
      }
    ]
  }'

Where:

  • <IAM_token>: IAM token you got before you started.
  • product_id: Product ID.
  • uuid: Unique record ID. You can also generate your password using uuidgen.
  • sku_id: SKU ID.
  • quantity: Number of units consumed. The value must be an integer greater than 0, e.g., 1.
  • timestamp: Timestamp in ISO 8601 format, e.g., 2024-09-16T19:01:10.591128Z.
grpcurl \
  -rpc-header "Authorization: Bearer <IAM_token>" \
  -d '{
    "product_id": "<product_ID>",
    "usage_records": [
      {
        "uuid": "<record_ID>",
        "sku_id": "<SKU_ID>",
        "quantity": <number_of_units>,
        "timestamp": "<timestamp>"
      }
    ]
  }' \
  marketplace.api.cloud.yandex.net:443 yandex.cloud.marketplace.metering.v1.ImageProductUsageService/Write

Where:

  • <IAM_token>: IAM token you got before you started.
  • product_id: Product ID.
  • uuid: Unique record ID. You can also generate your password using uuidgen.
  • sku_id: SKU ID.
  • quantity: Number of units consumed. The value must be an integer greater than 0, e.g., 1.
  • timestamp: Timestamp in ISO 8601 format, e.g., 2024-09-16T19:01:10.591128Z.

Result:

{
  "accepted": [
    {
      "uuid": "uu1dc02f-6785-47fc-945a-7b4d********",
      "sku_id": "dn21df4qvqhb********",
      "quantity": 1,
      "timestamp": "2024-09-16T19:01:10.591128Z"
    }
  ],
  "rejected": []
}

If the metric is rejected, a list of rejected records will be displayed. For example:

{
  "accepted": [],
  "rejected": [
    {
      "uuid": "uu1dc02f-6785-47fc-945a-7b4d********",
      "reason": "INVALID_ID"
    }
  ]
}

Where:

  • uuid: Unique record ID.

  • reason: Reason for rejecting the metric. The possible values are:

    • DUPLICATE: Record duplicate. A record with this ID already exists.
    • EXPIRED: Expired record. You cannot submit metrics for consumption events older than one hour.
    • INVALID_TIMESTAMP: Invalid timestamp. Future timestamps are not supported.
    • INVALID_SKU_ID: Invalid SKU ID. The SKU is not found.
    • INVALID_PRODUCT_ID: Invalid product ID. The product is not found.
    • INVALID_QUANTITY : Invalid quantity. The quantity must be greater than 0.
    • INVALID_ID: Invalid record ID. The ID is not recognized as a UUID.

A successful test does not guarantee the metric will be accepted following an actual request. For example, if the service account loses its permission to submit metrics, the API will return the 403 Forbidden error. This can happen if the user revokes access permissions or the billing account enters a state in which consumption is not possible. To avoid such errors, break you jobs down into smaller sub-issues and submit metrics after each one. For example, for an email app, send a metric per email sent.

You can group metrics into a single request by different SKUs or over a certain time period. This will reduce the number of requests. For example, if your app’s RPS is high, submit metrics once per minute with the number of successful requests specified in the quantity parameter.

Was the article helpful?

Previous
Access management
Next
Overview
© 2026 Direct Cursus Technology L.L.C.