[Yandex Cloud documentation](../../../../index.md) > [Yandex Cloud Marketplace](../../../index.md) > Partners > Metering API reference > [REST](../index.md) > [ImageProductUsage](index.md) > Write

# Marketplace Metering API, REST: ImageProductUsage.Write

Writes image product's usage. Authentication is by user's service account.

## HTTP request

```
POST https://marketplace.api.cloud.yandex.net/marketplace/metering/v1/imageProductUsage/write
```

## Body parameters {#yandex.cloud.marketplace.metering.v1.WriteImageProductUsageRequest}

```json
{
  "validateOnly": "boolean",
  "productId": "string",
  "usageRecords": [
    {
      "uuid": "string",
      "skuId": "string",
      "quantity": "string",
      "timestamp": "string"
    }
  ]
}
```

#|
||Field | Description ||
|| validateOnly | **boolean**

Checks whether you have the access required for the emit usage. ||
|| productId | **string**

Required field. Marketplace Product's ID.

The maximum string length in characters is 50. ||
|| usageRecords[] | **[UsageRecord](#yandex.cloud.marketplace.metering.v1.UsageRecord)**

List of product usage records (up to 25 per request).

The number of elements must be in the range 1-25. ||
|#

## UsageRecord {#yandex.cloud.marketplace.metering.v1.UsageRecord}

#|
||Field | Description ||
|| uuid | **string**

Required field. Unique identifier of the usage record (UUID format).

The maximum string length in characters is 36. ||
|| skuId | **string**

Required field. Consumed Marketplace SKU ID, linked to `UsageRecord.product_id`.

The maximum string length in characters is 50. ||
|| quantity | **string** (int64)

Quantity of SKU consumed, measured in `sku.usage_unit` units (e.g. bytes).

Value must be greater than 0. ||
|| timestamp | **string** (date-time)

Required field. Timestamp in UTC for which the usage is being reported.

String in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. The range of possible values is from
`0001-01-01T00:00:00Z` to `9999-12-31T23:59:59.999999999Z`, i.e. from 0 to 9 digits for fractions of a second.

To work with values in this field, use the APIs described in the
[Protocol Buffers reference](https://developers.google.com/protocol-buffers/docs/reference/overview).
In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). ||
|#

## Response {#yandex.cloud.marketplace.metering.v1.WriteImageProductUsageResponse}

**HTTP Code: 200 - OK**

```json
{
  "accepted": [
    {
      "uuid": "string"
    }
  ],
  "rejected": [
    {
      "uuid": "string",
      "reason": "string"
    }
  ]
}
```

#|
||Field | Description ||
|| accepted[] | **[AcceptedUsageRecord](#yandex.cloud.marketplace.metering.v1.AcceptedUsageRecord)**

List of accepted product usage records. ||
|| rejected[] | **[RejectedUsageRecord](#yandex.cloud.marketplace.metering.v1.RejectedUsageRecord)**

List of rejected product usage records (with reason). ||
|#

## AcceptedUsageRecord {#yandex.cloud.marketplace.metering.v1.AcceptedUsageRecord}

#|
||Field | Description ||
|| uuid | **string**

Unique identifier of the usage record (UUID format). ||
|#

## RejectedUsageRecord {#yandex.cloud.marketplace.metering.v1.RejectedUsageRecord}

#|
||Field | Description ||
|| uuid | **string**

Unique identifier of the usage record (UUID format). ||
|| reason | **enum** (Reason)

The reason of rejection.

- `DUPLICATE`
- `EXPIRED`
- `INVALID_TIMESTAMP`
- `INVALID_SKU_ID`
- `INVALID_PRODUCT_ID`
- `INVALID_QUANTITY`
- `INVALID_ID` ||
|#