# Templates (Snapshots)

A **Template** (Snapshot) packages the configuration of an already-implemented workspace — Mets, flows, collections, skills and integrations — and installs it into another workspace in minutes. Secrets and live data (contacts, conversations, credentials) never travel: the install is **additive** (it deletes nothing) and everything executable arrives **switched off** until you turn it on.

With your API key you can **browse the catalog** and **install** a template programmatically.

## Scopes

| Scope | What for |
|---|---|
| `snapshots:read` | Browse the catalog and view a template's details |
| `snapshots:install` | Claim (when free) and install a template into the workspace |
| `snapshots:publish` | Submit your template for editorial review (partners only) |

## Install a template with the SDK

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

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

// 1. Discover
const templates = await met.snapshots.list({ vertical: 'inmobiliaria' });
const details = await met.snapshots.retrieve(templates[0].slug);
console.log(details.counts);       // { mets: 4, flows: 12, collections: 6, ... }
console.log(details.requirements); // which channels/credentials to connect afterwards

// 2. Get access (when free) and install
await met.snapshots.claim(details.id);
const install = await met.snapshots.install(details.id, {
  variables: { nombre_negocio: 'Andes Realty' },
});
console.log(install.id, install.status); // follow the progress from the product
```

If the template is paid, `claim` fails: the purchase happens from the product (Stripe checkout). Once bought, `install` works the same way.

## With plain HTTP

```bash
# Catalog
curl https://api.met.meteor.com.co/api/v1/workspaces/123/snapshot-catalog \
  -H "Authorization: Bearer $MET_API_KEY"

# Install
curl -X POST \
  https://api.met.meteor.com.co/api/v1/workspaces/123/snapshots/$SNAPSHOT_ID/install \
  -H "Authorization: Bearer $MET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "variables": { "nombre_negocio": "Andes Realty" } }'
```

## With an agent (MCP)

If you connect Met as an **MCP** server, your agent gets these tools (depending on the key's scopes):

- `met_list_snapshots` — lists the template catalog.
- `met_get_snapshot` — a template's details by slug.
- `met_install_snapshot` — installs a template into the workspace.

That way a coding agent can stand up a full workspace from a template for its vertical with a single key.

## After installing

The install leaves you a **setup checklist**: connect WhatsApp, add integration credentials, activate flows, fill in the business variables. That part requires connecting real accounts and today it is completed **from the product**, not over the API.
