# Zaphook API

> Manage ZapHook infrastructure. Use when user wants to: create/update/delete WhatsApp channels (manual or coexistence), configure webhook destinations, check WABA health status, or run initial setup (configure). Do not use for sending or reading messages. Requires API key configured via 'npx zaphook-skills configure'.

- Skill: `zaphook/zaphook-api` (Agent Skill, multi-file: 16 files)
- Install (CLI): `npx skillmds@latest add zaphook/zaphook-api`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zaphook/zaphook-api/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: MIT
- Author: zaphook (https://skillmd.com/u/zaphook)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zaphook/zaphook-api

---


# ZapHook API

Base URL: `https://api.zaphook.cloud`
Auth: `Authorization: Bearer zph_...`

## Setup

```bash
node scripts/configure.mjs --api-key "zph_..." --base-url "https://api.zaphook.cloud"
```

Non-interactive. Config saved to `~/.zaphook/config.json`.
If flags are omitted, falls back to interactive prompts (human use only).

## Channels

### Create Channel

> **RULE:** Before collecting ANY data, first ask the user: **manual** or **coexistence**?
> If the user doesn't understand a term, read references/glossary.md.
> For channel type comparison and required fields, read references/channel-types.md.
> If the user needs help finding credentials, read references/how-to-get-credentials.md.

**Manual:** --name, --waba-id, --phone-number-id, --whatsapp-access-token [--webhook-secret]
**Coexistence:** all above + --verify-token (required)

```bash
# Canal Manual (ZapHook como único BSP)
node scripts/create-channel.mjs --type manual --name "Meu Canal" --waba-id "WABAid" --phone-number-id "PhoneID" --whatsapp-access-token "token"

# Canal Coexistência (manter BSP atual + ZapHook)
node scripts/create-channel.mjs --type coexistence --name "Meu Canal" --waba-id "WABAid" --phone-number-id "PhoneID" --whatsapp-access-token "token" --verify-token "vt_xxx"
```

POST /api/public/v1/channels

### List Channels
```bash
node scripts/list-channels.mjs [--type standard|coexistence|all] [--active true|false] [--name "search"]
```
GET /api/public/v1/channels

### Get Channel
```bash
node scripts/get-channel.mjs --channel-id <uuid>
```
GET /api/public/v1/channels/{channel_id}

### Update Channel
```bash
node scripts/update-channel.mjs --channel-id <uuid> [--name "New Name"] [--active true|false] [--webhook-secret "secret"]
```
PUT /api/public/v1/channels/{channel_id}

### Delete Channel
```bash
node scripts/delete-channel.mjs --channel-id <uuid>
```
DELETE /api/public/v1/channels/{channel_id}

### Channel Health (WABA Status)
```bash
node scripts/channel-status.mjs --channel-id <uuid>
```
GET /api/public/v1/channels/{channel_id}/status
Returns: quality_rating, messaging_limit_tier, status, verified_name, platform_type

## Destinations

### List Destinations
```bash
node scripts/list-destinations.mjs --channel-id <uuid>
```
GET /api/public/v1/channels/{channel_id}/destinations

### Create Destination
```bash
node scripts/create-destination.mjs --channel-id <uuid> --name "CRM" --url "https://..." [--method POST] [--timeout 30]
```
POST /api/public/v1/channels/{channel_id}/destinations

### Update Destination
```bash
node scripts/update-destination.mjs --channel-id <uuid> --dest-id <uuid> [--name "New"] [--active true|false]
```
PUT /api/public/v1/channels/{channel_id}/destinations/{dest_id}

### Delete Destination
```bash
node scripts/delete-destination.mjs --channel-id <uuid> --dest-id <uuid>
```
DELETE /api/public/v1/channels/{channel_id}/destinations/{dest_id}

## Response Format

Success:
```json
{ "data": { ... }, "meta": { "request_id": "uuid", "timestamp": "ISO8601" } }
```

Error:
```json
{ "error": { "code": "INVALID_API_KEY", "message": "...", "details": null } }
```

## Errors

Common: 401 (invalid key), 404 (not found), 422 (validation), 429 (rate limit).
For details and suggestions, read references/error-codes.md.

## Related skills

- `whatsapp-messaging` — Send messages, templates, media
- `observe-whatsapp` — Monitor events, logs, health checks

