# Authentication

All PizzaStack API requests require two headers.

## API Key

Every request must include an `X-API-Key` header with a valid API key.

```
X-API-Key: your-api-key-here
```

Requests without a valid key return `401 Unauthorized`.

## Session ID

Every request must also include an `X-Session-ID` header containing a UUID. This ID ties all your operations together into a single session — the API uses it to track ingredient state across requests.

```
X-Session-ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
```

Generate a UUID once at the start of your session and reuse it for all subsequent requests in that session.

## Example Request

```bash
curl -X POST https://api.tomatopy.pizza/v1/tomato/acquire \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -H "X-Session-ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -d '{
    "variety": "San Marzano",
    "ripeness": 0.8,
    "weight": 150
  }'
```


---

# 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://tomatopy.pizza/docs/developer-documentation/authentication.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.
