---
title: "Publishes the code of a lambda"
method: PUT
path: "/lambdas/{privateKey}/source"
tags: ["Open source"]
---

# Publishes the code of a lambda

`PUT /lambdas/{privateKey}/source`

## Request

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

Asked again, it changes the license or the author. Every version kept is published at once, and every version saved later as well. What the request leaves out stays
as it is; published for the first time without a license, it is MIT. The license names the `author` as the holder
of the copyright - or, without one, "the authors of" the lambda. Whatever somebody downloaded keeps the license it
came with.

## Path parameters

- `privateKey` string, required

## Request body

- SourceRequest: What a lambda's source is to be published under. What is left out stays as it is.
  - `License` string, nullable: The SPDX identifier of one of the licenses on offer; `MIT` when a source is first published without one
  - `Author` string, nullable: Who holds the copyright, as the license is to name them, on one line; empty names nobody

## Response `200`

What it is published under now

- SourceSettingsResponse: What a lambda's source is published under.
  - `Published` boolean: Whether anybody may read it right now - it may have been taken down since
  - `License` LicenseResponse: A license a source can be published under.
    - `Id` string: Its SPDX identifier, which is how it is asked for: `MIT`, `Apache-2.0`, `GPL-3.0-or-later` …
    - `Name` string: Its full name
    - `Kind` string: `Permissive`, `Copyleft` or `PublicDomain` - roughly what it asks of whoever reuses the code
    - `Url` string: Where it is described in full
  - `Author` string, nullable: Who holds the copyright, where the owner named somebody
  - `Holder` string: Who the license names: the author, or the authors of the lambda
  - `Stars` integer: How many visitors starred it - kept while it is taken down
  - `PublishedAt` string, date-time: When it was published
  - `Updated` string, date-time: When what it is published under last changed
  - `Path` string: Where it is read on this site: `/source/{publicKey}`

## Other responses

- `204`: A response containing no body
- `400`: The license is not one on offer, or the author is too long or more than one line.
- `403`: The lambda is a demo, which anybody may read and nobody may change. Create a lambda of your own from it instead: `POST /lambdas` with the demo's id as `template`.
- `404`: No lambda has this editor key. A key that never existed and the key of a deleted lambda are answered alike.

---

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