# Your first agent over the API in 5 minutes

By the end of this guide you have the answer of an AI agent (a **Met**) that you ran over the API from your terminal. You don't need to install anything: `curl` is enough. If you have `jq`, responses are easier to read, but you don't need it.

The whole path is five steps plus an optional one:

1. Create your account.
2. Get your API key.
3. Check it with `GET /me`.
4. List your Mets.
5. Run one and read the result.
6. (Optional) Receive an event when a run finishes.

If you would rather see it without a terminal, the same Met answers WhatsApp on its own with autopilot: [WhatsApp AI agent](https://meteor.com.co/en/agentes/whatsapp).

## 1. Create your account

[Create your account](https://met.meteor.com.co/registro) self-serve. Every new account starts with a **7-day trial and 5 USD of Energy, no card required**, and the trial includes API access. Signing up creates your workspace, and it comes with its team of Mets ready, so the list in step 4 is not empty.

## 2. Get your API key

In the Meteor dashboard: **Settings → Developers → Create API key**.

- **Environment: test.** The key starts with `met_test_`: your runs don't debit Energy and external effects (sending a WhatsApp message, running an integration) are blocked. It is not an isolated sandbox: it reads and writes your real workspace. See [what test mode does and does not do](authentication.html#what-test-mode-does-and-does-not-do).
- **Scopes:** `agents:read` (list Mets), `runs:execute` (run them) and `runs:read` (read a run again). `GET /me` needs nothing: every key can ask who it is.

The key is shown **only once**. Keep it in an environment variable, never in your code:

```bash
export MET_API_KEY=met_test_your_key
```

## 3. Check the key with GET /me

```bash
curl https://api.met.meteor.com.co/api/v1/me \
  -H "Authorization: Bearer $MET_API_KEY"
```

Every successful response comes inside an envelope, and the resource is in `data`:

```json
{
  "success": true,
  "data": {
    "object": "identity",
    "livemode": false,
    "api_key": {
      "id": "key_01HXYZ",
      "object": "api_key",
      "owner_type": "workspace",
      "env": "test",
      "scopes": ["agents:read", "runs:execute", "runs:read"],
      "rate_limit_rpm": 120,
      "monthly_quota": null
    },
    "workspace": { "object": "workspace", "id": 7, "slug": "acme" },
    "partner": null
  }
}
```

Three things to look at:

- **`workspace.id`** is the number that goes in the paths of the next steps. Save it:

```bash
export MET_WORKSPACE_ID=7
```

- **`livemode: false`** confirms you are in test mode.
- **`api_key.scopes`** is the list a `403 missing_scope` is checked against. If one is missing, create another key with that scope.

If you get a `401`, the key was copied wrong or has been revoked. The other cases are in [Errors and idempotency](errors-and-idempotency.html).

## 4. List your Mets

```bash
curl https://api.met.meteor.com.co/api/v1/workspaces/$MET_WORKSPACE_ID/agents \
  -H "Authorization: Bearer $MET_API_KEY"
```

`data` is the list of Mets in the workspace. For each one you need `id`, `name` (what you call it by), `title` and `mission` (what it is for). `active: false` means it is paused. With `jq`, the list boils down to:

```bash
curl -s https://api.met.meteor.com.co/api/v1/workspaces/$MET_WORKSPACE_ID/agents \
  -H "Authorization: Bearer $MET_API_KEY" | jq '.data[] | {id, name, title, active}'
```

Pick one and save its name:

```bash
export MET_NAME="Name of the Met"
```

## 5. Run it and read the result

```bash
curl -X POST https://api.met.meteor.com.co/api/v1/workspaces/$MET_WORKSPACE_ID/runs \
  -H "Authorization: Bearer $MET_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"met\":\"$MET_NAME\",\"input\":\"Introduce yourself in two sentences: who you are and what you help with.\"}"
```

Without `stream`, the call waits for the Met to finish and returns the complete run:

| Field | What it is |
|---|---|
| `id` | The run id, prefixed with `run_`. Use it to read the run again. |
| `status` | `completed` if it finished well, `failed` if not. |
| `output` | The Met's answer. `null` if the run failed. |
| `error` | Why it failed, when `status` is `failed`. |
| `met` | Which Met handled it. |
| `livemode` | `false` with a `met_test_` key: no Energy was debited. |

To read it again later, with the `id` you got back:

```bash
curl https://api.met.meteor.com.co/api/v1/runs/run_01HXYZ \
  -H "Authorization: Bearer $MET_API_KEY"
```

If you leave out `met`, the workspace's main Met reads the request and decides who answers. If you already know which Met should answer, pass it: the run goes straight to it. Memory across runs, attachments and live responses are in [Run Mets](run-mets.html) and [Streaming](streaming.html).

### The same with the SDK

```ts
import Met from '@meteor.ia/sdk'; // npm install @meteor.ia/sdk

const met = new Met(process.env.MET_API_KEY, {
  workspaceId: Number(process.env.MET_WORKSPACE_ID),
});

const me = await met.me.retrieve();
const mets = await met.agents.list();
const run = await met.runs.create({ met: mets[0].name, input: 'Introduce yourself in two sentences.' });
console.log(me.livemode, run.status, run.output);
```
```python
import os
from meteor_ia import Met  # pip install meteor-ia

met = Met(os.environ["MET_API_KEY"], workspace_id=int(os.environ["MET_WORKSPACE_ID"]))

me = met.me.retrieve()
mets = met.agents.list()
run = met.runs.create("Introduce yourself in two sentences.", met=mets[0]["name"])
print(me["livemode"], run["status"], run["output"])
```

The SDKs hand you the contents of `data` directly.

## 6. (Optional) Receive an event when a run finishes

Instead of asking whether a run finished, let Meteor tell you. You need a public https URL that accepts `POST` and a key with `webhooks:manage` on top of `runs:read`. Register the endpoint from the dashboard (**Developers → Activity → Webhooks**) or over the API:

```bash
curl -X POST https://api.met.meteor.com.co/api/v1/webhook-endpoints \
  -H "Authorization: Bearer $MET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://your-server.com/webhooks/met","enabled_events":["run.completed","run.failed"]}'
```

The response carries the signing `secret` (`whsec_…`) **only once**: keep it, it is how you verify every delivery. To test the URL without running anything, ask for a test delivery with the endpoint's `id`; it arrives with `type: "ping"`:

```bash
curl -X POST https://api.met.meteor.com.co/api/v1/webhook-endpoints/ENDPOINT_ID/test \
  -H "Authorization: Bearer $MET_API_KEY"
```

From then on, every run you start reaches you as `run.completed` or `run.failed`, with the `X-Met-Signature` header. How to verify it and survive retries without processing anything twice: [Receive signed events in your backend](recipe-signed-webhooks.html). The full event catalog is in [Webhooks](webhooks.html#event-catalog).

## What's next

- **Go to production:** create a `met_live_` key with the same scopes. Every run debits Energy. See [Authentication](authentication.html).
- **Pick your path:** [platforms and SaaS](for-platforms.html), [chatbots and AI agents](for-agent-builders.html) or [agencies and integrators](for-integrators.html).
- **Your editor as a client:** connect Claude Desktop, Cursor or your own agent to the [MCP server](../../mcp.html) with the same key.
