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

# Quickstart

> From zero to your first AnyAPI call in five minutes.

This guide takes you from signup to a live response. You'll create a key, top up
your wallet, and run your first API.

## The fastest path: hand it to your coding agent

If you use a coding agent (Claude Code, Cursor, Codex, or any MCP-capable
assistant), the simplest way to start is to give it one line. Paste this into your
agent and it wires up AnyAPI for you, from key to first live call, without leaving
your editor:

```text theme={"dark"}
Set up https://getanyapi.com/SKILL.md
```

The agent reads the AnyAPI skill, sets up a key, and runs its first API on its own.
Prefer to do it yourself? Follow the manual steps below.

## Prerequisites

* An AnyAPI account — sign up at [getanyapi.com](https://getanyapi.com/dashboard).
* A terminal with `curl` (or any HTTP client).

## Get started

<Steps>
  <Step title="Create an API key">
    In the [dashboard](https://getanyapi.com/dashboard), open **API Keys** and create a new
    key. Copy it somewhere safe — it's shown only once.

    New accounts get a one-time **\$1** credit, so you can make your first calls before
    topping up.

    <Tip>
      Prefer not to leave your terminal? Mint a free trial key with one request - no
      dashboard, no sign-in, no account:

      ```bash theme={"dark"}
      curl -s -X POST https://api.getanyapi.com/agent/signup \
        -H "Content-Type: application/json" \
        -d '{ "label": "quickstart" }'
      ```

      The body is optional; `label` just tags the key. The response includes your
      `aa_live_…` key (shown once). It works immediately on a free trial budget of about
      \$0.15, creates no account, and self-expires in 7 days. When the budget runs out, calls
      return `402 trial_cap_reached`; run `anyapi connect` or open the
      [dashboard](https://getanyapi.com/dashboard) to connect a wallet and keep going. See
      [Let your agent onboard itself](/docs/agent-self-signup).
    </Tip>
  </Step>

  <Step title="Make your first call">
    Every API is a single `POST` to `/v1/run/{sku}`. Pass your key with the
    `X-API-Key` header (or `Authorization: Bearer`) and the SKU's normalized input
    as the JSON body.

    <CodeGroup>
      ```bash curl theme={"dark"}
      curl -s https://api.getanyapi.com/v1/run/tiktok.profile \
        -H "X-API-Key: YOUR_ANYAPI_KEY" \
        -H "Content-Type: application/json" \
        -d '{"handle":"cristiano"}'
      ```

      ```python python theme={"dark"}
      import requests

      res = requests.post(
          "https://api.getanyapi.com/v1/run/tiktok.profile",
          headers={"X-API-Key": "YOUR_ANYAPI_KEY"},
          json={"handle": "cristiano"},
      )
      print(res.json())
      ```

      ```javascript node theme={"dark"}
      const res = await fetch("https://api.getanyapi.com/v1/run/tiktok.profile", {
        method: "POST",
        headers: {
          "X-API-Key": "YOUR_ANYAPI_KEY",
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ handle: "cristiano" }),
      });
      console.log(await res.json());
      ```
    </CodeGroup>

    <Note>
      Building an agent? `/v1/run/{sku}` accepts optional **query parameters** that
      shrink the response so a large result doesn't flood your context window:
      `fields` (keep only these keys), `max_items` (cap the rows), and `summary`
      (outline only). They trim what's returned, never what you're billed. See the
      [MCP server](/docs/mcp-server) page for details.
    </Note>
  </Step>

  <Step title="Read the response">
    You get a normalized envelope. `output` is the result, `costUsd` is what this
    call cost you in real dollars, and `items` is the number of results you were
    charged for (on per-result APIs).

    ```json theme={"dark"}
    {
      "output": { "found": true, "data": { "handle": "cristiano", "followers": 0 } },
      "provider": "AnyAPI",
      "costUsd": 0.002,
      "items": 1
    }
    ```

    <Note>
      A legitimate "not found" is a success: `output` is `{ "found": false, "data": null }`.
      You're only charged when a call succeeds — failed calls cost nothing.
    </Note>
  </Step>
</Steps>

## Find an API

You don't need to know SKUs ahead of time. Browse by category or use the dedicated
ranked search endpoint:

```bash theme={"dark"}
# Browse available social APIs
curl -s "https://api.getanyapi.com/catalog?category=social"

# Search by intent
curl -s "https://api.getanyapi.com/catalog/search?q=tiktok&limit=10"

# Inspect one API's input and output schemas
curl -s https://api.getanyapi.com/v1/apis/tiktok.profile -H "X-API-Key: YOUR_ANYAPI_KEY"
```

Browse and search results report `provider: "AnyAPI"` and nested USD `pricing`.
`pricing.from` is the primary static offer, `pricing.failoverMaxUsd` is the maximum
fallback ceiling, and `failover` reports whether AnyAPI currently has an alternate
route.

These values come from the gateway. The gateway owns input validation, provider
selection, route and lane order, failover, pricing, health semantics, and billing.
Do not infer failover from the number of lanes or recompute `pricing.from` from lane
prices.

If you build a discovery wrapper, treat response objects as extensible. Read the
known fields your application needs, ignore safe additions, and preserve input and
output JSON Schemas as opaque objects. This lets the gateway add customer-safe
metadata without forcing a wrapper release.

The full catalog with typed schemas also lives in the [API Reference](/docs/api-reference/tiktok/tiktok-profile).

## Retry safely after a disconnect

Wallet-funded REST calls support an optional `Idempotency-Key` header. Generate one key for a
logical call and keep it until you receive a terminal response:

```bash theme={"dark"}
curl -s https://api.getanyapi.com/v1/run/reddit.search \
  -H "X-API-Key: YOUR_ANYAPI_KEY" \
  -H "Idempotency-Key: YOUR_UNIQUE_RETRY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"mechanical keyboard"}'
```

When AnyAPI honors the key, the synchronous run can continue in-process after your client
disconnects, bounded by the normal execution deadline. The disconnected socket does not receive
the eventual result. Retry the same SKU, query parameters, body, and key:

* `409 idempotency_in_progress` means the original run is still working. Wait a few seconds and
  retry the same request.
* `200` with `Idempotency-Replayed: true` returns the original `output`, `costUsd`, and `items`
  without another provider run or charge.
* Reusing the key with different request semantics returns `409 idempotency_conflict`.

REST results remain replayable for 24 hours. If the continued run produces a replayable result,
it charges normally exactly once even if the original client disconnected. Calls without an
`Idempotency-Key` stay tied to the caller and are canceled on disconnect.

## Check your balance

```bash theme={"dark"}
curl -s https://api.getanyapi.com/v1/balance -H "X-API-Key: YOUR_ANYAPI_KEY"
```

Top up any time from the [dashboard](https://getanyapi.com/dashboard) — your wallet is a
USD balance you draw down per request. Pay with a card, Link, crypto (USDC), or
Apple / Google Pay; every method funds the same USD wallet.

<Tip>
  Building an AI agent? Skip the per-endpoint wiring and connect the whole catalog
  over MCP instead — see [Connect over MCP](/docs/mcp-server).
</Tip>
