> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unibee.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Merchant Metric Event Current Value

## Endpoint Overview

**POST** `https://api.unibee.dev/merchant/metric/event/current_value`

Get Merchant Metric Event Current Value

***

## Authorization

All UniBee Merchant API requests require authentication via API key.

| Header          | Required | Description                           |
| --------------- | -------- | ------------------------------------- |
| `Authorization` | Yes      | Bearer `<your_api_key>`               |
| `Content-Type`  | Yes      | `application/json` (for request body) |

***

## Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

### Request body

| Name             | Type    | Required | Description                                                                                    |
| ---------------- | ------- | -------- | ---------------------------------------------------------------------------------------------- |
| `email`          | string  | No       | Email， UserId, ExternalUserId, or Email provides one of three options                          |
| `externalUserId` | string  | No       | ExternalUserId， UserId, ExternalUserId, or Email provides one of three options                 |
| `metricCode`     | string  | Yes      | MetricCode                                                                                     |
| `productId`      | integer | No       | Id of product. Default product will use if productId not specified and subscriptionId is blank |
| `userId`         | integer | No       | UserId， UserId, ExternalUserId, or Email provides one of three options                         |

***

## Request examples

### cURL

```bash theme={null}
curl -X POST "https://api.unibee.dev/merchant/metric/event/current_value" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "user@example.com",
  "externalUserId": "id_example",
  "metricCode": "",
  "productId": 0,
  "userId": 0
}'
```

### Sandbox

```bash theme={null}
curl -X POST "https://api-sandbox.unibee.top/merchant/metric/event/current_value" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "user@example.com",
  "externalUserId": "id_example",
  "metricCode": "",
  "productId": 0,
  "userId": 0
}'
```

***

## Response

Success responses return a JSON envelope with `code`, `data`, `message`, `redirect`, and `requestId`. `code` `0` indicates success.

| Field               | Type    | Description                                                         |
| ------------------- | ------- | ------------------------------------------------------------------- |
| `code`              | integer | Response code. `0` = success                                        |
| `data`              | object  | Response payload                                                    |
| `data.currentValue` | integer |                                                                     |
| `data.metricLimit`  | object  |                                                                     |
| `data.totalLimit`   | integer | Total limit for the metric. Returns -1 if metric is not limit type. |
| `message`           | string  | Human-readable message                                              |
| `requestId`         | string  | Request ID for support                                              |

***

## Error handling

| HTTP status | Meaning                                                                   |
| ----------- | ------------------------------------------------------------------------- |
| 400         | Bad request — invalid or missing parameters. Check `message` in the body. |
| 401         | Unauthorized — missing or invalid API key.                                |
| 404         | Not found — invalid path or resource.                                     |
| 500         | Server error — retry with backoff.                                        |

When `code` in the response body is non-zero, check `message` for details. Use `requestId` when contacting support.


## OpenAPI

````yaml post /merchant/metric/event/current_value
openapi: 3.0.0
info:
  description: UniBee Api Server
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: OpenAPI UniBee
  version: daily,buildtime:202603161017
servers:
  - url: https://api.unibee.dev
  - url: https://api-sandbox.unibee.top
security:
  - Authorization: []
paths:
  /merchant/metric/event/current_value:
    post:
      tags:
        - Metric Event
      summary: Get Merchant Metric Event Current Value
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/unibee.api.merchant.metric.EventCurrentValueReq
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      currentValue:
                        format: int64
                        properties: {}
                        type: integer
                      metricLimit:
                        $ref: >-
                          #/components/schemas/unibee.api.bean.detail.PlanMetricLimitDetail
                      totalLimit:
                        description: >-
                          Total limit for the metric. Returns -1 if metric is
                          not limit type.
                        format: int64
                        properties: {}
                        type: integer
                    type: object
                  merchantId:
                    format: int64
                    properties: {}
                    type: integer
                  message:
                    format: string
                    properties: {}
                    type: string
                  redirect:
                    format: string
                    properties: {}
                    type: string
                  requestId:
                    format: string
                    properties: {}
                    type: string
                type: object
          description: ''
components:
  schemas:
    unibee.api.merchant.metric.EventCurrentValueReq:
      properties:
        email:
          default: account@unibee.dev
          description: >-
            Email， UserId, ExternalUserId, or Email provides one of three
            options
          format: string
          properties: {}
          type: string
        externalUserId:
          description: >-
            ExternalUserId， UserId, ExternalUserId, or Email provides one of
            three options
          format: string
          properties: {}
          type: string
        metricCode:
          description: MetricCode
          format: string
          properties: {}
          type: string
        productId:
          description: >-
            Id of product. Default product will use if productId not specified
            and subscriptionId is blank
          format: int64
          properties: {}
          type: integer
        userId:
          description: >-
            UserId， UserId, ExternalUserId, or Email provides one of three
            options
          format: int64
          properties: {}
          type: integer
      required:
        - metricCode
      type: object
    unibee.api.bean.detail.PlanMetricLimitDetail:
      properties:
        MerchantId:
          format: int64
          properties: {}
          type: integer
        MetricId:
          format: int64
          properties: {}
          type: integer
        PlanLimits:
          format: '[]*detail.MerchantMetricPlanLimitDetail'
          items:
            $ref: >-
              #/components/schemas/unibee.api.bean.detail.MerchantMetricPlanLimitDetail
          properties: {}
          type: array
        TotalLimit:
          format: int64
          properties: {}
          type: integer
        UserId:
          format: int64
          properties: {}
          type: integer
        aggregationProperty:
          description: aggregation property
          format: string
          properties: {}
          type: string
        aggregationType:
          description: 0-count，1-count unique, 2-latest, 3-max, 4-sum
          format: int
          properties: {}
          type: integer
        code:
          description: code
          format: string
          properties: {}
          type: string
        metricName:
          description: metric name
          format: string
          properties: {}
          type: string
        quotaAdjustments:
          description: Quota adjustments (carryover + manual)
          format: '[]*detail.MetricLimitQuotaDetail'
          items:
            $ref: '#/components/schemas/unibee.api.bean.detail.MetricLimitQuotaDetail'
          properties: {}
          type: array
        type:
          description: >-
            1-limit_metered，2-charge_metered,3-charge_recurring,4-limit_recurring
          format: int
          properties: {}
          type: integer
      type: object
    unibee.api.bean.detail.MerchantMetricPlanLimitDetail:
      properties:
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        gmtModify:
          description: update time
          format: int64
          properties: {}
          type: integer
        id:
          description: id
          format: int64
          properties: {}
          type: integer
        merchantId:
          description: merchantId
          format: int64
          properties: {}
          type: integer
        merchantMetric:
          $ref: '#/components/schemas/unibee.api.bean.MerchantMetric'
        metricId:
          description: metricId
          format: int64
          properties: {}
          type: integer
        metricLimit:
          description: plan metric limit
          format: int64
          properties: {}
          type: integer
        planId:
          description: plan_id
          format: int64
          properties: {}
          type: integer
        quantity:
          description: quantity for this plan
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.detail.MetricLimitQuotaDetail:
      properties:
        adjustmentTime:
          description: adjustment time (for manual)
          format: int64
          properties: {}
          type: integer
        id:
          format: int64
          properties: {}
          type: integer
        merchantMemberEmail:
          description: operator email (for manual)
          format: string
          properties: {}
          type: string
        merchantMemberId:
          description: operator id (for manual)
          format: int64
          properties: {}
          type: integer
        previousPeriodLimit:
          description: previous period limit (for carryover)
          format: int64
          properties: {}
          type: integer
        previousPeriodUsed:
          description: previous period used (for carryover)
          format: int64
          properties: {}
          type: integer
        quotaAmount:
          description: quota amount
          format: int64
          properties: {}
          type: integer
        quotaType:
          description: carryover or manual
          format: string
          properties: {}
          type: string
        reason:
          description: reason/note
          format: string
          properties: {}
          type: string
      type: object
    unibee.api.bean.MerchantMetric:
      properties:
        aggregationProperty:
          description: aggregation property
          format: string
          properties: {}
          type: string
        aggregationType:
          description: 1-count，2-count unique, 3-latest, 4-max, 5-sum
          format: int
          properties: {}
          type: integer
        archived:
          description: archived
          format: bool
          properties: {}
          type: boolean
        carryoverProrationEnabled:
          description: Enable carryover proration for this metric (false when not set)
          format: bool
          properties: {}
          type: boolean
        code:
          description: code
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        gmtModify:
          description: update time
          format: int64
          properties: {}
          type: integer
        id:
          description: id
          format: int64
          properties: {}
          type: integer
        merchantId:
          description: merchantId
          format: int64
          properties: {}
          type: integer
        metaData:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          description: meta_data(json)
          format: map[string]interface {}
          properties: {}
          type: object
        metricDescription:
          description: metric description
          format: string
          properties: {}
          type: string
        metricName:
          description: metric name
          format: string
          properties: {}
          type: string
        prorationRefundEnabled:
          description: >-
            Enable proration refund for this metric, i.e. reclaim metric limit
            on upgrade (false when not set)
          format: bool
          properties: {}
          type: boolean
        type:
          description: 1-limit_metered，2-charge_metered,3-charge_recurring
          format: int
          properties: {}
          type: integer
        unit:
          description: unit
          format: string
          properties: {}
          type: string
      type: object
    interface:
      properties: {}
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````