---
title: "Compiles code without saving it"
method: POST
path: "/lambdas/{privateKey}/code/check"
tags: ["Code analysis"]
---

# Compiles code without saving it

`POST /lambdas/{privateKey}/code/check`

## Request

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

Exactly as a deployment would compile them, including the checks of what a lambda may not do, but without running
anything. Code that does not compile is not an error of the request: it is answered with `200` and
`success: false`. The files are held to the same rules as a save.

## Path parameters

- `privateKey` string, required

## Request body

- CodeRequest: The files a question about code is asked of, and where in them to look.
  - `Files` LambdaFile[], nullable: The files of the lambda, `lambda.cs` first, as they would be saved
    - `Name` string: Its path, with forward slashes: `lambda.cs`, `Store.cs`, `resources/web/index.html`, `docs/product.md`. Case sensitive, and also what the compiler's messages name.
    - `Code` string: Its content: the text itself, or base64 where `encoding` says so
    - `Encoding` string, nullable: `base64` for a file that is not text - a picture, a font; left out for text. C# files are always text.
    - `IsCompiled` boolean
    - `IsCode` boolean
    - `IsResource` boolean
    - `Bytes` string, byte
  - `File` string, nullable: The file a question about one file is about; left out, the first
  - `Line` integer: The line of the position, counting from zero
  - `Column` integer: The column of the position, counting from zero

## Response `200`

Whether it compiles, and what the compiler said

- CompilationResponse: Whether code compiles, and what the compiler said about it.
  - `Success` boolean: Whether it compiles, and would go online if it were deployed
  - `Diagnostics` CompilationDiagnostic[]: The errors that keep it from compiling, or the warnings of code that does
    - `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

- `204`: A response containing no body
- `400`: The files cannot be a lambda as they are - `lambda.cs` missing or not first, a name that cannot be used - or they are larger than a version may be.
- `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)
