# Add method

> Source: https://truto.one/docs/cli/integrations-add-method/

`truto integrations add-method` lands **one method** on an existing integration resource. You supply the HTTP details (or paste a curl example); the CLI merges them into `config.resources` and PATCHes the integration. There are **no LLM calls** and no doc crawl.

Use this when you already know what to add. For building or reshaping a whole integration from API docs, use [AI-powered build](/docs/cli/integrations-build) instead.

## Command shape

```bash
truto integrations add-method <slug-or-id> <resource> <method-name> \
  --http-method <verb> \
  --path <path-template>
```

**Arguments:**

| Argument | Description |
| --- | --- |
| `slug-or-id` | Integration slug (e.g. `hubspot`) or UUID |
| `resource` | Resource name (e.g. `contacts`). Created empty if missing unless `--no-create-resource` |
| `method-name` | Method key (e.g. `list`, `get`, `archive`). Not overwritten unless `--force` |

## Examples

```bash
# Archive a contact
truto integrations add-method hubspot contacts archive \
  --http-method POST \
  --path /crm/v3/objects/contacts/{{id}}/archive

# List with cursor pagination (auto-creates resource if needed)
truto integrations add-method acme-crm deals list \
  --http-method GET \
  --path /deals \
  --pagination cursor \
  --response-path results

# Dry-run: print patched config, no API call
truto integrations add-method hubspot contacts archive \
  --http-method POST \
  --path /contacts/{{id}}/archive \
  --print

# Write patched config to a file for review
truto integrations add-method hubspot contacts archive \
  --http-method POST \
  --path /contacts/{{id}}/archive \
  --out patched.json
```

## From curl (`--from-curl`)

Paste a curl block from provider docs; verb, path, body, and `body_format` are extracted mechanically. Headers are ignored (auth lives on the integration's `authorization` block, not per-method):

```bash
truto integrations add-method acme-crm contacts create \
  --from-curl 'curl -X POST "https://api.acme.test/v1/contacts" \
    -H "Authorization: Bearer $TOKEN" \
    -d "{\"name\":\"jane\"}"' \
  --print
```

Explicit flags override curl-derived values:

```bash
truto integrations add-method hubspot contacts archive \
  --from-curl 'curl -X POST "https://api.hubapi.com/crm/v3/objects/contacts/12345/archive"' \
  --path '/crm/v3/objects/contacts/{{id}}/archive'
```

The CLI warns (does not fail) when the curl URL host disagrees with the integration's `base_url`.

## Common options

| Flag | Description |
| --- | --- |
| `--http-method` | `GET`, `POST`, `PATCH`, `PUT`, `DELETE`, … |
| `--path` | Upstream path; may use `{{id}}`, `{{body.field}}`, `{{query.field}}` |
| `--from-curl` | Parse verb/path/body from curl text |
| `--response-path` | JSONata path to unwrap list/object in responses (e.g. `results`) |
| `--body` / `--body-file` / `--body-format` | Default request body for the method |
| `--pagination` | `cursor`, `offset`, `page`, or `none` |
| `--force` | Replace an existing method with the same name |
| `--no-create-resource` | Fail if the resource does not exist |
| `--no-validate` | Skip pre-PATCH schema validation (escape hatch) |
| `--print` | Print merged config to stdout instead of PATCHing |
| `--out` | Write merged config to a file (no API call) |

## Behavior notes

- Reads the live integration `version` for optimistic-locking PATCH.
- Validates the merged config against `IntegrationConfig` (issues touching only the edited method block the push unless `--no-validate`).
- Does **not** create per-method **documentation** rows (`description`, schemas). Use [AI-powered build](/docs/cli/integrations-build) or `truto integrations apply` after adding docs to an IntegrationFile.

## Next steps

- [Managing integrations](/docs/cli/integrations) — list/get/update integrations
- [AI-powered build](/docs/cli/integrations-build) — full integration from docs
