# API Reference

Base URL: `http://localhost:3000` (or your deployed URL).\
All request/response bodies are JSON. Standard HTTP status codes apply.

***

#### Agents

**Register an agent**

**`POST /api/agents/register`**

Creates a new agent and a Solana wallet (or links an existing public key if provided).

**Request body:**

```json
{
  "agentId": "string (required)",
  "publicKey": "string (optional, existing Solana public key)"
}
```

**Response:** `201 Created`

```json
{
  "id": "agent-id",
  "publicKey": "Base58SolanaPublicKey...",
  "createdAt": "ISO8601",
  "updatedAt": "ISO8601",
  "isActive": true
}
```

**Errors:** `400` if `agentId` missing; `500` if registration fails (e.g. duplicate agent).

***


---

# 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.netauthpay.com/guides/api-reference.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.
