> For the complete documentation index, see [llms.txt](https://sonic-ai-works.gitbook.io/sonic-networks-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sonic-ai-works.gitbook.io/sonic-networks-docs/sonic-1.0.0-rc-production-architecture/developers-and-api.md).

# Developers & API

SONIC API v1, typed SDK, hooks, IDs/slugs, sessions, wallet and token-sale integration contracts.

SONIC release-candidate interfaces remain under **`/api/v1/*`** and **`/ws/v1`**.

The API is server-authoritative for identity, access, pricing, payment, sale execution, settlement, reconciliation and receipts.

## Typed client boundary

```
lib/sonic/api.ts
packages/sdk/
data/clients/
```

Feature code should call typed domain methods instead of scattering `fetch()` calls and URL literals across components.

## Core hook surface

```ts
useWallets()
useWallet(id)
useTokenSale()
useSaleRelease()
useSaleIntent(id)
useSubscriptions()
useTokenPrice()
useAnalytics()
useNetworkStatus()
```

Hooks own query keys, cancellation, stale-state handling, retry policy and cache invalidation. They do not bypass permissions or reconstruct financial state locally.

## Identity conventions

```ts
type UserId = string;        // immutable durable identity
type WalletId = string;      // internal wallet-link identity
type SaleReleaseId = string; // immutable release identity
type PurchaseIntentId = string;

type Slug = string;          // human-readable routing aid only
```

IDs drive authorization and accounting. Slugs support readable routes but do not replace IDs in protected mutations.

## Selected release-candidate endpoints

```http
GET  /api/v1/users/me
GET  /api/v1/users/:id
GET  /api/v1/users/slug/:slug

GET  /api/v1/sessions
DELETE /api/v1/sessions/:id

GET  /api/v1/wallets
GET  /api/v1/wallets/:id
GET  /api/v1/wallets/:id/balances

GET  /api/v1/subscriptions
GET  /api/v1/token/price
GET  /api/v1/token/activity
GET  /api/v1/analytics/token
GET  /api/v1/networks/current
GET  /api/v1/rpc/health

GET  /api/v1/sale/releases/current
GET  /api/v1/sale/releases/:id
GET  /api/v1/sale/releases/slug/:slug
POST /api/v1/sale/eligibility
POST /api/v1/sale/intents
POST /api/v1/sale/intents/:id/quote
POST /api/v1/sale/intents/:id/prepare
POST /api/v1/sale/intents/:id/submit
```

For the broader API reference, see the [SONIC API Reference](/sonic-networks-docs/api-reference/sonic-api-reference.md).

## Mutation safety

All value-moving or externally visible mutations require idempotency, request fingerprints and explicit state transitions. A repeated idempotency key with a different request fingerprint is rejected as a conflict rather than replayed against changed economics.

## Rate limiting and CORS

Rate limits are route/policy aware, not one arbitrary global number. CORS configuration is environment-specific and deny-by-default for privileged operations. Browser clients never receive provider secrets or service credentials.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://sonic-ai-works.gitbook.io/sonic-networks-docs/sonic-1.0.0-rc-production-architecture/developers-and-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
