---
title: "POST /custom-metric/{metricName}"
method: POST
path: "/custom-metric/{metricName}"
---

# POST /custom-metric/{metricName}

`POST /custom-metric/{metricName}`

Use this API to define a Custom Metric published by your devices to Device Defender.

Requires permission to access the [CreateCustomMetric](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions) action.

## Path parameters

- `metricName` string, required

## Request body

- object
  - `displayName` string — The friendly name in the console for the custom metric. This name doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. You can update the friendly name after you define it.
  - `metricType` 'string-list' | 'ip-address-list' | 'number-list' | 'number', required — <p> The type of the custom metric. </p> <important> <p>The type <code>number</code> only takes a single metric value as an input, but when you submit the metrics value in the DeviceMetrics report, you must pass it as an array with a single value.</p> </important>
  - `tags` Tag[] — Metadata that can be used to manage the custom metric.
    - `Key` string, required — The tag's key.
    - `Value` string — The tag's value.
  - `clientRequestToken` string, required — Each custom metric must have a unique client request token. If you try to create a new custom metric that already exists with a different token, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.

## Response `200`

Success

- CreateCustomMetricResponse
  - `metricName` string — The name of the custom metric to be used in the metric report.
  - `metricArn` string — The Amazon Resource Number (ARN) of the custom metric. For example, <code>arn:<i>aws-partition</i>:iot:<i>region</i>:<i>accountId</i>:custommetric/<i>metricName</i> </code>

## Other responses

- `480` — InvalidRequestException
- `481` — LimitExceededException
- `482` — ResourceAlreadyExistsException
- `483` — ThrottlingException
- `484` — InternalFailureException

---

[API](https://skmtc.net/aws/apis/iot.md) · [All operations](https://skmtc.net/aws/apis/iot/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/iot/versions/deef5c4b09f0/schema)
