---
type: api
title: Add or update license
description: Adds a new or updates an existing license.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/operation/operation-set-license
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/cloud-enterprise/operation/operation-set-license
products:
  - Elastic Cloud Enterprise
---

# Add or update license

## Paths

- `PUT` `/platform/license`

## Description

Adds a new or updates an existing license.

## Authentication

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

## Request body

The license to add or update.

`application/json`

- `license` (object) — required
  Information about a license.
  - `version` (integer · format: int32) — optional
    Version of the license
  - `uid` (string) — required
    Unique identifier of the license
  - `issuer` (string) — required
    Issuer of the license
  - `issued_to` (string) — required
    Entity the license was issued to
  - `issue_date_in_millis` (integer · format: int64) — required
    When the license was issued, in milliseconds since the Unix epoch
  - `type` (string) — required
    Type of the license
  - `subscription_type` (string) — optional
    Type of the license subscription
  - `signature` (string) — required
    Digital signature
  - `start_date_in_millis` (integer · format: int64) — required
    Initial validity of the license, in milliseconds since the Unix epoch
  - `expiry_date_in_millis` (integer · format: int64) — required
    When the license expires, in milliseconds since the Unix epoch
  - `max_allocators` (integer · format: int32) — optional
    Maximum number of allocators. Empty for version >= 3
  - `max_ram_per_allocator_mb` (integer · format: int32) — optional
    Maximum RAM per allocator in MB. Empty for version >= 3
  - `max_instances` (integer · format: int32) — optional
    Maximum number of instances. Only present for version 3
  - `max_resource_units` (integer · format: int32) — optional
    Maximum number of resource units, where each unit is 64GB. Only present for version > 3
  - `operation_mode` (string) — optional
    Operation mode
  - `cluster_licenses` (object[]) — optional
    List of cluster licenses
    - `license` (object) — required
      Object containing the cluster license data
- `usage_stats` (object) — optional
  Information about the current usage.
  - `total_connected_memory_total` (integer · format: int32) — required
    The total amount of memory available to your system

## Responses

#### `200`

The license was updated.

`application/json`

Type: `object`

#### `400`

The license could not be updated. (code: `license.invalid_license`)

`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/license" \
  -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{
    "license": {
      "uid": "string",
      "issuer": "string",
      "issued_to": "string",
      "issue_date_in_millis": 0,
      "type": "string",
      "signature": "string",
      "start_date_in_millis": 0,
      "expiry_date_in_millis": 0
    }
  }'
```

