# Launch a Token

> Create a pump.fun token on Solana, plan its wallets, fund them and deploy it, then check that it is live.

This guide follows the path the web app takes when you create a token: details, then settings, then funding, then
launch. At the end you have a pump.fun token deployed on Solana and bought by a dev wallet and three holder wallets.

It uses the most common combination: Solana, pump.fun (the app's default launchpad) and the `Stagger` launch method,
where the holders buy one after another with a random delay. The app picks the Block-0 bundle (`Mev`) by default for
pump.fun. That method uses the same calls with a different plan; see
[Update a launch plan](/reference/launches/#update-launch-plan).

You need:

- an upgraded session token in `$PROXIMA_JWT` ([Quickstart](/getting-started/quickstart/));
- a funder wallet, and SOL to send to it;
- an image for the token.

Amounts are integer strings in base units: lamports for SOL, and token units with 6 decimals for a pump.fun token.
See [Amounts](/getting-started/conventions/#amounts-and-large-integers).

## 1. Create the draft

[Create a launch](/reference/launches/#create-launch) stores the token's metadata and uploads the image. The token
is not on chain yet. For pump.fun, the API also reserves the mint address.

```bash
curl -X POST https://api-mig.proxima.tools/launch/sol/pumpfun/create-mint \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -F "name=Orbit Cat" \
  -F "symbol=ORBIT" \
  -F "description=A cat in low orbit." \
  -F "image=@orbit-cat.png" \
  -F "website=https://orbitcat.example"
```

```json
{ "ok": true, "message": "Successfully create mint datas", "launch_id": "101250846193377" }
```

The launch id is a 15-digit string whose first digits encode the chain (`101` is Solana). Keep it as a string.

> **Warning:** Each call creates a new draft. If the call times out, look for the draft in
> [`GET /license/get-mints-info`](/reference/licenses/#list-mints) before you send it again.

**Keep:** `launch_id`.

## 2. Pick the funder

The funder pays for everything the launch buys. [List funders](/reference/funders/#list-funders) returns yours. The
app uses the one whose `is_default` contains `sol`.

```bash
curl https://api-mig.proxima.tools/wallets/funders/list \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

```json
{
  "funders": [
    {
      "pubkey": "2iXMR8bo1TxZWW4gh8WdZdUXELjhGmQ8UBwbqGEYV2KF",
      "network_type": "svm",
      "is_default": ["sol"],
      "native_balances": { "sol": "250000000" },
      "created_at": 1790380800
    }
  ]
}
```

**Keep:** the funder's `pubkey`.

## 3. Save the plan

[Update a launch plan](/reference/launches/#update-launch-plan) sets the launch method, the funder and the wallets
that buy at launch. `"key": "None"` asks the API to generate a fresh wallet. To use one of your existing wallets,
send `{ "pubkey": "…" }` instead.

This is the plan the app builds for a Stagger launch:

- `dev.buy_supply` is the dev buy as a token amount. Here it is 2% of the 1,000,000,000 supply.
- Each holder spends `buy_native` lamports.
- `buy_delay` and `buy_delay_max` bound the random gap between holder buys, in milliseconds.
- `slippage` is in basis points. The app sends `10000` for Stagger, since each holder spends a fixed amount.

```bash
curl -X POST https://api-mig.proxima.tools/launch/update-launch-plan/101250846193377 \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "launch_method": "Stagger",
    "funding_type": "Classic",
    "funding_delay": 0,
    "scheduled_mode": false,
    "buy_delay": 1500,
    "buy_delay_max": 4000,
    "slippage": 10000,
    "fake_tip_pct": 0,
    "funder": { "key": { "pubkey": "2iXMR8bo1TxZWW4gh8WdZdUXELjhGmQ8UBwbqGEYV2KF" } },
    "dev": { "key": "None", "buy_supply": "20000000000000" },
    "holder": [
      { "key": "None", "buy_native": "500000000" },
      { "key": "None", "buy_native": "400000000" },
      { "key": "None", "buy_native": "300000000" }
    ],
    "front_mev": [],
    "back_mev": [],
    "temp_holder": []
  }'
```

```json
{
  "ok": true,
  "plan": {
    "launch_method": "Stagger",
    "dev": { "key": { "pubkey": "8M4PPg4goA6dH3HTQs7kFtJwgvb3dRgNaMioaGdgGsxA" }, "buy_supply": 20000000000000, "native_balance": 0, "token_balance": 0 },
    "funder": { "key": { "pubkey": "2iXMR8bo1TxZWW4gh8WdZdUXELjhGmQ8UBwbqGEYV2KF" }, "native_balance": 250000000 },
    "holder": [
      { "key": { "pubkey": "6i6zd3qY5tT7d1LwhqNkQ7pNXzeaqMQP6WjpJ14273VP" }, "buy_native": 500000000, "native_balance": 0 },
      { "key": { "pubkey": "9AaVX5b1d1q9ugSvjjG2vxbY8tMV6T8tWrDYpGAjYHU7" }, "buy_native": 400000000, "native_balance": 0 },
      { "key": { "pubkey": "AKSyicFZaZfLsoL45Jp6LcraGTDeNKQcqrhGFQHUYJf6" }, "buy_native": 300000000, "native_balance": 0 }
    ],
    "wallets_funded": 0
  },
  "funder_required_native": 2131500000
}
```

> **Warning:** `"key": "None"` creates a new wallet on every call. If you send this body again after the wallets were funded,
> the funded wallets leave the plan and new empty ones replace them. To change a saved plan, read it with
> [Retrieve a launch](/reference/launches/#retrieve-launch) and send each wallet back as `{ "pubkey": "…" }`.

**Keep:** `funder_required_native`, the most the funder needs to hold, fees and a safety reserve included.

## 4. Top up the funder

Send SOL to the funder from any wallet outside Proxima until its balance covers `funder_required_native`. Then
[Get required funding](/reference/launch-funding/#get-required-funding) shows what the launch wallets still need.

```bash
curl https://api-mig.proxima.tools/launch/funding/get-required-funding/101250846193377 \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

```json
{
  "native_funding": { "total_funding_native": 1895000000, "complete": false },
  "quote_funding": { "total_quote_funding": 0, "complete": true },
  "is_funding_complete": false,
  "funding_status": "None",
  "breakdown": {
    "dev_supply_cost": 580000000,
    "dev_extra_funding": 25000000,
    "mev_extra_funding": 0,
    "holder_supply_cost": 1200000000,
    "holder_extra_funding": 75000000,
    "funding_extra_funding": 15000000,
    "total": 1895000000
  }
}
```

**Keep:** nothing new. Go on when the funder's balance in [List funders](/reference/funders/#list-funders) covers
`funder_required_native`.

## 5. Fund the launch wallets

[Fund launch wallets](/reference/launch-execution/#fund-launch-wallets) sends SOL from the funder to the dev and
holder wallets. It answers at once and runs in the background.

> **Danger:** This call moves funds from the funder. It sends only what each wallet still lacks, measured from current balances,
> so it does not fund twice. While a funding runs, another call is refused with `Funding already running`. Once
> the wallets are funded, it answers `No funding needed`. After a timeout, check `funding_status` with
> [Get required funding](/reference/launch-funding/#get-required-funding) before you send it again.

```bash
curl -X POST https://api-mig.proxima.tools/launch/distribute/101250846193377 \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json
{ "ok": true, "funding_job_id": "b16f1a4f-e132-4742-8fae-310a991d92a9", "message": "Successfully started distribution" }
```

A `422` with `Funder don't have enough funds` means the funder holds less than the funding needs: go back to step 4.

Then call [Get required funding](/reference/launch-funding/#get-required-funding) every few seconds (the app polls
every 5) until `is_funding_complete` is `true`. Stop if `funding_status` becomes `Failed`. A new call to this step
then sends only what is still missing.

```json
{
  "native_funding": { "total_funding_native": 0, "complete": true },
  "quote_funding": { "total_quote_funding": 0, "complete": true },
  "is_funding_complete": true,
  "funding_status": "None"
}
```

**Keep:** nothing new. Step 6 only needs `is_funding_complete` to be `true`.

## 6. Launch

[Launch](/reference/launch-execution/#launch) deploys the token, makes the dev buy, then runs the holder buys. It
takes no body and answers a stream of `data:` lines (Server-Sent Events) while it works. It is refused with `409`
`Funding not completed` until step 5 is done.

> **Danger:** This deploys the token and spends the wallets' SOL. It cannot be undone. The launch runs on the server and goes on
> if your connection drops. Never send it again after a timeout: a second call answers `409`
> `Token is currently deploying` while it runs, and fails once the token is out of `Draft`. Check the result in step 7
> instead.

**cURL**

```bash
curl -N -X POST https://api-mig.proxima.tools/launch/101250846193377 \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json"
```
**JavaScript**

```js
const res = await fetch("https://api-mig.proxima.tools/launch/101250846193377", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PROXIMA_JWT}`,
    "Content-Type": "application/json",
  },
});
if (!res.ok) throw new Error((await res.json()).message);

const reader = res.body.pipeThrough(new TextDecoderStream()).getReader();
let buffer = "";
for (;;) {
  const { value, done } = await reader.read();
  if (done) break;
  buffer += value;
  const events = buffer.split("\n\n");
  buffer = events.pop();
  for (const event of events) {
    if (!event.startsWith("data: ")) continue;
    const step = JSON.parse(event.slice(6));
    console.log(`${step.step}/${step.total}`, step.ok ? "ok" : "failed", step.message);
  }
}
```
```text
data: {"step":1,"total":2,"message":"Deploy tx succeeded","ok":true}

data: {"step":2,"total":2,"message":"All stagger buys succeeded","ok":true}
```

Read `ok`, `step` and `total`. The `message` texts vary by launchpad and are meant for display. The app treats the
token as live at the first event with `ok: true` and `step` of 1 or more. A failed deploy ends with
`"ok": false` at step 1. A failed holder buy ends with a message such as `Stagger buys: 1 errored`, and the token
stays live. On launchpads that only assign the mint at deploy, an event also carries `token_address`. For pump.fun
the mint is already known.

**Keep:** the last event. `ok: true` with `step` equal to `total` means every buy went through.

## 7. Check the result

[List mints](/reference/licenses/#list-mints) returns every launch of your license with its `launch_status`: `Draft`
before the launch, `Pending` once the deploy landed and `Finalized` once the buys are done. Find yours by
`launch_id`.

```bash
curl https://api-mig.proxima.tools/license/get-mints-info \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

```json
{
  "mints": [
    {
      "launch_id": "101250846193377",
      "chain_id": "sol",
      "launch_platform": "pumpfun",
      "launch_status": "Finalized",
      "mint_pubkey": "2uTPPCyoFbbzZFzp1se6pCvSDx8MUYyUR3i99eP5pump",
      "name": "Orbit Cat",
      "symbol": "ORBIT",
      "has_launch_plan": true,
      "created_at": 1793671200,
      "launched_at": 1793671512
    }
  ],
  "tags": []
}
```

If the stream dropped before the end, [List a launch's activity events](/reference/history/#list-launch-events)
shows what the launch did since. For wallet balances and PnL, call [Retrieve a launch](/reference/launches/#retrieve-launch).

```bash
curl https://api-mig.proxima.tools/launch/get-launch-info/101250846193377 \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

```json
{
  "launch_method": "Stagger",
  "dev": { "key": { "pubkey": "8M4PPg4goA6dH3HTQs7kFtJwgvb3dRgNaMioaGdgGsxA" }, "native_balance": "21400000", "token_balance": "20000000000000" },
  "holder": [
    { "key": { "pubkey": "6i6zd3qY5tT7d1LwhqNkQ7pNXzeaqMQP6WjpJ14273VP" }, "native_balance": "3100000", "token_balance": "15873015873015" }
  ],
  "pnl_native": "-12500000",
  "pnl_usd": "-2.31"
}
```

**Keep:** `mint_pubkey`, to find the token on chain and in the explorers.

## Next steps

- [Sell automatically](/guides/auto-sell/): plan an auto-sell before step 6 and it starts with the launch.
- [Follow a launch in real time](/guides/follow-a-launch/): balances, PnL and the chart without polling.
- [Withdraw from several wallets](/guides/withdraw-funds/): collect the SOL left in the launch wallets.
- [Launch execution reference](/reference/launch-execution/): bundle launches, sniping and CEX funding.
