> ## Documentation Index
> Fetch the complete documentation index at: https://anything.notte.cc/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Calling an API

> One endpoint, one API key, JSON in and JSON out.

## Playground

Every API page has a form of its declared variables, seeded with their defaults, and a run button. Fastest way to answer "does this work" and "what shape is the answer" before writing any code. Runs land in the **Runs** tab and on the **Activity** page like any other.

## Endpoint

Every API you build gets a `function_id` and one endpoint. Call it by POSTing with your Notte API key:

```
POST https://api.notte.cc/functions/{function_id}/runs/start
```

Your API is deployed as a Notte Function, so it is addressed by `function_id`. Get a key at [console.notte.cc](https://console.notte.cc); the key decides which workspace the run is billed to.

<CodeGroup>
  ```bash cURL theme={"system"}
  curl --location 'https://api.notte.cc/functions/YOUR_FUNCTION_ID/runs/start' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "function_id": "YOUR_FUNCTION_ID",
      "variables": { "zip_code": "94110" }
  }'
  ```

  ```python Python theme={"system"}
  from notte_sdk import NotteClient

  client = NotteClient(api_key="YOUR_API_KEY")
  function = client.Function("YOUR_FUNCTION_ID")
  res = function.run(zip_code="94110")

  print(res)
  ```

  ```typescript TypeScript theme={"system"}
  import { NotteClient } from "notte-sdk";

  const notte = new NotteClient({ apiKey: process.env.NOTTE_API_KEY! });

  const result = await notte
    .NotteFunction({ function_id: "YOUR_FUNCTION_ID" })
    .run({ zip_code: "94110" });

  console.log(result);
  ```
</CodeGroup>

<Tip>
  Do not copy these by hand. Every API page and marketplace listing renders them with the real id, parameters, and defaults already filled in.
</Tip>

## Response

```json theme={"system"}
{
  "function_id": "fn_...",
  "function_run_id": "run_...",
  "session_id": "sess_...",
  "status": "closed",
  "result": {
    "listings": [
      { "address": "1234 Mission St", "price": 1150000, "beds": 2, "sqft": 980 }
    ]
  }
}
```

Your data is in `result`, matching the schema on the API's page. The envelope around it identifies the run and, when the API opened a browser, the session it used.

Add `"stream": true` to the body to get SSE log lines as the run happens instead of one JSON body at the end.

## Variables

`variables` is keyed by the API's declared variable names. Omitted values fall back to their defaults. Types are the API's own: a numeric parameter takes a number, not a string.

## When a run fails

A run that raises still returns **200**, with the traceback in `result`. Inspect the payload rather than the HTTP code: an input mistake and a site change look different in the traceback, and a site change is what wakes [self-healing](/docs/build#self-healing).
