# PitchPrfct

> PitchPrfct is an SMS campaign automation, workflow orchestration, AI appointment-booking agent, 10DLC compliance, and reseller platform. One Developer REST API (318 operations across 30 resource groups) and one hosted stateless Streamable HTTP MCP server (311 active tools) share the same OpenAPI contract, scopes, and rate limits.

## Quick Connect

- **Hosted MCP Server (OAuth 2.1 PKCE / CIMD / DCR or `x-api-key`):** `https://app.pitchprfct.com/api/mcp`
  - Claude Code: `claude mcp add --transport http pitchprfct https://app.pitchprfct.com/api/mcp` (or `/plugin marketplace add PitchPrfct/claude-plugins` → `/plugin install pitchprfct@pitchprfct-plugins`)
  - Codex: `codex mcp add pitchprfct --url https://app.pitchprfct.com/api/mcp`
- **Unauthenticated Docs MCP Server (zero-auth search, read, and doc-feedback over guides, recipes, skills, OpenAPI):** `https://app.pitchprfct.com/api/docs/mcp`
  - Claude Code: `claude mcp add --transport http pitchprfct-docs https://app.pitchprfct.com/api/docs/mcp`
- **Install Agent Skills (Claude Code, Codex, Cursor, Gemini CLI, Windsurf, OpenCode):**
  - `npx skills add https://app.pitchprfct.com --skill pitchprfct --yes`
  - Master skill file: https://app.pitchprfct.com/api/docs/skill.md
- **Report Docs, Product, or API Friction (0 credits; works authenticated with any key at 10/min, OR unauthenticated at 5/min & 10/week per IP, 10/min & 50/week globally — ideal if you or your human couldn't find a capability, pricing answer, or integration):** `POST https://app.pitchprfct.com/api/v1/feedback` (MCP: `agent_feedback_submit`; unauthenticated Docs MCP: `submit_pitchprfct_docs_feedback`)
- **Product, Pricing & Marketing Overview (LLMs.txt):** https://www.pitchprfct.com/llms.txt
- **Developer REST API Base URL:** `https://app.pitchprfct.com/api`
  - Account API (`/api/v1/*`, `/api/v2/messages`): `x-api-key: sk_…` or OAuth `Authorization: Bearer pit_…`
  - Organization / Reseller API (`/api/v1/organisation/*`): `x-api-key: osk_…` (strictly disjoint from account keys)
- **Machine-Readable OpenAPI Specification:** https://app.pitchprfct.com/api/docs/openapi.json
- **Complete Single-File Markdown Reference:** https://app.pitchprfct.com/llms-full.txt

## Critical Rules for Agents

- **Single-brace merge fields only:** Always write `{firstName}`, NEVER `{{firstName}}`. Double braces render with a stray brace in sent SMS.
- **Always use `POST /api/v2/messages` with `Idempotency-Key`** (`messages_v2_send` over MCP). Do not use deprecated `POST /api/v1/messages`.
- **Always use `POST /api/v1/workflows/:id/resume`** (`workflows_resume`), never deprecated `activate`. Pause and resume finish asynchronously; poll `GET /api/v1/workflows/:id` until `lifecycleState` leaves `pausing` or `resuming`.
- **Pre-check first-message compliance:** Call `POST /api/v1/compliance/check` before publishing workflows or starting campaigns.
- **Explicit-only money scopes:** `credits:write`, `billing:write`, `organisation:credits:write`, and `organisation:billing:write` are NEVER implied by `full-access`.
- **Primary writes vs search-indexed reads:** Contact writes commit on primary; `GET /api/v1/contacts` reads the search index and can lag writes by a few seconds. Trust `2xx` write responses instead of polling `GET /api/v1/contacts` to confirm creation.
- **Custom fields vs Contact Metadata:** Keep custom fields short (search facets, ≤200 chars). Store up to 10 KB of opaque external CRM/integrator state in `PUT /api/v1/contacts/:uuid/metadata`.
- **10DLC status is poll-only:** Poll `GET /api/v1/10dlc/brands/:id` and `GET /api/v1/10dlc/campaigns/:id` rather than expecting carrier status webhooks.
- **Never expose secrets in chat or browser code:** Keep `sk_…`, `osk_…`, `pit_…`, and `whsec_…` server-side.

## Get Started

- [Agent Quickstart](https://app.pitchprfct.com/api/docs/agent-quickstart.md): Step-by-step playbook for coding agents to connect MCP, install skills, or integrate the REST API.
- [Master Agent Skill](https://app.pitchprfct.com/api/docs/skill.md): Compact routing table, pitfalls, error handling, and completion checklist.
- [Interactive API Reference (Scalar)](https://app.pitchprfct.com/api/docs): Human-friendly explorer (send `Accept: text/markdown` to receive this `llms.txt`).
- [OpenAPI JSON](https://app.pitchprfct.com/api/docs/openapi.json): Full typed paths, schemas, parameters, and webhook payloads.
- [Full Markdown Docs](https://app.pitchprfct.com/llms-full.txt): All guides, recipes, skills, and endpoint tables in one document.

## Guides

- [Authentication & Sandbox Onboarding](https://app.pitchprfct.com/api/docs/guides/auth.md): OAuth 2.1 vs Account/Organization API keys, explicit-only money scopes, and safe sandbox testing.
- [MCP Server](https://app.pitchprfct.com/api/docs/guides/mcp.md): Connect Claude Code, Codex, Cursor, VS Code, Gemini CLI, or ChatGPT to PitchPrfct over Streamable HTTP with OAuth 2.1 or an API key.
- [Errors, Status Codes, and Retries](https://app.pitchprfct.com/api/docs/guides/errors.md): HTTP status codes, machine error codes, low-credit headers, and safe retry rules for REST and MCP.
- [Rate Limits](https://app.pitchprfct.com/api/docs/guides/rate-limits.md): Redis sliding-window limits (sustained, burst, and opt-in buckets) and rate-limit response headers.
- [Workflows](https://app.pitchprfct.com/api/docs/guides/workflows.md): Author linear SMS workflows, edit steps by nodeId, run compliance checks, pause/resume asynchronously, and manage enrollments.
- [AI Agents (Agent Studio)](https://app.pitchprfct.com/api/docs/guides/agents.md): Build, configure knowledge collections, sandbox-test, attach channels to, and publish AI appointment-booking SMS agents.
- [Phone Scrubbing](https://app.pitchprfct.com/api/docs/guides/scrubs.md): Verify contacts for line type, carrier, DNC, and litigator lists, poll progress, download results, and remove bad lines.
- [Webhooks](https://app.pitchprfct.com/api/docs/guides/webhooks.md): Subscribe to 45 outbound events, verify HMAC-SHA256 signatures, handle retries, and inspect sample payloads.
- [OAuth Integrations](https://app.pitchprfct.com/api/docs/guides/oauth.md): OAuth 2.1 authorization code + PKCE S256, CIMD/DCR discovery, token rotation, scopes, and partner integrations.
- [Organization (Reseller) API](https://app.pitchprfct.com/api/docs/guides/organisation.md): Use an osk_ organization API key to create sub-accounts, manage member access, attach spending policies, manage credit pools, and share libraries.

## Implementation Recipes (Copy-Paste Agent Prompts)

- [Send a compliant SMS with v2 idempotency](https://app.pitchprfct.com/api/docs/recipes/send-compliant-sms.md): Pre-check message copy with compliance/check, send idempotently via POST /api/v2/messages, and handle opt-outs, quiet hours, and retries safely.
- [Sync CRM contacts, metadata, tags, and webhooks](https://app.pitchprfct.com/api/docs/recipes/sync-crm-contacts.md): Create/update contacts, store up to 10 KB of external CRM state in contact metadata, apply tags, and verify signed inbound webhooks.
- [Author and launch a compliant workflow campaign](https://app.pitchprfct.com/api/docs/recipes/launch-workflow-campaign.md): Create a multi-step SMS workflow with single-brace merge fields, pass compliance checks, publish, and enroll contacts cleanly.
- [Build, test, and publish an AI SMS booking agent](https://app.pitchprfct.com/api/docs/recipes/build-booking-agent.md): Follow Agent Studio build-guide, create a draft booking agent, add knowledge sources, test in sandbox sessions, attach channels, and publish.
- [Provision and control reseller sub-accounts (Organization API)](https://app.pitchprfct.com/api/docs/recipes/reseller-subaccounts.md): Use an osk_ organization key to create sub-accounts, attach spending policies, mint account API keys server-side, and share workflow/template libraries.

## Agent Skills

Install with `npx skills add https://app.pitchprfct.com --yes` or read individually:

- [pitchprfct](https://app.pitchprfct.com/api/docs/skills/pitchprfct.md): Integrate with the PitchPrfct Developer API and hosted MCP server for compliant SMS/MMS messaging, contacts, lists, tags, custom fields, phone scrubbing, campaigns, workflows, AI booking agents, 10DLC registration, webhooks, credits, and reseller organization management.
- [agent-builder](https://app.pitchprfct.com/api/docs/skills/agent-builder.md): Use when the user wants an AI agent on PitchPrfct that answers contacts by SMS on its own, such as building, editing, testing or publishing an appointment-booking agent, attaching it to phone numbers, workflows or campaigns, or following and taking over the conversations it handles. Covers readiness checks, the setup interview, writing the persona, instructions and qualifying questions, the proposal shown before anything is created, test conversations, a confirmed go-live and what to watch afterwards.
- [campaign-setup](https://app.pitchprfct.com/api/docs/skills/campaign-setup.md): Use when the user wants to text many contacts at once on PitchPrfct, such as launching, scheduling, pausing or resuming an SMS or workflow campaign, building or changing a workflow, choosing its audience, or enrolling contacts in a workflow. Covers readiness checks, audience building, drip pacing, credit estimates and safe launch.
- [compliant-sending](https://app.pitchprfct.com/api/docs/skills/compliant-sending.md): Use before sending any SMS through PitchPrfct, whether one text, a reply in a conversation, or a scheduled message. Covers sender readiness, opt-outs, first-contact wording, quiet hours, credits and idempotent retries, so a message goes out only when it is legal and will deliver.
- [ten-dlc-registration](https://app.pitchprfct.com/api/docs/skills/ten-dlc-registration.md): Use when a PitchPrfct account needs to register or fix its 10DLC setup (brand, 10DLC campaign, phone numbers attached), or when texts are blocked, filtered or held because registration is missing, pending or declined. Walks brand, then campaign, then attach phone numbers, and explains statuses and vetting.

## Machine Discovery Endpoints

- [MCP Server Card](https://app.pitchprfct.com/.well-known/mcp/server-card.json)
- [Agent Card (A2A)](https://app.pitchprfct.com/.well-known/agent-card.json)
- [Agent Skills Discovery v0.2.0](https://app.pitchprfct.com/.well-known/agent-skills/index.json)
- [Skills CLI Index](https://app.pitchprfct.com/.well-known/skills/index.json)
- [OAuth Authorization Server Metadata (RFC 8414)](https://app.pitchprfct.com/.well-known/oauth-authorization-server)
- [OAuth Protected Resource Metadata — MCP (RFC 9728)](https://app.pitchprfct.com/.well-known/oauth-protected-resource/api/mcp)

## Resource Domains

- **Contacts**: Manage your contacts
- **Contact Lists**: Group contacts into static lists
- **Contact Tags**: Manage contact tags
- **Contact Custom Fields**: Manage custom fields for contacts
- **Contact Opt-Outs**: Manage contact opt-out status
- **Blocked Numbers**: Manage phone numbers blocked from sending and receiving messages
- **Pipelines**: Manage lead-tracking pipeline stages and move contacts across stages
- **Appointments**: List, book, reschedule, cancel, and track no-show status on calendar appointments
- **Scrubs**: Check contacts' phone numbers for line type, carrier, and do-not-call and litigator lists, and act on the results
- **Messages**: Send and retrieve messages
- **Scheduled Messages**: Schedule future SMS messages and inspect or cancel pending scheduled sends
- **Analytics**: Read rollup-backed message delivery metrics, carrier holds, opt-out rates, and reply sentiment analytics
- **Templates**: Reusable message templates
- **Conversations**: Access conversation threads
- **Campaigns**: Create, schedule, and control bulk SMS campaigns
- **Phone Numbers**: List your phone numbers with their 10DLC compliance status and labels, and manage call forwarding
- **Workflows**: Create, edit, run and manage workflow automations
- **AI Agents**: Build, test and publish AI SMS agents, and follow the conversations they handle
- **Compliance**: Check that a first message names the brand and gives opt-out wording before a workflow or campaign is published or started
- **10DLC Brands**: Register and manage 10DLC brands
- **10DLC Campaigns**: Create and manage 10DLC campaigns (poll-only review)
- **10DLC Generations**: Auto-generated 10DLC brand + campaign flow
- **10DLC Reference**: 10DLC enums, display-name checks, and provider status
- **Billing**: Read account/billing status and billing-gated capabilities
- **Credits**: Read your credit balance and transfer history
- **Accounts**: List the accounts your organization owns, through a key minted on one of them
- **Organization**: Run your organization through its own organization API key: create accounts and their API keys, spending policies, member access, and read the credit balance
- **Async Operations**: Poll the status of long-running jobs (imports, exports, bulk sends)
- **Manage Webhooks**: Create, update, and inspect webhook subscriptions and their delivery history. See the "Webhooks" section below for the outbound event payloads we send to your endpoints.
- **Feedback**: Report API bugs, documentation mismatches, error-clarity issues, or integration friction from coding agents and integrators
