# Getting started

This guide walks you from zero to a **published flow** you can call over HTTP. It covers both the **web console** path and the **CLI + git** path.

## Prerequisites

- Email address for signup at [fetchcatch.com](https://fetchcatch.com)
- (Optional) [fcc CLI](https://fetchcatch.com/downloads) for repo sync
- (Optional) An OpenAPI JSON URL from an API you want to call from flows

---

## Path A — Console first (recommended for new users)

### Step 1: Create an account

1. Go to [fetchcatch.com/signup](https://fetchcatch.com/signup)
2. Create your tenant account
3. You land in the **console** with your workspace ready

### Step 2: Add an API source

1. Open **API sources** in the sidebar
2. Click **Add source**
3. Paste your OpenAPI document URL (e.g. `https://api.example.com/swagger/v1/swagger.json`)
4. Optionally select an **auth profile** if the API requires credentials
5. Save — operations appear in the flow designer palette

→ Details: [API sources](api-sources.md)

### Step 3: Create a response type (optional but recommended)

1. Open **Response types**
2. Add fields your flow should return (e.g. `approved: boolean`, `reason: string`)
3. Mark required fields

→ Details: [Response types](response-types.md)

### Step 4: Design a flow

1. Open **Flows** → **New flow**
2. Drag nodes from the palette: Start → HTTP → Condition → Decision → End
3. Wire edges; configure JSONata on conditions
4. On the start node, bind your response type
5. Save the draft

→ Details: [Flow designer](flow-designer.md)

### Step 5: Publish

Publish from the designer or flows list. Only **published** versions are callable via `/v1/evaluate`.

### Step 6: Create an API key

1. Open **API keys**
2. Create a key with evaluate permission
3. Copy the secret — shown once

→ Details: [API keys](api-keys.md)

### Step 7: Call your flow

```bash
curl -X POST "https://api.fetchcatch.com/v1/evaluate/your-flow-slug" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId": "u-123", "amount": 100}'
```

→ Details: [Evaluate API](evaluate-api.md)

---

## Path B — CLI + git (recommended for teams)

### Step 1: Install the CLI

Download from [fetchcatch.com/downloads](https://fetchcatch.com/downloads), then:

```bash
fcc install
fcc version --check
```

### Step 2: Initialize your repo

From your project root:

```bash
fcc init --workspace my-project
```

Creates `.fetchcatch/` including `AGENTS.md` for AI coding tools.

### Step 3: Log in

```bash
fcc login
```

Opens the browser for email/password sign-in. Credentials are stored in `~/.fetchcatch/`, not in your repo.

### Step 4: Pull existing flows

If you already built flows in the console:

```bash
fcc pull
```

Files appear under `.fetchcatch/flows/` and `.fetchcatch/response-types/`.

### Step 5: Edit and sync

```bash
# edit JSON locally or in Cursor
fcc status          # see what changed
fcc apply --dry-run # preview push
fcc apply           # push drafts to server
fcc publish         # ship callable version for /v1/evaluate
```

### Step 6: Automate with CI

Add a GitHub Actions workflow to run `fcc apply` then `fcc publish` on merge to main.

→ Example: [Sync & CI](sync-and-ci.md)

---

## The day-to-day loop

```
Design in console  ──pull──►  Edit in git  ──apply──►  Live on server
       ▲                                              │
       └──────────── tweak in console ◄────────────────┘
```

## Troubleshooting

| Issue | Fix |
|-------|-----|
| `fcc apply` conflict | Run `fcc pull`, merge in git, apply again |
| Orphan local flow after console delete | Run `fcc pull` to remove the JSON |
| Delete flow from git | Remove `flows/{slug}.json`, then `fcc apply` |
| Evaluate returns 404 | Flow not published, wrong slug, or flow was deleted |
| HTTP node fails | Check API source URL, auth profile, operation id |
| Expression error | Test in designer Monaco editor; see [JSONata](expressions-jsonata.md) |

## Next steps

- [Core concepts](concepts.md) — deeper mental model
- [Flow designer](flow-designer.md) — visual authoring
- [CLI reference](cli-reference.md) — all commands
- [Runs & debugging](runs.md) — inspect live executions
