> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# API Quickstart

> This quick start guide will get you up and running with the Portal MPC API.

# API Quick Start

## Overview

The Enclave MPC API lives at `mpc-client.portalhq.io`. This API allows you create, backup, and recover Portal MPC Wallets. It also allows you to sign messages and transactions for EVM and Solana chains.

The Enclave MPC API at `mpc-client.portalhq.io` lets you create, backup, and recover Portal MPC wallets, and sign transactions for EVM and Solana chains. This guide gets you started quickly — see the [Enclave MPC API Guide](./enclave-mpc/guide/create-a-client) for details.

## Authentication

Initialize the API with a Client API Key or Client Session Token via the `Authorization: Bearer` header. You can get a test Client API Key from the [Portal Admin Dashboard](https://app.portalhq.io) in the **`Settings`** -> **`Test Client API Keys`** section. Simply click the **`New +`** button.

A modal will then be presented, allowing you to copy your test Client API Key. You can repeat this process as many times as you want to.

## Create a wallet

Generate a wallet with the `/v1/generate` endpoint:

```bash theme={null}
curl -X POST 'https://mpc-client.portalhq.io/v1/generate' \
    -H 'Content-type: application/json' \
    -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
    -d '{}'
```

You’ll receive wallet shares for `SECP256K1` (EVM) and `ED25519` (Solana) curves. Example response:

```json theme={null}
{
  "SECP256K1": {
    "share": "eyJjbGllbnRJZCI6IiIsImJhY2t1cFNoYXJlUGFpcklkIjoiIiwic2lnbml...",
    "id": "clu3aue3j001fs60wdecyz0qy"
  },
  "ED25519": {
    "share": "zMzMzQ4MzIyMDUwMDYwMDc1NzU2NDYzMTU1MzEyODg3MzY5MjQxNTc2lnbml...",
    "id": "clu3auej6001ds60wqhh4tzgx"
  }
}
```

### Confirm the shares are stored successfully

Next, store the generate response and confirm with Portal that you did so successfully with a `PATCH` request. Pass in the `id` values for each of the `SECP256K1` and `ED25519`  objects.

<Note>
  In your production build, be sure to store the full response object in a secure location. For this guide, just save the shares off to the side.
</Note>

```bash theme={null}
curl -X PATCH 'https://api.portalhq.io/api/v3/clients/me/signing-share-pairs' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
    -d '{
      "status": "STORED_CLIENT",
      "signingSharePairIds": ["<YOUR_SECP256K1_SHARE_ID>", "<YOUR_ED25519_SHARE_ID>"]
    }'
```

Great work! Your Portal client's wallet is now all set up to both receive and send tokens.

## Retrieve your wallet's addresses

To view the addresses of your Portal client (along with many other details), simply make a request to the [Get Client Details](./client/reference#get-client-details) endpoint.

```bash theme={null}
curl 'https://api.portalhq.io/api/v3/clients/me' \
    -H 'Authorization: Bearer <YOUR_TEST_CLIENT_API_KEY>'
```

Check out the [Get Client Details API reference](./client/reference#get-client-details) to learn about the other values that are returned, but for this guide we'll focus on the `metadata.namespaces` property, as allows you to easily access your wallet's addresses on various blockchains.

**Example Response**

```json theme={null}
{
  ...,
  "metadata": {
    "namespaces": {
      "bip122": {
        "address": "",
        "curve": "SECP256K1",
        "bitcoin": {
          "p2wpkh": {
            "mainnet": "bc1qpl54na90wlmdxj5z4wtz7cpp6p32dc9th54w0m",
            "testnet": "tb1qpl54na90wlmdxj5z4wtz7cpp6p32dc9tajwa5g"
          }
        }
      },
      "solana": {
        "address": "9JCnYR5kiBYGf3Csz5hLWab53n7ie8o6HaUdeVBUvPRq",
        "curve": "ED25519"
      },
      "stellar": {
        "address": "GB5ULMO2C3IWT5N5PFSBONB3WWRTNHKYCMJ53R2P4QXYRIVSVOJXBAST",
        "curve": "ED25519"
      },
      "eip155": {
        "address": "0x8257a8212a0ce84de8ffb951a42bba2a2a9ffce8",
        "curve": "SECP256K1"
      },
      "tron": {
        "address": "TMrPrVftxf1Yq8jwzrBER58LhfsiBZKhcX",
        "curve": "SECP256K1"
      }
    }
  }
}
```

## Receive testnet tokens

Next, we'll fund your wallet with testnet tokens. We will use the [Client API Fund Wallet endpoint](./client/reference) for this to get some `MON` on Monad Testnet. If you need testnet tokens on other blockchains, we recommend checking out our [Testnet Faucets](../resources/testnet-faucets) doc.

```bash theme={null}
curl --request POST \
  --url https://api.portalhq.io/api/v3/clients/me/fund \
  --header 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
	"chainId": "eip155:10143",
	"token": "NATIVE",
	"amount": "0.01"
}'
```

## Send tokens

Portal provides [several ways to sign and submit transactions](./enclave-mpc/guide/sign-ethereum-transactions), but the simplest is to use the [`/v1/assets/send`](./enclave-mpc/reference#send-assets) endpoint.

### EVM

There are a few request body parameters you will need to provide for this request:

* `share`
  * The `/v1/generate`'s response's `share` property for the `SECP256K1` object.
* `chain`
  * The pretty chain (ie. `monad-testnet`) or the [CAIP-2 chain identifier](../resources/chain-id-formatting).
* `token`
  * The token shorthand (ie. `MON` or `NATIVE`) or the token address of the token you want to send.
* `to`
  * The destination address.
* `amount`
  * The amount of the token you want to send with decimals applied.
* `rpcUrl`
  * The RPC URL is the endpoint Portal uses to submit the transaction. Use Portal’s RPC URL to avoid signing up with a third-party provider.

```bash theme={null}
curl -X POST 'https://mpc-client.portalhq.io/v1/assets/send' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  -d '{
    "share": "<YOUR_SECP256K1_SHARE>",
    "chain": "monad-testnet",
    "token": "NATIVE",
    "to": "0xcae0d97d201ad54275b6e8a6b547c7611ad47963",
    "amount": "0.0001",
    "rpcUrl": "https://api.portalhq.io/rpc/v1/eip155/10143"
  }'
```

The response of this request will include the transaction hash. For standard (EOA) clients you can search the `transactionHash` on [testnet.monadexplorer.com](https://testnet.monadexplorer.com/) to view the transaction details. Account Abstraction clients receive a UserOperation hash instead, which won't resolve on the explorer — see the note below.

```json theme={null}
{
  "transactionHash": "0x2ca7d87c9cb56965224faeeba22f15216ab480581db6902975cb0c494b58edf2",
  "metadata": {
    "amount": ".0001",
    "rawAmount": "100000000000000",
    "tokenDecimals": 18,
    "tokenSymbol": "MON"
  }
}
```

<Warning>
  **Account Abstraction clients:** the `transactionHash` returned here is a **UserOperation hash**, not an on-chain transaction hash — it will **not** resolve on a block explorer such as Etherscan or Monadscan. The on-chain transaction hash is only assigned once the bundler includes the UserOperation on-chain. Look up the UserOperation hash on a UserOp explorer such as [JiffyScan](https://jiffyscan.xyz/) to find the resulting transaction hash. See [Account abstraction](../resources/account-abstraction).
</Warning>

### Solana

Next, let's send tokens using Solana. The request will be very similar to the EVM request we just made, except that we need to use the `ED25519` share from the generate response and `solana-devnet` as our chain.

<Note>
  You will need **`SOL`** to submit a Solana transaction, which is not currently supported by **`portal.receiveTestnetAsset`**. You can find a faucet to get test **`SOL`** tokens [here](../resources/testnet-faucets).
</Note>

```bash theme={null}
curl -X POST 'https://mpc-client.portalhq.io/v1/assets/send' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  -d '{
    "share": "<YOUR_ED25519_SHARE>",
    "chain": "solana-devnet",
    "token": "NATIVE",
    "to": "75ZfLXXsSpycDvHTQuHnGQuYgd2ihb6Bu4viiCCQ7P4H",
    "amount": "0.0001"
  }'
```

The response of this request will include the transaction hash. You can search the `transactionHash` on [solscan.io?cluster=devnet](https://solscan.io/?cluster=devnet) to view the transaction details.

```json theme={null}
{
  "transactionHash": "4TDjz6rnYhKRMmdBBZNBxfEP9AVbd5dDt9m3aEQTJm3cioDFqtnDo7ZcZbs5xQc3vwCf4eAg9vxi1kD46th4wKxq",
  "metadata": {
    "amount": "0.0001",
    "lastValidBlockHeight": "336343025",
    "rawAmount": "100000",
    "tokenDecimals": 9,
    "tokenSymbol": "SOL"
  }
}
```

***

You just created a Portal client, created their wallet, accessed their addresses, received testnet tokens, and sent tokens on both Monad Testnet and Solana Devnet! 🎉

Next we recommend going through the complete [Enclave MPC API guide](./enclave-mpc/guide/create-a-wallet) where we go into much more detail.
