---
type: api
title: Set allocator metadata item
description: Adds or updates a single item in the allocator metadata.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/v4/operation/operation-set-allocator-metadata-item
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/v4/operation/operation-set-allocator-metadata-item
products:
  - Elastic Cloud Enterprise
---

# Set allocator metadata item

## Paths

- `PUT` `/platform/infrastructure/allocators/{allocator_id}/metadata/{key}`

#### Path parameters

- `allocator_id` (string) — required
  The allocator identifier.
- `key` (string) — required
  The metadata item key.

## Description

Adds or updates a single item in the allocator metadata.

## Authentication

- Basic: `Authorization: Basic <credentials>`
- Api key: `Authorization: <value>`

## Query string parameters

- `version` (string) — optional
  Checks for conflicts against the metadata version, then returns the value in the `x-cloud-resource-version` header.

## Request body

The value of the metadata item to add or update

`application/json`

- `value` (string) — required
  The metadata value

## Responses

#### `200`

The allocator metadata was successfully changed (the updated JSON is returned)

`application/json`

Type: `object[]`

An array; each item has these fields:

- `key` (string)
  The metadata field name
- `value` (string)
  The metadata value
#### `400`

The value specified for the metadata tag is empty. (code: `allocators.invalid_empty_metadata_item`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `404`

* The allocator specified by {allocator_id} cannot be found. (code: `allocators.allocator_not_found`)
* The metadata item specified by {key} cannot be found. (code: `allocators.metadata_item_not_found`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code examples

#### curl

```curl
curl -X PUT "${API_URL}/platform/infrastructure/allocators/${ALLOCATOR_ID}/metadata/${KEY}" \
  -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "string"
  }'
```

