---
title: "Sets the domain a lambda answers at"
method: PUT
path: "/lambdas/{privateKey}/domain"
tags: ["Domain"]
---

# Sets the domain a lambda answers at

`PUT /lambdas/{privateKey}/domain`

## Request

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

Takes effect at once: the next request addressed to the domain reaches the lambda, one addressed to its previous
domain no longer does, and its subdomain of the hosting domain sends its visitors on to the domain from then on -
so the domain should point here, with a certificate, first.

The domain is lower cased, an international one written as it is in the DNS, and a pasted address is forgiven its
scheme and path. It needs an ending (`example.com`, not `example`), and may not be an IP address or a name of the
platform. Sending none removes it, as `DELETE` does.

## Path parameters

- `privateKey` string, required

## Request body

- DomainChangeRequest: The domain a lambda is to answer at.
  - `Domain` string, nullable: The domain, as it should answer: `shop.example.com`, or `www.example.com` to answer there. Nothing, or an empty one, removes it.

## Response `200`

The domain afterwards, and what it resolves to

- DomainResponse: The domain of a lambda, and whether it answers at it.
  - `Domain` string, nullable: The domain it is configured to answer at; absent without one
  - `Tier` string: The tier of the lambda, which decides whether it may have one
  - `Allowed` boolean: Whether the tier includes a domain of its own: only the premium tier does
  - `Served` boolean: Whether requests to the domain reach the lambda right now - it has one, and its tier includes it. A domain kept from a premium tier is not served.
  - `Dns` DnsResponse: What a domain resolves to, looked up by the server as the request was answered. Only the addresses - not whether they are this installation's, which is for whoever knows where it runs to compare.
    - `Addresses` string[]: Every address the domain resolved to, IPv4 and IPv6 alike
    - `Problem` string, nullable: Why nothing could be resolved, where nothing could: it does not resolve yet, or the name servers could not be asked

## Other responses

- `204`: A response containing no body
- `400`: That is not a domain that can be used. The message says why.
- `403`: The lambda is not in the premium tier - or it is a demo.
- `404`: No lambda has this editor key. A key that never existed and the key of a deleted lambda are answered alike.
- `409`: Another lambda answers at that domain.

---

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