---
title: "Replace plan metadata"
method: POST
path: "/plans/{code}/metadata"
tags: ["plans"]
---

# Replace plan metadata

`POST /plans/{code}/metadata`

## Request

- Base URL: `https://api.getlago.com/api/v1`
- URL: `https://api.getlago.com/api/v1/plans/{code}/metadata`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/getlago/apis/lago-api-documentation/docs/plans/:code/metadata/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint replaces all existing metadata on a plan with the provided key-value pairs.
Any existing metadata keys not included in the request will be removed.

## Path parameters

- `code` string, required

## Request body

- PlanMetadataResponse
  - `metadata` MetadataObject, nullable, required: Custom metadata stored as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.

## Response `200`

Plan metadata replaced

- PlanMetadataResponse
  - `metadata` MetadataObject, nullable, required: Custom metadata stored as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.

## Other responses

- `401`: Unauthorized error
- `404`: Not Found error
- `422`: Unprocessable entity error

## Changes

- **2026-11-03** `5d26657495a3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/getlago/apis/lago-api-documentation/changes/plans/:code/metadata/post.md)

---

[API](https://skmtc.dev/getlago/apis/lago-api-documentation.md) - [All operations](https://skmtc.dev/getlago/apis/lago-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/getlago/apis/lago-api-documentation/revisions/b216574b9612?raw)
