---
title: "Creates a lambda"
method: POST
path: "/lambdas"
tags: ["Lambdas"]
---

# Creates a lambda

`POST /lambdas`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/lambdas`
- Auth: none declared

The new lambda is in the free tier and has one version: a copy of the `template`, or a snippet that says hello if
none is given. Nothing is online until a version is deployed (`POST /lambdas/{privateKey}/deployment/start`, or a
save with `?deploy=true`). A copy of a demo that keeps records starts with an empty database of its own, switched on;
the demo's records are not copied.

The answer holds the editor key (`privateKey`). It is handed out this once and cannot be recovered: whoever loses it
loses the lambda, and whoever finds it may change it.

A `publicKey` that is asked for is trimmed and lower cased, and must be 3 to 40 characters of `a-z`, `0-9` and `-`,
neither starting nor ending with a dash. It may not start with `demo-` or `xn--`, and a few names are reserved for
the platform (`www`, `api`, `admin`, `mail` and the like). `GET /keys/{publicKey}` says whether a key can be claimed
before trying. Left out, a random key of eight characters is chosen.

## Request body

- CreateLambdaRequest: Asks for a new lambda.
  - `PublicKey` string, nullable: The public key to claim, which names the address: 3 to 40 characters of a-z, 0-9 and dashes. Left out, a random one is chosen.
  - `AcceptedTerms` boolean: Whether the terms of the installation (`terms` of `GET /system`) were accepted. Nothing is created unless this is true.
  - `Template` string, nullable: What the lambda starts as: the `id` of a demo, as `GET /demos` and the starters of `GET /system` list them, or `empty`. Left out, empty.
  - `View` string, nullable: How its editor opens: `Full` (the default) with the code, files and versions, or `Simple` - the app, how it is doing and where to ask for a change, for somebody who is not going to read the code. Case does not matter.

## Response `201`

The lambda was created. Keep `privateKey`: it is not handed out again.

- 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.

## Other responses

- `400`: The terms were not accepted, or the key, the template or the view cannot be used. The message says which.
- `409`: Another lambda has the public key that was asked for.

---

[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)
