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

# Getting Started

Make your first API call in five minutes. You need an account that has finished [onboarding](https://docs.capital.ai/accounts/account-opening.md).

## 1. Create a key

In the app, open **More → API** and click **Create**. **View (read only)** is enough to look around; add **Trade** if you'll place orders or deploy. Step by step: [Create an API key](https://docs.capital.ai/app/api-keys.md).

![The Create API key dialog](https://mintcdn.com/capital-ai/2r_nz6EQ_1nQxtlD/images/api-keys-create.jpg?fit=max\&auto=format\&n=2r_nz6EQ_1nQxtlD\&q=85\&s=9f50ad2ceb2ff575e5f60c410a9190a4)

The key is shown once. Store it like a password.

## 2. Set it up

```bash theme={null}
export CAPITALAI_API_KEY=...
export CAPITALAI_API_URL=https://capital.ai
```

## 3. Check who you are

```bash REST theme={null}
curl "$CAPITALAI_API_URL/api/v1/whoami" \
  -H "Authorization: Bearer $CAPITALAI_API_KEY"
```

```ts TypeScript theme={null}
const res = await fetch(`${process.env.CAPITALAI_API_URL}/api/v1/whoami`, {
  headers: { Authorization: `Bearer ${process.env.CAPITALAI_API_KEY}` },
});
console.log(await res.json());
```

```json theme={null}
{ "accountId": "acc_123" }
```

A `401` means the key is wrong or revoked. See [Authentication](https://docs.capital.ai/authentication.md#errors).

## 4. Check the account is open

```bash REST theme={null}
curl "$CAPITALAI_API_URL/api/onboarding/status" \
  -H "Authorization: Bearer $CAPITALAI_API_KEY"
```

```ts TypeScript theme={null}
const res = await fetch(`${process.env.CAPITALAI_API_URL}/api/onboarding/status`, {
  headers: { Authorization: `Bearer ${process.env.CAPITALAI_API_KEY}` },
});
console.log(await res.json());
```

`status` must be `active` before anything below works. See [Account Opening](https://docs.capital.ai/accounts/account-opening.md#onboarding-status).

## 5. Place an order

This step trades on the exchange and needs the **Trade** scope. Pick a contract from the Markets page, for example `H100SXM-11-26`, and buy one at a limit price. Prices are whole dollars per contract, in cents.

```bash REST theme={null}
curl -X POST "$CAPITALAI_API_URL/api/v1/compute/commands" \
  -H "Authorization: Bearer $CAPITALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_id": "0b1f0a4e-7c1e-4a44-9b1a-0a1e3c2d4f55",
    "command": {
      "type": "place_order",
      "instrument_id": "H100SXM-11-26",
      "side": "buy",
      "lots": "1",
      "price_cents": "140000",
      "time_in_force": "GTC"
    }
  }'
```

```ts TypeScript theme={null}
const res = await fetch(`${process.env.CAPITALAI_API_URL}/api/v1/compute/commands`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CAPITALAI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    request_id: crypto.randomUUID(),
    command: {
      type: 'place_order',
      instrument_id: 'H100SXM-11-26',
      side: 'buy',
      lots: '1',
      price_cents: '140000',
      time_in_force: 'GTC',
    },
  }),
});
console.log(await res.json());
```

```json theme={null}
{ "request_id": "0b1f0a4e-…", "status": "COMMITTED", "object_id": "8123" }
```

`COMMITTED` means the exchange accepted the order; `object_id` is its order ID, which [cancels](https://docs.capital.ai/compute/orders.md#cancel-an-order) it. `REJECTED` carries a `message` saying why. Every field is explained in [Orders](https://docs.capital.ai/compute/orders.md).

## 6. Deploy what you hold

Once you hold a provider's BASIS contract and the GPU contract for the same month, ask for the machines:

```bash REST theme={null}
curl -X POST "$CAPITALAI_API_URL/api/v1/compute/deployments" \
  -H "Authorization: Bearer $CAPITALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"basis_symbol": "BBA-10-26", "gpu_symbol": "H100SXM-10-26", "gpus": 8}'
```

```ts TypeScript theme={null}
const res = await fetch(`${process.env.CAPITALAI_API_URL}/api/v1/compute/deployments`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CAPITALAI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ basis_symbol: 'BBA-10-26', gpu_symbol: 'H100SXM-10-26', gpus: 8 }),
});
console.log(await res.json());
```

The deployment comes back as `requested`. Ops provisions the machines and sends access by email; its status moves to `active`. See [Deployments](https://docs.capital.ai/compute/deployments.md).

## 7. Watch it in your activity

```bash REST theme={null}
curl "$CAPITALAI_API_URL/api/v1/transactions?limit=20" \
  -H "Authorization: Bearer $CAPITALAI_API_KEY"
```

```ts TypeScript theme={null}
const res = await fetch(`${process.env.CAPITALAI_API_URL}/api/v1/transactions?limit=20`, {
  headers: { Authorization: `Bearer ${process.env.CAPITALAI_API_KEY}` },
});
console.log(await res.json());
```

## Next

* The contracts, prices and fees: [Contracts](https://docs.capital.ai/compute/overview.md).
* Fund the account from code: [Funding Overview](https://docs.capital.ai/funding/overview.md).
* Every endpoint: start at [Account](https://docs.capital.ai/accounts/account-and-profile.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.