# Getting code of a specific node

<mark style="color:green;">`GET`</mark> `/code/node`

Get the code of a specific node in the parsed codebase. These nodes are typically your endpoints or their child functions that were listed as part of flow graph.

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| Authorization | `Bearer <token>` |

**Query Params**

| Name         | Type   | Description                                                          |
| ------------ | ------ | -------------------------------------------------------------------- |
| `project_id` | number | The project id generated during parsing of the code                  |
| `node_id`    | string | The node id that points to the specific node you want to get code of |

**Response**

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" %}

```json
{
    "code": "@api.get(\"/search\")\ndef search(args):\n    q = args.get(\"q\", None)\n\n    if q is None:\n        return { \"error\": \"q parameter required\" }\n    else:\n        results = []\n        for item in example_data[\"items\"]:\n            if item[\"name\"].count(q) > 0:\n                results.append(item)\n        return { \"count\": len(results), \"items\": results }",
    "file": "local-file-path/filename.py",
    "project_id": 4,
    "response": "",
    "start": 55,
    "end": 66,
    "id": "/server.py:search",
    "type": "function",
    "parameters": "[{\"identifier\": \"args\", \"type\": null}]"
}
```

{% endcode %}
{% endtab %}

{% tab title="200" %}

<pre class="language-json" data-overflow="wrap"><code class="lang-json"><strong>null //in case no node was found 
</strong></code></pre>

{% endtab %}

{% tab title="400" %}

```json
{
    "status_code": 400,
    "detail": "Project Details not found." //the project id is incorrect
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.momentum.sh/using-momentum/getting-code-of-a-specific-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
