---
title: "Moves a lambda to another tier"
method: PUT
path: "/admin/lambdas/{publicKey}/tier"
tags: ["Administration"]
---

# Moves a lambda to another tier

`PUT /admin/lambdas/{publicKey}/tier`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/admin/lambdas/{publicKey}/tier`
- Auth: none declared. Required headers: `X-Admin-Token`

The tier decides the limits of the lambda, whether it may answer at a domain of its own, and whether it is taken
offline and deleted when nobody uses it. Leaving the premium tier keeps the domain configured, but stops serving it;
what the lambda has beyond the free limits is kept, and only what it saves next is held to them. Nothing is moved
into or out of the demo tier by hand.

## Path parameters

- `publicKey` string, required

## Headers

- `X-Admin-Token` string, required

## Request body

- TierRequest: The tier to move a lambda to.
  - `Tier` string: `Free` or `Premium`, in any case

## Response `200`

The lambda afterwards

- AdminLambdaDetail: Everything about one lambda, for the operator.
  - `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.
  - `Traffic` LambdaTraffic: What one lambda has been doing since the server came up. Counted in memory, so a restart of the server starts every figure again from nothing (`since`).
    - `Totals` LambdaActivity: What one lambda has been doing since the server came up, in totals.
      - `PublicKey` string: The lambda, by its public key
      - `Requests` integer: Requests it answered
      - `Failed` integer: Of those, answered with a server error
      - `Upgrades` integer: Connections upgraded to a websocket
      - `AverageMillis` number, double: The mean time to answer, in milliseconds
      - `SlowestMillis` number, double: The longest time to answer, in milliseconds
      - `BytesOut` integer: What the responses carried, counting only those that said how much - a floor rather than a total
      - `FirstSeen` string, date-time, nullable: When the first request arrived
      - `LastSeen` string, date-time, nullable: When the last request arrived
    - `Minutes` TrafficPoint[]: The last hour, a minute at a time, oldest first
      - `At` string, date-time: When the interval started
      - `Requests` integer: Requests answered in it
      - `Failed` integer: Of those, answered with a server error (5xx)
      - `Rejected` integer: Of those, answered with a client error (4xx), not found included
      - `Upgrades` integer: Connections upgraded to a websocket
      - `AverageMillis` number, double: The mean time to answer, over its requests, in milliseconds
      - `Bytes` integer: What the responses carried, where they said how much
    - `Quarters` TrafficPoint[]: The last day, a quarter of an hour at a time, oldest first
      - `At` string, date-time: When the interval started
      - `Requests` integer: Requests answered in it
      - `Failed` integer: Of those, answered with a server error (5xx)
      - `Rejected` integer: Of those, answered with a client error (4xx), not found included
      - `Upgrades` integer: Connections upgraded to a websocket
      - `AverageMillis` number, double: The mean time to answer, over its requests, in milliseconds
      - `Bytes` integer: What the responses carried, where they said how much
    - `Statuses` StatusClasses: Requests by the class of status they were answered with.
      - `Success` integer: 2xx
      - `Redirect` integer: 3xx
      - `ClientError` integer: 4xx, not found included
      - `ServerError` integer: 5xx
    - `Paths` PathTraffic[]: What was asked for, the busiest paths first
      - `Path` string: The path, relative to the lambda - the same wherever it is reached
      - `Requests` integer: How often it was asked for
      - `Failed` integer: Of those, answered with a server error
      - `AverageMillis` number, double: The mean time to answer it, in milliseconds
    - `Entrances` EntranceTraffic[]: Where it was reached - its subdomain of the hosting domain, or its own domain - the busiest first
      - `Domain` string, nullable: The host it was reached at - its subdomain of the hosting domain, or its own domain
      - `Requests` integer: Requests and websocket upgrades alike - every time somebody came in this way
    - `Since` string, date-time: When the counting started, which is when the server came up
  - `Versions` VersionResponse[]: Its versions, newest first
    - `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`
  - `Activations` ActivationResponse[]: Every stretch of time it was online, newest first
    - `Version` integer: The version that was online
    - `Started` string, date-time: When it went online
    - `Origin` string, nullable: Who put it online: `api`, `agent`, `git`, `admin` (the operator) or `system`
    - `Ended` string, date-time, nullable: When it went offline; absent while it is still online
    - `EndedBy` string, nullable: Why it went offline: `replaced` by another deployment, `stopped` by its owner, `expired` because nobody used it, or taken down by the operator (`admin`)
    - `Seconds` integer: How long it was online, or has been so far, in seconds
  - `Tiers` string[]: The tiers it may be moved to

## Other responses

- `204`: A response containing no body
- `400`: There is no such tier.
- `401`: The token is missing.
- `403`: The demo tier is the installation's own. Nothing is moved into or out of it by hand.
- `404`: No lambda has this public key.

---

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