# API Endpoints

API endpoints act as gateways for communication between the wallet application and server systems. These endpoints facilitate the exchange of data, enabling developers to integrate the wallet's functionalities into their applications.

These endpoints provide information about the Activelink wallet user including creating an account, account balances, transaction history, and more.

## **`/init`**

The process configures “near-api-server.config.json” and establishes a master account to store credentials within this file.&#x20;

This setup enables the use of "simple methods," reducing the need to pass multiple parameters, notably the master account ID and private key or seed phrase.

Note: Use near login to save your key pair to your local machine.

<table data-header-hidden><thead><tr><th width="173">Property</th><th>Values</th></tr></thead><tbody><tr><td>API Endpoint</td><td>/init</td></tr><tr><td>API Method</td><td>POST</td></tr><tr><td>API Parameters</td><td><p>master_account_id: The master account that has full access to the NFT contract below.</p><p></p><p>seed_phrase OR private_key: Seed phrase OR private key of the account ID above.</p><p><br>nft_contract: Contract account that has NFT contract deployed to it<br><br>server_host: Public IP address for your API server (localhost is the default)<br><br>Server_port: (Port your API server will listen on.)<br><br>rpc_node: <a href="https://docs.near.org/concepts/basics/networks">Network</a> your server will be running on (testnet, mainnet, or betanet)</p></td></tr><tr><td>API Example</td><td><p><code>{</code></p><p>  <code>"master_account_id": "example.testnet",</code></p><p>  <code>"seed_phrase": "seed phrase for master_account_id goes here",</code></p><p>  <code>"nft_contract": "nft-contract.example.testnet",</code></p><p>  <code>"server_host": "localhost",</code></p><p>  <code>"server_port": 3000,</code></p><p>  <code>"rpc_node": "https://rpc.testnet.near.org"</code></p><p><code>}</code></p></td></tr><tr><td>Response</td><td><p><code>{</code></p><p>  <code>"text": "Settings updated."</code></p><p><code>}</code></p></td></tr></tbody></table>

## **`/create_user`**

Creates a Near sub-account using an initialized master account and saves credentials to /storage directory. Requires /init configuration with the master account.

Note: Only letters, digits, and - or \_ separators are allowed.

<table data-header-hidden><thead><tr><th width="174">Property</th><th>Values</th></tr></thead><tbody><tr><td>API Endpoint</td><td>/create_user</td></tr><tr><td>API Method</td><td>POST</td></tr><tr><td>API Parameters</td><td>None</td></tr><tr><td>API Example</td><td><p><code>{</code></p><p>    <code>"name": "satoshi"</code></p><p><code>}</code></p></td></tr><tr><td>Response</td><td><p><code>{</code></p><p>  <code>"text": "Account satoshi.example.testnet created. Public key: ed25519:HW4koiHqLi5WdVHWy9fqBWHbLRrzfmvCiRAUVhMa14T2"</code></p><p><code>}</code></p></td></tr></tbody></table>

## **`/parse_seed_phrase`**

Converts a seed phrase into a public/private key pair.

Note: Only letters, digits, and - or \_ separators are allowed.

<table data-header-hidden><thead><tr><th width="180">Property</th><th>Values</th></tr></thead><tbody><tr><td>API Endpoint</td><td>/parse_seed_phrase</td></tr><tr><td>API Method</td><td>POST</td></tr><tr><td>API Parameters</td><td>None</td></tr><tr><td>API Example</td><td><p><code>{</code></p><p>    <code>"seed_phrase": "witch collapse practice feed shame open despair creek road again ice least"</code></p><p><code>}</code></p></td></tr><tr><td>Response</td><td><p><code>{</code></p><p>    <code>"seedPhrase": "witch collapse practice feed shame open despair creek road again ice least",</code></p><p>    <code>"secretKey": "ed25519:41oHMLtYygTsgwDzaMdjWRq48Sy9xJsitJGmMxgA9A7nvd65aT8vQwAvRdHi1nruPP47B6pNhW5T5TK8SsqCZmjn",</code></p><p>    <code>"publicKey": "ed25519:Cgg4i7ciid8uG4K5Vnjzy5N4PXLst5aeH9ApRAUA3y8U"</code></p><p><code>}</code></p></td></tr></tbody></table>

## **`/keypair`**

Generates Ed25519 key pair.

Note: Only letters, digits, and - or \_ separators are allowed.

<table data-header-hidden><thead><tr><th width="184">Property</th><th>Values</th></tr></thead><tbody><tr><td>API Endpoint</td><td>/keypair</td></tr><tr><td>API Method</td><td>Get</td></tr><tr><td>API Parameters</td><td>None</td></tr><tr><td>API Example</td><td>http://localhost:3000/keypair</td></tr><tr><td>Response</td><td><p><code>{</code></p><p>  <code>"public_key": "ed25519:3pNJK3fwP14UEbPjQqgDASwWR4XmbAEQBeNsyThhtNKY",</code></p><p>  <code>"private_key": "3s9nVrCU4MER3w9cxXcJM58RGRzFNJnLzo9vgQiNrkuGW3Xp7Up6cYnY4JKQZ7Qp3GhmXckrApRyDPAfzo2oCm8a"</code></p><p><code>}</code></p></td></tr></tbody></table>

## `/balance`

Displays account balance in yoctoNEAR, which is the smallest unit of Near (10^-24 NEAR).

Note: Only letters, digits, and - or \_ separators are allowed.

<table data-header-hidden><thead><tr><th width="186">Property</th><th>Values</th></tr></thead><tbody><tr><td>API Endpoint</td><td>/balance</td></tr><tr><td>API Method</td><td>Get</td></tr><tr><td>API Parameters</td><td>None</td></tr><tr><td>API Example</td><td>http://localhost:3000/balance/name.testnet</td></tr><tr><td>Response</td><td>199999959035075000000000000</td></tr></tbody></table>


---

# 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://activelink.gitbook.io/activelink/activelink-id/wallet/api-endpoints.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.
