---
title: "Merges a feature as the next version"
method: POST
path: "/lambdas/{privateKey}/features/{feature}/merge"
tags: ["Features"]
---

# Merges a feature as the next version

`POST /lambdas/{privateKey}/features/{feature}/merge`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/lambdas/{privateKey}/features/{feature}/merge`
- Auth: none declared

The feature has to be based on the newest version, and its code has to compile - a version is only ever made of
code that compiles. Then its files are saved as the next version, with the feature's specification and change
unless the request says others, and the feature is deleted with its preview and its copy of the data. The lambda's
own data is not touched, so what the preview wrote is not carried over.

With `deploy`, the new version is put online as well; `deployment` says how that went. The version is made either
way. The body is optional.

## Path parameters

- `privateKey` string, required
- `feature` string, required

## Request body

- MergeFeatureRequest: How to merge a feature into the lambda.
  - `Deploy` boolean, nullable: Whether to put the version it becomes online as well
  - `Specification` string, nullable: What the version keeps as what the user wanted; left out, the feature's
  - `Change` string, nullable: What the version says it changes; left out, the feature's, or that it merges the feature

## Response `201`

The feature was merged as `version`, and is gone.

- FeatureMergeResponse: What came of merging a feature.
  - `Merged` boolean: Whether its files became a version, and the feature is gone
  - `Version` VersionResponse: A version, without its files.
    - `Version` integer: Its number, counting from 1
    - `Created` string, date-time: When it was saved
    - `Specification` string, nullable: What the user wanted and why, where whoever saved it said
    - `Change` string, nullable: What it changed, where whoever saved it said
    - `Origin` string, nullable: How it was saved: `template` (what the lambda started as), `api`, `agent`, `git`, `admin` or `system`
  - `Diagnostics` CompilationDiagnostic[]: Why it was not merged, where its code does not compile
    - `Severity` string: `Error`, which keeps the code from going online, or `Warning`
    - `Id` string: What kind of message it is: the C# compiler's (`CS1002`), `LAMBDA0001` for something lambdas may not do, `LAMBDA0002` for a handler the platform cannot serve, or `LAMBDA` for anything else the platform refused
    - `Message` string: What is wrong, and often what to do about it
    - `Line` integer: The line in the file, counting from 1; 0 when it is about no line
    - `Column` integer: The column in the line, counting from 1; 0 when it is about no line
    - `File` string, nullable: The name of the file it is in, as the lambda names it; absent when it is about none of them
  - `Deployment` DeploymentOutcomeResponse: What came of an attempt to put a version online.
    - `Success` boolean: Whether it compiled and is online now. Where it is not, whatever was online before still is.
    - `Lambda` LambdaResponse: A lambda, as whoever holds its editor key sees it.
      - `PublicKey` string: Names its address below the hosting domain. Not a secret; its owner may change it.
      - `PrivateKey` string: The editor key, which authorizes every call about the lambda. Treat it like a password.
      - `Tier` string: `Free`, `Premium` or `Demo`, assigned by the operator. Decides its limits, whether it is kept online while nobody uses it, and whether it may answer at a domain of its own.
      - `Created` string, date-time: When it was created
      - `Modified` string, date-time: When something about it last changed: a save, a deployment, a setting
      - `ActiveVersion` integer, nullable: The version that is online; absent while nothing is
      - `LatestVersion` integer, nullable: The newest version saved, which may be ahead of the one online
      - `PublicUrl` string: Its address below the hosting domain, named after its public key: `https://quiz.genhttp.run/`. While it answers at a domain of its own, this address sends its visitors on to the domain.
      - `EditorPath` string: Where its editor is on this site: `/editor/{privateKey}`. Holds the editor key.
      - `DeployedAt` string, date-time, nullable: When the version online went online; absent while nothing is
      - `DeployedUntil` string, date-time, nullable: When it is taken offline unless it is visited or edited before then - each visit and each edit moves this on. Absent while it is offline, and for a tier that keeps it online.
      - `KeptUntil` string, date-time, nullable: When it is deleted unless it is visited or edited before then. Absent for a tier that keeps it.
      - `Domain` string, nullable: The domain of its own it is configured to answer at, whether or not its tier lets it
      - `DomainServed` boolean: Whether it answers at that domain: it has one, and its tier includes it
      - `Address` string: Where to link to it: its domain while that is served, `publicUrl` otherwise
      - `View` string: How its editor opens for somebody who has not chosen a view of their own: `Full` or `Simple`
      - `GitPath` string: Where it is cloned with git and pushed to, on this site. The versions are the commits of `main`, the features the other branches. Holds the editor key, like the editor's path.
    - `Diagnostics` CompilationDiagnostic[]: What the compiler said: the errors that kept it offline, or the warnings of a version that went online
      - `Severity` string: `Error`, which keeps the code from going online, or `Warning`
      - `Id` string: What kind of message it is: the C# compiler's (`CS1002`), `LAMBDA0001` for something lambdas may not do, `LAMBDA0002` for a handler the platform cannot serve, or `LAMBDA` for anything else the platform refused
      - `Message` string: What is wrong, and often what to do about it
      - `Line` integer: The line in the file, counting from 1; 0 when it is about no line
      - `Column` integer: The column in the line, counting from 1; 0 when it is about no line
      - `File` string, nullable: The name of the file it is in, as the lambda names it; absent when it is about none of them

## Other responses

- `400`: The feature holds exactly what the version it is based on holds, so there is nothing to merge.
- `404`: No lambda has this editor key, or the lambda has no feature with this key: it never existed, or it was merged or deleted.
- `409`: The feature is not based on the newest version - the message says which versions to bring in - or it was saved while it was being checked. It is kept as it was.
- `422`: The code of the feature does not compile. `diagnostics` holds what the compiler said; the feature is kept as it was, to be fixed.

---

[API](https://skmtc.dev/genhttp/apis/genhttp-lambda-api.md) · [All operations](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/revisions/8b36699e03df?raw)
