---
title: "Finds where a name was declared"
method: POST
path: "/lambdas/{privateKey}/code/definition"
tags: ["Code analysis"]
---

# Finds where a name was declared

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

## Request

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

Only ever in a file of the request. A name declared elsewhere - by the framework, say - is answered with no file.

## 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`

Where the name was declared, or no file where that is in none of them

- DefinitionResponse: Where a name was declared, or nothing where that is in none of the files.
  - `File` string, nullable: The file it was declared in; absent where it was not declared in any file of the request
  - `Line` integer: The line of the declaration, counting from zero
  - `Column` integer: The column the declared name starts at, counting from zero
  - `Length` integer: How many characters the declared name spans

## Other responses

- `204`: A response containing no body
- `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)
