# Authentication and Keys

This page explains authentication for users integrating with the hosted API.

## 1. API key authentication

Protected endpoints require `X-API-Key`.

Header format:

```bash
X-API-Key: <api_key>
```

Protected endpoints:

1. `GET /wallet`
2. `POST /simulate`
3. `POST /execute`
4. `GET /status/:id`

## 2. Payment proof header

For manual payment flow, after you settle payment on-chain, include `X-Payment-Proof` with JSON payload.

Header format:

```bash
X-Payment-Proof: {"request_id":"your_request_id","payer":"0xYourPayer","token":"USDC","chain":"ethereum","tx_hash":"0xYourPaymentTxHash"}
```

Optional field:

1. `request_id` can be included when re-submitting against a specific quote context.

## 3. API key lifecycle

Hosted API users request keys through the onboarding channel.

Security behavior:

1. Keep key secret in server side configuration.
2. Do not hardcode keys in frontend code.
3. Request key rotation if exposure is suspected.

## 4. Recommended local shell setup

```bash
BASE_URL="https://api.ardentresearch.xyz"
API_KEY="ak_your_key"
```


---

# 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.ardentresearch.xyz/authentication-and-keys.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.
