> For the complete documentation index, see [llms.txt](https://hydromancer.xyz/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hydromancer.xyz/docs/rest-api/overview.md). Agents can also search and read this documentation through its [MCP server](https://hydromancer.xyz/docs/~gitbook/mcp).

# Get Started with the REST API

API service for querying user state information from Hyperliquid. All endpoints require Bearer token authentication.

### Authentication

All API requests must include an authorization header with a Bearer token.

```
Authorization: Bearer YOUR_API_KEY
```

### Mainnet URL

```url
https://api.hydromancer.xyz
```

### Testnet URL

{% hint style="warning" %}
Everything is the same except when it's described in the docs of the specific endpoint
{% endhint %}

See [Testnet](https://hydromancer.xyz/docs/rest-api/testnet.md) for keys, limits and differences from mainnet.

```url
https://api-testnet.hydromancer.xyz
```

### Base Endpoint

```
POST /info
```

All requests use the same endpoint with different `type` values to specify the operation.<br>

### Error responses

<details>

<summary>Error responses</summary>

400 Bad Request

```
{
  "error": "Invalid Ethereum address: 0xinvalid"
}
```

401 Unauthorized

```
{
  "error": "Invalid API key"
}
```

502 Bad Gateway

```
{
  "error": "Timeout error"
}
```

500 Internal Server Error

```
{
  "error": "An internal error occurred"
}
```

</details>

### Opt-in structured errors

Send `X-HM-Error-Format: structured-v1` on each request to select structured errors for a supported operation. Without this header, existing responses keep their legacy format. Successful response bodies do not change.

Supported operations are `POST /auth/token`, `GET /labels/{address}`, `fundingHistory`, `fundingPayments`, `allMids`, and these 43 `/info` types:

```
meta spotMeta spotClearinghouseState openOrders exchangeStatus frontendOpenOrders
maxMarketOrderNtls vaultSummaries userVaultEquities leadingVaults extraAgents
subAccounts userFees userRateLimit spotDeployState perpDeployAuctionStatus
delegations delegatorSummary maxBuilderFee userToMultiSigSigners userRole
perpsAtOpenInterestCap validatorL1Votes marginTable perpDexs activeAssetData
webData2 webData3 userAbstraction perpAnnotation perpCategories
perpConciseAnnotations allPerpMetas perpDexStatus perpDexLimits
allBorrowLendReserveStates borrowLendReserveState borrowLendUserState
spotPairDeployAuctionStatus approvedBuilders settledOutcome
outcomeTemplates outcomeDeployerLimits
```

The response confirms selection with `X-HM-Error-Format: structured-v1`. Check this header before decoding a structured error. An authenticated request selecting an unsupported operation returns 406 with `code: "error_format_unavailable"` and no confirmation header. `outcomeMeta` remains unsupported.&#x20;

Authentication and permission checks retain their precedence. Proxy-generated responses may lack confirmation.

A selected error has this shape:

```json
{
  "error": "The node could not complete the request",
  "code": "internal",
  "correlationId": "b69e0b20-329b-4ec5-9712-bfe273319064"
}
```

A forwarded node HTTP failure retains its upstream non-2xx status, including 3xx, 429, and 503, with code `internal`. Node transport failures use 502 or 503 with code `unavailable`. Cache and enrichment failures use 500 with code `internal`.&#x20;

Selected errors redact backend bodies, URLs, and diagnostics. HTTP 304 and HEAD responses remain bodyless, so only status and headers provide evidence for those responses.

An upstream 429 with code `internal` carries no invented retry fields. Admission rate limits retain their existing rate-limit details. Selection adds `X-HM-Error-Format` to `Vary` and exposes the confirmation header to browsers without changing CORS policy.

The Python SDK selects the format per call with `await client.call_structured(name, **params)`. It checks confirmation, retains status, headers, and raw body as evidence, and decodes failures before validating successful data.&#x20;

Selected calls do not follow redirects. Missing confirmation raises `ErrorFormatUnavailable` unless the caller explicitly permits a legacy response with `allow_legacy_response=True`.&#x20;

This option never resends the request. Existing bounded status-based 429 retries still apply.

For `GET /labels/{address}`, a proven missing row returns selected 404 with `not_found`. A ClickHouse query failure returns selected 503 with `unavailable`. Both failures retain legacy 500 responses without the selector.&#x20;

Automatic HEAD requests return the same status and headers as GET with no body. `PATCH /labels/{address}` remains outside structured support and returns selected 406 without confirmation before mutation.

For `fundingPayments`, a missing, expired, or unpublished snapshot and Redis failures return selected 503 with `unavailable`, never 404. Legacy failures remain 500. Successful compressed bytes and snapshot headers are unchanged.&#x20;

Use `await snapshots.fetch_funding_payments_raw(error_format="structured-v1")` to opt in. Missing confirmation fails without a retry. `allow_legacy_response=True` instead returns raw response evidence with `downgraded=True`; it does not resend the request.
